From 9926bd87c9419d12bf97bab4075ce6aaf48a00a8 Mon Sep 17 00:00:00 2001 From: Mike Wey Date: Sun, 10 Apr 2011 23:27:55 +0200 Subject: A few more image Properties --- dmagick/Image.d | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'dmagick') diff --git a/dmagick/Image.d b/dmagick/Image.d index 4653ae5..b4b6e00 100644 --- a/dmagick/Image.d +++ b/dmagick/Image.d @@ -875,6 +875,67 @@ class Image return options.magick; } + void matte(bool flag) + { + // If the image has a matte channel, and it's + // not desired set the matte channel to fully opaque. + if ( !flag && imageRef.matte ) + SetImageOpacity(imageRef, OpaqueOpacity); + + imageRef.matte = flag; + } + bool matte() const + { + return imageRef.matte; + } + + /** + * Set the image transparent color. The default is "#bdbdbd". + */ + void matteColor(string color) + { + matteColor = new Color(color); + } + ///ditto + void matteColor(Color color) + { + imageRef.matte_color = color.pixelPacket; + options.matteColor = color.pixelPacket; + } + ///ditto + Color matteColor() const + { + return new Color(imageRef.matte_color); + } + + double meanErrorPerPixel() const + { + return imageRef.error.mean_error_per_pixel; + } + + void modulusDepth(size_t depth) + { + SetImageDepth(imageRef, depth); + options.depth = depth; + } + size_t modulusDepth() const + { + ExceptionInfo* exception = AcquireExceptionInfo(); + size_t depth = GetImageDepth(imageRef, exception); + + DMagickException.throwException(exception); + DestroyExceptionInfo(exception); + + return depth; + } + + Geometry montageGeometry() const + { + return Geometry( to!(string)(imageRef.geometry) ); + } + + + size_t rows() const { return imageRef.rows; -- cgit v1.2.3