From 883ec13276c78b8e2b055a219e45bf348b4c397c Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Sun, 29 May 2011 19:50:32 +0200 Subject: Initialize ImageMagick on Windows --- dmagick/Image.d | 29 +++++++++++++++++++++++++++-- 1 file 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(); + } +} -- cgit v1.2.3