summaryrefslogtreecommitdiff
path: root/dmagick
diff options
context:
space:
mode:
Diffstat (limited to 'dmagick')
-rw-r--r--dmagick/Color.d12
-rw-r--r--dmagick/ImageView.d16
2 files changed, 20 insertions, 8 deletions
diff --git a/dmagick/Color.d b/dmagick/Color.d
index 7223d81..2ddaa64 100644
--- a/dmagick/Color.d
+++ b/dmagick/Color.d
@@ -130,6 +130,18 @@ class Color
}
/**
+ * Support casting between different colors.
+ * You can also use std.conv.to
+ */
+ T opCast(T : Color)()
+ {
+ T color = new T();
+ color.packet = packet;
+
+ return color;
+ }
+
+ /**
* The value for red in the range [0 .. QuantumRange]
*/
void redQuantum(Quantum red)
diff --git a/dmagick/ImageView.d b/dmagick/ImageView.d
index 4e967be..f23f23a 100644
--- a/dmagick/ImageView.d
+++ b/dmagick/ImageView.d
@@ -316,14 +316,6 @@ struct Pixels
return new Color(pixels.ptr + pixel);
}
- /**
- * Sync the pixels back to the image. The destructor does this for you.
- */
- void sync()
- {
- SyncAuthenticPixelCacheNexus(image.imageRef, &nexus, DMagickExceptionInfo());
- }
-
///ditto
void opIndexAssign(Color color, size_t index)
{
@@ -358,6 +350,14 @@ struct Pixels
}
/**
+ * Sync the pixels back to the image. The destructor does this for you.
+ */
+ void sync()
+ {
+ SyncAuthenticPixelCacheNexus(image.imageRef, &nexus, DMagickExceptionInfo());
+ }
+
+ /**
* Support using foreach on a row.
*/
int opApply(T : Color)(int delegate(ref T) dg)