[cairo] How can I draw a text above an image in cairo
Behdad Esfahbod
behdad at behdad.org
Fri Dec 8 15:37:51 PST 2006
On Fri, 2006-12-08 at 18:16 -0500, yinglcs2 at yahoo.com wrote:
>
> cairo_surface_t *image;
> image = cairo_image_surface_create_from_png ("bullet.png");
You don't paint the image at all.
cairo_set_source_surface (cr2, image);
cairo_paint(cr2);
> int iw, ih;
> iw = cairo_image_surface_get_width (image);
> ih = cairo_image_surface_get_height (image);
>
> cairo_translate (cr2, -0.5*iw, -0.5*ih);
>
> cairo_set_source_rgb(cr2, 0.0, 0.0, 0.0);
>
>
> cairo_move_to (cr2, x, y);
> cairo_show_text (cr2, buffer);
>
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list