dddaisuke / freetype-go

Automatically exported from code.google.com/p/freetype-go
Other
0 stars 0 forks source link

SetSrc only makes sense if it's image.Uniform #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a non-image.Uniform image in SetSrc.
2. Call freetype.DrawString

What is the expected output? What do you see instead?
I'd expect that the src passed to c.SetSrc gets composited with the destination 
with the two images aligned.

Instead, for each glyph, a region (0, 0) to (w, h) gets used from src, where w, 
h are the dimensions of the glyph, with the result that the actual colors taken 
from src depending on the height of the rendered glyph and adjacent glyphs are 
inconsistently colored.

What version of the product are you using? On what operating system?
Lion on mac, but I'm sure that's irrelevant.

Please provide any additional information below.

In: http://code.google.com/p/freetype-go/source/browse/freetype/freetype.go#212
I think image.ZP should be dr.Min, or possibly adjusted to align src.Min and 
dst.Min.
The comment would need fixing too to specify the meaning of the SetSrc value.

Attached is a variant of one of the example files that exhibits the problem. 
I've tried to make the colors as nasty as possible to make the problem visible. 
I've also attached a png with the output.

Original issue reported on code.google.com by paul.han...@gmail.com on 1 Aug 2012 at 7:56

Attachments:

GoogleCodeExporter commented 9 years ago
You're right. SetSrc isn't useful with a non-Uniform image.

A long time ago, there was talk of re-doing the DrawString API to look more 
like the image/draw package, instead of e.g. separate Context.SetSrc methods. 
See the discussion (not the code) at http://codereview.appspot.com/2208041/

Unfortunately, that talk didn't go anywhere. Thanks for the bug report, though. 
The data point will be useful when I finally have some time to re-think the API.

Original comment by nigel...@golang.org on 2 Aug 2012 at 1:31