summaryrefslogtreecommitdiff
path: root/dmagick
diff options
context:
space:
mode:
authorMike Wey2011-02-12 23:34:39 +0100
committerMike Wey2011-02-12 23:34:39 +0100
commitff26b979509498cc5ebd2ab003b6f3e530fdc4c9 (patch)
tree479bc9d94aceeded2fdb0287928f8c8b22133b94 /dmagick
parent2fb8dd6619325608157819478edfe4b3b2a1dc0d (diff)
Update some of the documentation
Diffstat (limited to 'dmagick')
-rw-r--r--dmagick/Color.d25
-rw-r--r--dmagick/Exception.d2
-rw-r--r--dmagick/Utils.d7
3 files changed, 31 insertions, 3 deletions
diff --git a/dmagick/Color.d b/dmagick/Color.d
index 144b828..e7fa690 100644
--- a/dmagick/Color.d
+++ b/dmagick/Color.d
@@ -1,6 +1,4 @@
/**
- * A container for the pixel values: red, green, blue and opacity.
- *
* Copyright: Mike Wey 2011
* License: To be determined
* Authors: Mike Wey
@@ -18,10 +16,14 @@ import dmagick.c.exception;
import dmagick.c.pixel;
import dmagick.c.magickType;
+/**
+ * A container for the pixel values: red, green, blue and opacity.
+ */
class Color
{
PixelPacket* pixelPacket;
+ /** */
this()
{
pixelPacket = new PixelPacket;
@@ -29,11 +31,17 @@ class Color
pixelPacket.opacity = TransparentOpacity;
}
+ /**
+ * Create a Color from the specified Quantums.
+ */
this(Quantum red, Quantum green, Quantum blue)
{
this(red, green, blue, 0);
}
+ /**
+ * ditto
+ */
this(Quantum red, Quantum green, Quantum blue, Quantum opacity)
{
this();
@@ -44,6 +52,9 @@ class Color
pixelPacket.opacity = opacity;
}
+ /**
+ * Create a Color from a X11 color specification string
+ */
this(string color)
{
this();
@@ -57,6 +68,9 @@ class Color
DestroyExceptionInfo(exception);
}
+ /**
+ * Create a Color from this PixelPacket.
+ */
this(PixelPacket packet)
{
this();
@@ -67,6 +81,10 @@ class Color
pixelPacket.opacity = packet.opacity;
}
+ /**
+ * Create a Color and set the internal pointer to this PixelPacket.
+ * We can use this to change pixels in an image through Color.
+ */
this(PixelPacket* packet)
{
pixelPacket = packet;
@@ -84,6 +102,9 @@ class Color
return "none";
}
+ /**
+ * Create a copy of this Color.
+ */
Color clone()
{
return new Color(*pixelPacket);
diff --git a/dmagick/Exception.d b/dmagick/Exception.d
index 8d5e4cc..7670890 100644
--- a/dmagick/Exception.d
+++ b/dmagick/Exception.d
@@ -1,5 +1,5 @@
/**
- * A class to expose ImageInfo QuantizeInfo and DrawInfo
+ * Classes that wrap the Imagemagick exception handling.
*
* Copyright: Mike Wey 2011
* License: To be determined
diff --git a/dmagick/Utils.d b/dmagick/Utils.d
index d5e8ff6..b7ebd33 100644
--- a/dmagick/Utils.d
+++ b/dmagick/Utils.d
@@ -62,11 +62,18 @@ void copyString(ref char* dest, string source)
dest[source.length] = '\0';
}
+/** */
real degreesToRadians(real deg)
{
return deg*PI/180;
}
+
+/**
+ * A template struct ot make pointers to ImageMagick structs
+ * reference counted. Excepts a predicate pred which destroys
+ * the struct pointer when refCount is 0.
+ */
struct RefCounted(alias pred, T)
if ( !is(T == class) && is(typeof(pred(cast(T*)null)) == T*) )
{