From a2cc5f1844b0e71a7ea68b0d2d4207897ae471df Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Sun, 27 Mar 2011 23:29:00 +0200 Subject: Some more image properties --- dmagick/Options.d | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'dmagick/Options.d') diff --git a/dmagick/Options.d b/dmagick/Options.d index cc41950..1745b64 100644 --- a/dmagick/Options.d +++ b/dmagick/Options.d @@ -10,6 +10,7 @@ module dmagick.Options; import std.conv; import std.math; +import std.string; import core.stdc.stdio; import core.stdc.string; @@ -27,6 +28,7 @@ import dmagick.c.image; import dmagick.c.list; import dmagick.c.magickType; import dmagick.c.memory; +import dmagick.c.option; import dmagick.c.quantize; import dmagick.c.quantum; @@ -138,7 +140,7 @@ class Options } /** - * Set the image border color. The default is "#dfdfdf". + * Specifies the image pixel interpretation. */ void colorspace(ColorspaceType space) { @@ -177,6 +179,42 @@ class Options // //} + /** + * Define an option. Use this method to set options for + * reading or writing certain image formats. The list of + * supported options changes from release to release. + * For a list of the valid image formats, keys, and values, + * refer to the documentation for the -define option for the + * release of ImageMagick installed on your system. + * Params: + * format = An image format name such as "ps" or "tiff". + * key = A string that identifies the option. + * vaule = The value of the option. + */ + void define(string format, string key, string value = "") + { + string option = format ~":"~ key ~ "\0"; + + SetImageOption(imageInfo, option.ptr, toStringz(value)); + } + + //TODO: opindex / opiindexassign for the options. + + /** + * Delete an option definition set by define. + * This is not the same as setting the option to a null value. + * The undefine method removes the option name from the list + * of options for the specified format. + * format = An image format name such as "ps" or "tiff". + * key = A string that identifies the option. + */ + void undefine(string format, string key) + { + string option = format ~":"~ key ~ "\0"; + + DeleteImageOption(imageInfo, option.ptr); + } + /** * Specifies the vertical and horizontal resolution in pixels. * The default _density is "72.0x72.0". This attribute can be used -- cgit v1.2.3