[Mono-list] How to draw a text string to existing photo (gtk#)

Miguel de Icaza miguel at ximian.com
Sat Mar 25 16:42:24 EST 2006


Hello,

> I'm looking for an approach to put some text string to existing jpeg
> image. Now I can load a photo into Gdk.Pixbuf and I can create
> Pango.Layout for a text string. So I have my image in a Gdk.Pixbuf and
> my text string in a Pango.Layout, how can I put those things together to
> obtain an image with text drawn on it? Any suggestions and sample codes
> are welcome.

You could use the System.Drawing API as it has this functionality
already.

If you want to stick to gtk# and Pixbufs, you need to render the pixbuf
into a pixmap which is the only object that you can use to render text
with Pango.

Then you transform the pixmap back into a pixbuf and save that.

Miguel.


More information about the Mono-list mailing list