+0.009_002
+
+- multiple monitor support for Win32
+
0.009_001 11 Cot 2010
- add Darwin (Apple Mac OS X) support
scdarwin.c Darwin implementation
scwin32.c Win32 implementation
scx11.c X11 implementation
+svwin32.c Win32 translate SV to HWND
+svwin32.h Win32 translate SV to HWND (header)
+typemap Type conversion
t/00load.t Test - can we load the modules
t/10win32.t Test - win32 implementation
t/20x11.t Test - X11 implementation
|| check_lib(header => "windows.h",
lib => "gdi32",
title => "Win32")) {
- push @objs, 'scwin32.o';
+ push @objs, 'scwin32.o', 'svwin32.o';
push @cflags, '-DSS_WIN32';
if ($^O eq 'cygwin') {
push @lflags, '-L/usr/lib/w32api', '-lgdi32';
=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, display => -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, display => I<index>
+
+Retrieve a screenshot from a particular monitor under Win32. A
+I<display> of zero is always treated as the primary monitor.
+
=item screenshot id => I<window id>
=item screenshot id => I<window id>, display => I<display object>
#include "imext.h"
#include "imperl.h"
#include "imss.h"
+#ifdef SS_WIN32
+#include "svwin32.h"
+#endif
DEFINE_IMAGER_CALLBACKS;
Imager::ImgRaw
imss_win32(hwnd, include_decor = 0, left = 0, top = 0, right = 0, bottom = 0, display = 0)
- unsigned hwnd
+ SSHWND hwnd
int include_decor
int left
int top
--- /dev/null
+#include "svwin32.h"
+
+SSHWND
+hwnd_from_sv(pTHX_ SV *sv) {
+ SvGETMAGIC(sv);
+
+ if (SvPOK(sv)) {
+ STRLEN len;
+ char const *p = SvPV_nomg(sv, len);
+
+ if (len == 6 && strEQ(p, "active")) {
+ return (SSHWND)GetForegroundWindow();
+ }
+ else {
+ return (SSHWND)NULL;
+ }
+ }
+
+ return SvUV_nomg(sv);
+}
--- /dev/null
+#ifndef SVWIN32_H
+#define SVWIN32_H
+
+#include "EXTERN.h"
+#include <windows.h>
+#include "perl.h"
+
+typedef unsigned SSHWND;
+
+SSHWND
+hwnd_from_sv(pTHX_ SV *sv);
+
+#endif
--- /dev/null
+SSHWND T_HWND
+
+INPUT
+T_HWND
+ $var = hwnd_from_sv(aTHX_ $arg);