summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Wey2011-05-29 19:50:32 +0200
committerMike Wey2011-05-29 19:50:32 +0200
commit883ec13276c78b8e2b055a219e45bf348b4c397c (patch)
tree516b059995f5f624afdea7293a6e3d710e1a109f
parentd5ef6d8e93cf90bc47af6dbf8a569446404d7193 (diff)
Initialize ImageMagick on Windows
-rw-r--r--dmagick/Image.d29
1 files changed, 27 insertions, 2 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d
index d9d1eed..52f6a46 100644
--- a/dmagick/Image.d
+++ b/dmagick/Image.d
@@ -10,6 +10,7 @@ import std.conv;
import std.math;
import std.string;
import core.memory;
+import core.runtime;
import core.stdc.string;
import core.sys.posix.sys.types;
@@ -312,8 +313,8 @@ class Image
*--------------------
* Params:
* text = The text.
- * boundingArea
- * = The location/bounding area for the text,
+ * boundingArea =
+ * The location/bounding area for the text,
* if the height and width are 0 the height and
* with of the image are used to calculate
* the bounding area.
@@ -1627,3 +1628,27 @@ class Image
//Other unimplemented porperties
//pixelColor
}
+
+
+/*
+ * Initialize ImageMagick, only needed on Windows.
+ */
+version (Windows)
+{
+ private bool isInitialized = false;
+
+ static this
+ {
+ if ( !isInitialized )
+ {
+ MagickCoreGenesis(toStringz(Runtime.args[0]) , false);
+ isInitialized = true;
+ }
+ }
+
+ static ~this
+ {
+ if ( isInitialized )
+ MagickCoreTerminus();
+ }
+}