Uwe Voelker wrote:

> Hello,
>
> how do I make a screen shot from a Gtk2 window? It's Gtk2::MozEmbed if
> that matters.
>
> I want to make it within the application, no external tools.
>

I haven't tested this code in a while but it should still work (or at
least get you closer)

This assumes $width and $height are the dimensions of the image you want
to save.

# create blank pixbuf to hold the image
my $gdkpixbuf = Gtk2::Gdk::Pixbuf->new ('rgb',
        0,
        8,
        $width,
        $height);

$gdkpixbuf->get_from_drawable
    ($embed->window, undef, 0, 0, 0, 0, $width, $height);

$gdkpixbuf->save ($file, "jpeg");


Hope this helps,

-- 
Adam M. Israel
[EMAIL PROTECTED]

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to