Re: Render Text to Pixbuf



On 5/1/07, Paul Davis <pjdavis engineering uiowa edu> wrote:
Ooops, those links would probably be useful.

http://lsdcas.engineering.uiowa.edu/test.jpg
http://lsdcas.engineering.uiowa.edu/test2.jpg

The first image makes it fairly apparent that cairo is expecting 32bit
data even when there's no alpha channel. Also after playing with it a
bit, I realized that the color channels are also switched compared to
what the pixbuf expects.

Yes, I guess if you had tried to draw the text in a color other than
white or black, you'd probably see some even more interesting
effects...

I managed to get a not so good method working.  I create a scratch
cairo context using Cairo's image surface.  Then I just use cairo to
draw to this offscreen buffer and copy it onto my pixbuf where it
goes.  Copying from the surface to the pixbuf causes some artefacts
around the edges of the text due to smoothing, but its good enough for
now unless someone has a better idea.

too bad.  I was hoping my quick-and-easy idea would work, but it looks
like the formats aren't compatible enough to make it easy...  I guess
if I were you, I'd ask on a gtk or cairo mailing list as I'm sure
somebody has wanted to do this before.  Maybe somebody there knows a
clever way to do it.

--
jonner



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]