Re: goocanvas vs crcanvas,which better?



The following does it:

  int img_width = gdk_pixbuf_get_width(pixbuf);
  int img_height = gdk_pixbuf_get_height(pixbuf);
  cairo_surface_t *surface
    = cairo_image_surface_create_for_data(gdk_pixbuf_get_pixels(pixbuf),
                                          CAIRO_FORMAT_ARGB32,
                                          img_width,
                                          img_height,
                                          gdk_pixbuf_get_rowstride(pixbuf));


You will have to swap R and B in calls to:

  cairo_set_source_rgba (cr, 0,0,1.0,0.5);


when drawing though, as cairo and gdk_pixbuf have different ideas about
their order.

(These examples are copied from the GtkImageViewer tutorial.)

Regards,
Dov

2009/3/26 Alexander <b3nder yandex ru>

Hi, Dov.

On Thursday 26 March 2009, Dov Grobgeld wrote:

   - If the annotation is static, it certainly faster to prepare a
   transparent pixbuf and draw the annotation on the pixbuf and then
simply
   merge the data from the frame grabber with the overlay mostly
transparent
   pixbuf, and then ship the result of to display.

Is there standard facility for creating cairo context for pixbuf? Like
gdk_cairo_create() for drawables.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]