summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmagick/Image.d41
1 files changed, 39 insertions, 2 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d
index b668184..a556fa0 100644
--- a/dmagick/Image.d
+++ b/dmagick/Image.d
@@ -1178,9 +1178,46 @@ class Image
*/
void display()
{
- DisplayImages(options.imageInfo, imageRef);
+ version(Windows)
+ {
+ WNDCLASS wndclass;
+ HINSTANCE hInstance = cast(HINSTANCE) GetModuleHandle(null);
+ HWND hwnd;
+ MSG msg;
+
+ wndclass.style = CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = &WndProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInstance;
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wndclass.hbrBackground = null;
+ wndclass.lpszMenuName = "DMagick"w;
+ wndclass.lpszClassName = "DMagick"w;
+
+ if (!RegisterClass(&wndclass))
+ throw new DMagickException("This program requires Windows NT!");
+
+ hwnd = CreateWindow(cn, toStringz(title), WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ null, null, hInstance, null);
+
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+ UpdateWindow(hwnd);
+
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ else
+ {
+ DisplayImages(options.imageInfo, imageRef);
- DMagickException.throwException(&(imageRef.exception));
+ DMagickException.throwException(&(imageRef.exception));
+ }
}
/**