Trying to draw text on a pixbuf



Hello,

this is my first post ever on a mailing-list, I hope I'm doing it the right way. My apologies if not so.

I'd like to draw text on a pixbuf. I first tried :
- to write text in a PangoLayout
- to render the layout in a pixmap
- to copy the pixmap in the pixbuf

It worked, but the text has a black background that overlap the previously drawn things on the pixbuf. And I can't change the background color (with a gdk_gc_set_background for example).

So, I tried :
- to render the pixmap in a temporary pixbuf
- to add alpha to this pixbuf, making black become transparent
- to copy this temporary pixbuf in my final pixbuf.

Same results. And I don't know why.

Maybe alpha isn't taken into account by gdk_pixbuf_copy_area ? If so, I suppose it's not too hard to make another version of this primitive doing that (but slow). And since it bothers me to have black as background color (what will I do if the foreground color is also black ? It may happen with text), do you have an idea for how to change the background color ?

Thanks in advance. And excuse my english, school is far away now...

Fred



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