golang / freetype

The Freetype font rasterizer in the Go programming language.
Other
778 stars 183 forks source link

Is it possible to use color.Model when rasterizing? #68

Open akiross opened 5 years ago

akiross commented 5 years ago

Hello, this is kinda of a feature request, but also a request for clarification because maybe I just got things wrong. I am trying to work on go-sdl2 so that SDL Surfaces implements go's image.Image and image/draw.Image interfaces. The idea is to be able to render directly on SDL surfaces. After making such changes and trying to use freetype raster's on that surfaces, I noticed that there are a certain number of painters, each of which is working with a specific image format.

Now, I find this confusing: isn't image/color.Model there to perform color conversion from one model to another? So, my question boils down to: why isn't there a painter which can deal with a generic image/draw.Image and use its color model to map the pixels produced by rasterizer to whatever color format the image is using? Is this feasible at all or did I get all wrong?

I thought that, given a certain color you wanted to draw on the image, one could just do img.Set(img.ColorModel().Convert(your_color)). Is a painter like this possible to have?

Thanks!