summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Wey2011-09-20 23:27:19 +0200
committerMike Wey2011-09-20 23:27:19 +0200
commit01fcc0d01858eeec1a21e3fad33fa8e3d43a9320 (patch)
tree869c5256a8c1337ddcb2ae51d81fd7b0da5fe90c
parent6af7568675e3fce883a1d08878dfef7f4e412053 (diff)
Template the Pixels.opApply to allow using any of the Color classes in
the foreach. This does mean the type of Color you want to use in the loop needs to be specified, because it can no longer be inferred.
-rw-r--r--dmagick/ImageView.d4
1 files changed, 2 insertions, 2 deletions
diff --git a/dmagick/ImageView.d b/dmagick/ImageView.d
index 709c81f..79b39c4 100644
--- a/dmagick/ImageView.d
+++ b/dmagick/ImageView.d
@@ -360,9 +360,9 @@ struct Pixels
/**
* Support using foreach on a row.
*/
- int opApply(int delegate(ref Color) dg)
+ int opApply(T : Color)(int delegate(ref T) dg)
{
- Color color = new Color();
+ T color = new T();
foreach ( ref PixelPacket pixel; pixels )
{