[cairo] How to convert cairo content to gdk-bifbuf

Li Li lili at apache-da.com
Fri Jul 14 10:52:32 PDT 2006


My question is how to convert the cairo drawing context to gdk-pixbuf.

I tried to use following codes, but not works.

=================================================================
   data = (guchar*)malloc(4*width*height*sizeof(guchar));

   cairo_surface_t *cs= cairo_image_surface_create_for_data(data,
            CAIRO_FORMAT_RGB24, width, height, 4*width);

   cairo_t *cr=cairo_create(cs);

   cairo_rectangle (cr, 0, 0, width, height);

   cairo_clip (cr);

   snippet1(cr);  //draw something onto it

   cr_convert_to_pixbuf(data, width, height, pixbuf);//do conversion
=================================================================

Thanks



More information about the cairo mailing list