GdkDrawable from GtkDrawingArea and it's cairo surface

Hello again,

Let's say I'd like to save a GtkDrawingArea 'screenshot' to a file.
I'm able to do

cairo_t *cr = gtkDrawingAreaWidget->window;
cairo_surface_t *screenshot = cairo_get_target(cr);

but what this code does is save a screenshot for the *entire window*,
including other widgets in it (e.g. toolbar). I can't get a cairo
context for a GtkDrawingArea since it's not GdkDrawable, and it's not
possible to have child GtkWindow. I've seen
gtk_widget_set_has_window() but it didn't work, I think because it
says "This function should only be called by widget implementations".
Is there a work-around?

What I'm really trying to do: Save my drawing area surface everytime
it's modified (drawn on it), so I can later do "undos" and set the
surface source to a previous one.


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