GdkDrawable from GtkDrawingArea and it's cairo surface

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

 



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);
cairo_surface_write_to_png(screenshot,"screenshot.png");

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.

Thanks,
Carlos
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux