Re: Render Text to Pixbuf



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.

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.

Thanks,
Paul Davis

On 5/1/07, Jonathon Jongsma <jonathon jongsma gmail com> wrote:
On 5/1/07, Paul Davis <pjdavis engineering uiowa edu> wrote:
> Ok, so, I'm wasn't entirely wrong, but I was being kind of dumb.
>
> The 'garbage' I was seeing was me not having a large enough font size
> selected.  so now I've got the text being written to the image, but
> its not exactly correct.
>
> I've posted to images so that people can see.
> The first is what happens when I call cairo_surface_write_to_png().
> The second is what it looks like when rendered in my application.  I
> scaled the second one up so you can see the effect a bit better.

hmm, what do you mean by 'posted'?

--
jonner




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