On 06/14/2011 10:30 PM, James Tappin wrote:
> I would like to be able to make a code that draws some (possibly very
> complex) vector graphics, copies it to an off-screen backing store and
> then when an expose-event (Gtk2) or draw signal (Gtk3) is received,
> the backing store is copied to the screen rather than doing a complete
> redraw of all the vectors which could potentially take several
> seconds. Unfortunately all the potential model codes I've been able to
> find use the obsolete Gdk Pixmap as backing store.

You may draw to a cairo image surface (instead of a GDK pixmap) then
draw that image to a cairo surface (instead of a GTK drawing area.)

surface = cairo_image_surface_create();
(vector graphics drawing)

cr = gdk_cairo_create(GDK_DRAWABLE(drawing_area->window));
cairo_set_source_surface(cr, surface, dest_x - src_x, dest_y - src_y);
cairo_rectangle(cr, dest_x, dest_y, drawing_area_width,
drawing_area_height);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_fill(cr);
cairo_destroy(cr);

-- 
Emmanuel Thomas-Maurin <manutm...@gmail.com>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to