"Snapshotting" of a ruby-gnome application

Using Gtk::Image and Gtk::Pixbuf, and a widget where you can move
the images around, it is possible to draw … uh, images.
A little bit like Gimp with fixed objects.

But, aside from making a Snapshot with something like ksnapshot,
does anyone know of a way to get the current "assembled Images "
from a widget (any widget at all)?

Specifically, I would like to make a “dumb” Image “drawing”
application, and would like to be able to store the final
image result somewhere. (Think of some flash
applications that do that)

Hi,

2006/11/16, Marc H. [email protected]:

Specifically, I would like to make a “dumb” Image “drawing”
application, and would like to be able to store the final
image result somewhere. (Think of some flash
applications that do that)

You can do with Gdk::Drawable and Gdk::Pixbuf.
The following example snapshots your desktop.

require ‘gtk2’
drawable = Gdk::Window.default_root_window
pixbuf = Gdk::Pixbuf.from_drawable(drawable.colormap, drawable, 0, 0,
*drawable.size)
pixbuf.save(“x.png”, “png”)

Thanks,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs