Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to draw translucent strings? #72

Open
pkptzx opened this issue May 1, 2019 · 7 comments
Open

How to draw translucent strings? #72

pkptzx opened this issue May 1, 2019 · 7 comments

Comments

@pkptzx
Copy link

pkptzx commented May 1, 2019

i try this:

c := freetype.NewContext()  
...  
c.SetSrc(image.NewUniform(color.RGBA{255, 0, 0, 180})) // 

but always very strange...

Can someone help me?
Thanks

@haozing
Copy link

haozing commented Aug 29, 2019

To draw transparent fonts, use png format.

@pkptzx
Copy link
Author

pkptzx commented Sep 4, 2019

要绘制透明字体,请使用png格式。

那你的意思是先绘制到png上,再图片叠加?那还是一样的问题,半透明的字怎么绘制?
就是水印

@pkptzx
Copy link
Author

pkptzx commented Sep 4, 2019

To draw transparent fonts, use png format.

丑的一塌糊涂

@haozing
Copy link

haozing commented Sep 9, 2019

要绘制透明字体,请使用PNG格式。

那你的意思是先绘制到PNG上,再图片叠加?那还是一样的问题,半透明的字怎么绘制?
就是水印

是的。先生成字体png透明图片。然后叠加。

c := freetype.NewContext()  
...  
c.SetSrc(image.NewUniform(color.RGBA{255, 0, 0, 180})) // 
pt := freetype.Pt(X, Y)
_, err = c.DrawString(s, pt)

@pkptzx
Copy link
Author

pkptzx commented Sep 9, 2019

要绘制透明字体,请使用PNG格式。

那你的意思是先绘制到PNG上,再图片叠加?那还是一样的问题,半透明的字怎么绘制?
就是水印

是的。先生成字体png透明图片。然后叠加。

c := freetype.NewContext()  
...  
c.SetSrc(image.NewUniform(color.RGBA{255, 0, 0, 180})) // 
pt := freetype.Pt(X, Y)
_, err = c.DrawString(s, pt)

你没懂我意思吧?我要文字透明(半透明),不是png背景透明....

@haozing
Copy link

haozing commented Sep 17, 2019

要绘制透明字体,请使用PNG格式。

那你的意思是先绘制到PNG上,再图片叠加?那还是一样的问题,半透明的字怎么绘制?
就是水印

是的。先生成字体png透明图片。然后叠加。

c := freetype.NewContext()  
...  
c.SetSrc(image.NewUniform(color.RGBA{255, 0, 0, 180})) // 
pt := freetype.Pt(X, Y)
_, err = c.DrawString(s, pt)

你没懂我意思吧?我要文字透明(半透明),不是png背景透明....

自己好好看看代码是不是文字透明...

@nigeltao
Copy link
Contributor

nigeltao commented Sep 18, 2019

color.RGBA{255, 0, 0, 180}

Go uses premultipled alpha. The first 255 should be 180.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants