[cairo] cairo_write_func_t

Pablo Romero romero619 at hotmail.com
Thu Feb 12 09:10:15 PST 2009


hello,
I need help setting up a write function for cairo_image_surface_write_to_png_stream()
 
I've set up the following function to print to stdout...
 
 
cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data,unsigned int lngth){
  unsigned int i;
  printf("png length: %u\n",lngth);

  for(i=0;i
#include 

cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data, unsigned int lngth);
 
int main (int argc, char *argv[])
{
        cairo_surface_t *surface;
        cairo_t *cr;
 
        surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 200, 200);
        cr = cairo_create (surface);
 
        cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
        cairo_set_font_size (cr, 32.0);
        cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
        cairo_paint(cr);

        cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
        cairo_move_to (cr, 10.0, 50.0);
        cairo_show_text (cr, "Hello, world");
  
        cairo_surface_write_to_png_stream (surface,my_stdout_write_fn, NULL);
        cairo_surface_write_to_png(surface,"hello.png");
        return 0;
}
 
 
cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data,unsigned int lngth){
  unsigned int i;
  printf("png length: %u\n",lngth);

  for(i=0;i
_________________________________________________________________
Windows Live™: E-mail. Chat. Share. Get more ways to connect. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009


More information about the cairo mailing list