[cairo] Pango and pixbuf

Carl Worth cworth at cworth.org
Tue Jan 9 09:56:40 PST 2007

On Tue, 9 Jan 2007 16:40:39 +0000, "Ignas B." wrote:
> is it possible to draw text not in to GdkDrawable but into GdkPixbuf?

What's the eventual goal for that?

In general GdkPixbuf is an inefficient thing to draw _into_, and
should be avoided. GdkPixbuf is still useful as a way to load images
of many formats, so it's useful to use GdkPixbuf as a source to get
image data _from_ but not much after that.

What I wonder is if you've got some API that wants a GdkPixbuf and
nothing else. If so, that API should probably be fixed to work with a
cairo_surface_t or so.

> If there is no direct function for that, would it be possible to extract
> pixel data from the PangoLayout ?

You can definitely use cairo_image_surface_create_for_data, then
cairo_create to target that surface and render your PangoLayout into
there. That gives you direct access to all the pixel data.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070109/bc6ea7eb/attachment.pgp

More information about the cairo mailing list