[cairo] How can I draw a text above an image in cairo

yinglcs2 at yahoo.com yinglcs2 at yahoo.com
Fri Dec 8 15:16:50 PST 2006


Hi,

I am trying to draw an image and then a text above the image.
I have read the example, and below is my code. When I test the code, 
I only see the text but not the image. Can you please tell me what am I missing?

Thank you.


cairo_set_source_rgb(cr2, 1.0, 0.0, 0.0);
cairo_rectangle(cr2, x-2, y2+(extents.height)/2 -2, extents.width +4, extents.height +4);
cairo_fill(cr2);
        
cairo_surface_t *image;
image = cairo_image_surface_create_from_png ("bullet.png");

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);




 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com


More information about the cairo mailing list