"Snapshotting" of a ruby-gnome application

M

Marc Heiler

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)
 
K

Kouhei Sutou

Hi,

2006/11/16 said:
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,362
Latest member
ChandaWagn

Latest Threads

Top