summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Wey2011-09-27 23:12:14 +0200
committerMike Wey2011-09-27 23:12:14 +0200
commit5b10e9e443977ed3afcb169981a30d78327851b9 (patch)
tree6ee5e59c971a5bba8408a742a43354086d5491bf
parent87157b5c821e05da274abefc48953492140479f8 (diff)
Image.separate is very similat to Image.channel.
Make sure dmaqgick.Array compiles.
-rw-r--r--dmagick/Array.d1
-rw-r--r--dmagick/Image.d53
2 files changed, 25 insertions, 29 deletions
diff --git a/dmagick/Array.d b/dmagick/Array.d
index 6dacdc5..ae42990 100644
--- a/dmagick/Array.d
+++ b/dmagick/Array.d
@@ -28,6 +28,7 @@ import dmagick.c.image : MagickCoreImage = Image;
import dmagick.c.layer;
import dmagick.c.magickType;
import dmagick.c.memory;
+import dmagick.c.montage;
import dmagick.c.statistic;
import dmagick.c.quantize;
diff --git a/dmagick/Image.d b/dmagick/Image.d
index f2012f3..8f33642 100644
--- a/dmagick/Image.d
+++ b/dmagick/Image.d
@@ -1790,7 +1790,6 @@ class Image
* longer than you want to wait, and will not have
* significantly better results than much smaller values.
*/
- //TODO: replace this with a statistic function?
void medianFilter(size_t radius = 0)
{
static if ( is(typeof(StatisticImage)) )
@@ -2072,7 +2071,6 @@ class Image
* with: normalizedMeanError, normalizedMaxError
* and meanErrorPerPixel.
*/
- //TODO: should quantizeInfo be part of options?
void quantize(bool measureError = false)
{
options.quantizeInfo.measure_error = measureError;
@@ -2456,31 +2454,6 @@ class Image
}
/**
- * Constructs a grayscale image for each channel specified.
- */
- Image[] separate(ChannelType channel = ChannelType.DefaultChannels)
- {
- Image[] images;
-
- if ( channel & ChannelType.RedChannel != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.RedChannel) );
- else if ( channel & ChannelType.GreenChannel != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.GreenChannel) );
- else if ( channel & ChannelType.BlueChannel != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.BlueChannel) );
- else if ( channel & ChannelType.OpacityChannel != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.OpacityChannel) );
- else if ( channel & ChannelType.TrueAlphaChannel != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.TrueAlphaChannel) );
- else if ( channel & ChannelType.GrayChannels != 0 )
- images ~= new Image( SeparateImageChannel(imageRef, ChannelType.GrayChannels) );
-
- DMagickException.throwException(&(imageRef.exception));
-
- return images;
- }
-
- /**
* applies a special effect to the image, similar to the effect achieved
* in a photo darkroom by sepia toning. A threshold of 80% is a good
* starting point for a reasonable tone.
@@ -2706,6 +2679,30 @@ class Image
}
/**
+ * Makes each pixel the min / max / median / mode / etc. of the
+ * neighborhood of the specified width and height.
+ *
+ * Params:
+ * type = The type pf statistic to apply.
+ * width = The width of the pixel neighborhood.
+ * height = The height of the pixel neighborhood.
+ */
+ void statistic(StatisticType type, size_t width, size_t height)
+ {
+ static if ( is(typeof(StatisticImage)) )
+ {
+ MagickCoreImage* image =
+ StatisticImage(imageRef, type, width, height, DMagickExceptionInfo());
+
+ imageRef = ImageRef(image);
+ }
+ else
+ {
+ static assert(0, "dmagick.Image.Image.statistic requires MagickCore version >= 6.6.9");
+ }
+ }
+
+ /**
* Hides a digital watermark in the receiver. You can retrieve the
* watermark by reading the file with the stegano: prefix, thereby
* proving the authenticity of the file.
@@ -4064,8 +4061,6 @@ class Image
return Geometry(imageRef.columns, imageRef.rows);
}
- //TODO: Statistics ?
-
/**
* Number of colors in the image.
*/