Imager-Screenshot
view release on metacpan or search on metacpan
Screenshot.pm view on Meta::CPAN
# test for x11 support
if (Imager::Screenshot->have_x11) { ... }
# test for Darwin (Mac OS X) support
if (Imager::Screenshot->have_darwin) { ... }
=head1 DESCRIPTION
Imager::Screenshot captures either a desktop or a specified window and
returns the result as an Imager image.
Currently the image is always returned as a 24-bit image.
=over
=item screenshot hwnd => I<window handle>
=item screenshot hwnd => I<window handle>, decor => <capture decorations>
=item screenshot hwnd => "active"
Retrieve a screenshot under Win32, if I<window handle> is zero,
capture the desktop.
By default, window decorations are not captured, if the C<decor>
parameter is set to true then window decorations are included.
As of 0.010 hwnd can also be C<"active"> to capture the active (or
"foreground") window.
=item screenshot hwnd => 0
Retrieve a screeshot of the default desktop under Win32.
=item screenshot hwnd => 0, monitor => -1
Retrieve a screenshot of all attached monitors under Win32.
Note: this returns an image with an alpha channel, since there can be
regions in the bounding rectangle of all monitors that no particular
monitor covers.
=item screenshot hwnd => 0, monitor => I<index>
t/10win32.t view on Meta::CPAN
# make sure tags set as expected
is($im->tags(name => 'ss_left'), 70, "check left value");
is($im->tags(name => 'ss_top'), 30, "check top value");
is($im->tags(name => 'ss_type'), 'Win32', "check ss_type");
is($im->tags(name => 'ss_window_width'), 70 + $im->getwidth + 35,
"check image width against window size");
is($im->tags(name => 'ss_window_height'), 30 + $im->getheight + 17,
"check image height against window size");
}
{ # full multi-monitor desktop
my $im = screenshot(hwnd => 0, monitor => -1);
ok($im, "full desktop");
is($im->getchannels, 4, "should have an alpha channel");
}
( run in 0.420 second using v1.01-cache-2.11-cpan-299005ec8e3 )