BEGIN {
require Exporter;
@ISA = qw(Exporter);
- $VERSION = '0.004';
+ $VERSION = '0.007';
eval {
# try XSLoader first, DynaLoader has annoying baggage
require XSLoader;
}
my $id_hex = $opts{widget}->id;
- $opts{widget}->can('frame')
- and $id_hex = $opts{widget}->frame;
# is there a way to get the display pointer from Tk?
$result = _x11($opts{display}, hex($id_hex), $opts{left}, $opts{top},
Note: taking a screenshot of a remote display is slow.
+=item screenshot widget => I<widget>
+
+=item screenshot widget => I<widget>, display => I<display>
+
+=item screenshot widget => I<widget>, decor => I<capture decorations>
+
+Retrieve a screenshot of a Tk widget, under Win32 or X11, depending on
+how Tk has been built.
+
+If Tk was built for X11 then the display parameter applies.
+
+If Tk was built for Win32 then the decor parameter applies.
+
=item screenshot
-If no C<id> or C<hwnd> parameter is supplied:
+If no C<id>, C<hwnd> or C<widget> parameter is supplied:
=over
# 10x10 pixel at the bottom right corner
my $bott_right_10 = screenshot(left => -10, top => -10, ...);
+If screenshot() fails, it will return nothing, and the cause of the
+failure can be retrieved via Imager->errstr, so typical use could be:
+
+ my $img = screenshot(...) or die Imager->errstr;
+
=item have_win32
Returns true if Win32 support is available.
screensaver was running. The root window captured appeared to be that
generated by my window manager.
+Grabbing a window with other windows overlaying it will capture the
+content of those windows where they hide the window you want to
+capture. You may want to raise the window to top. This may be a
+security concern if the overlapping windows contain any sensitive
+information - true for any screen capture.
+
=head1 LICENSE
Imager::Screenshot is licensed under the same terms as Perl itself.
+=head1 TODO
+
+Future plans include:
+
+=over
+
+=item *
+
+OS X support - I need to find out which APIs to use to do this. I
+found some information on the APIs used for this, but don't have a Mac
+I can test on.
+
+=item *
+
+window name searches - currently screenshot() requires a window
+identifier of some sort, it would be more usable if we could supply
+some other identifier, either a window title or a window class name.
+
+=back
+
=head1 AUTHOR
Tony Cook <tonyc@cpan.org>