thanks for the quick reply,<br>here's the code:<br><br>#include <cairo.h><br>#include <math.h><br>#include <stdio.h><br><br>int<br>main (int argc, char *argv[])<br>{<br> cairo_surface_t *surface;<br>
cairo_t *cr;<br> cairo_text_extents_t te;<br><br> /* Prepare drawing area */<br> //surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 240);<br> //cr = cairo_create (surface);<br> surface = cairo_image_surface_create_from_png("someimage.png");<br>
cr = cairo_create (surface);<br> /* Examples are in 1.0 x 1.0 coordinate space */<br> <br> cairo_set_line_width(cr, 5);<br> <br> /* Drawing code goes here */<br> cairo_set_source_rgb (cr, 0.6, 0.9, 1.0);<br>
cairo_rectangle(cr, 25, 25, 100, 100);<br> cairo_fill(cr);<br> <br> <br> cairo_set_source_rgb (cr, 0.0, 0.0, 0.0 );<br> cairo_arc(cr, 75, 75, 50, 0, 2*M_PI);<br> cairo_stroke(cr);<br> <br> cairo_move_to(cr, 50, 75);<br>
cairo_line_to(cr, 100, 75);<br> cairo_stroke(cr);<br> <br> cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);<br> cairo_move_to(cr, 70, 75);<br> cairo_line_to(cr, 80, 75);<br> cairo_stroke(cr);<br><br>------------------<br>
up till here everything works fine<br> ------------------<br><br> cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);<br> cairo_select_font_face (cr, "sansserif",<br> CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);<br>
cairo_set_font_size (cr, 22);<br> cairo_text_extents (cr, "ABC", &te);<br> cairo_show_text (cr, "ABC");<br> <br>--------------------<br>the part above isnt shown in the resulting png file<br>
--------------------<br> <br> /* Write output and clean up */<br> cairo_surface_write_to_png (surface, "showtext.png");<br> cairo_destroy (cr);<br> cairo_surface_destroy (surface);<br><br> return 0;<br>
}<br><br><br><br>