summaryrefslogtreecommitdiff
path: root/dmagick/c/morphology.d
diff options
context:
space:
mode:
Diffstat (limited to 'dmagick/c/morphology.d')
-rw-r--r--dmagick/c/morphology.d209
1 files changed, 131 insertions, 78 deletions
diff --git a/dmagick/c/morphology.d b/dmagick/c/morphology.d
index 696fa7a..5b5c814 100644
--- a/dmagick/c/morphology.d
+++ b/dmagick/c/morphology.d
@@ -14,44 +14,69 @@ extern(C)
{
string info = "enum KernelInfoType
{
- UndefinedKernel, /* equivelent to UnityKernel */
- UnityKernel, /* The no-op or 'original image' kernel */
- GaussianKernel, /* Convolution Kernels, Gaussian Based */
- DoGKernel,
- LoGKernel,
- BlurKernel,";
+ UndefinedKernel, /* equivelent to UnityKernel */";
- static if ( MagickLibVersion < 0x663 )
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "UnityKernel, /* The no-op or 'original image' kernel */";
+ }
+
+ info ~= "GaussianKernel, /* Convolution Kernels, Gaussian Based */";
+
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "DoGKernel,
+ LoGKernel,";
+ }
+
+ info ~= "BlurKernel,";
+
+ static if ( MagickLibVersion == 0x662 )
{
info ~= "DOBKernel,";
}
- info ~= "
- CometKernel,
- LaplacianKernel, /* Convolution Kernels, by Name */
- SobelKernel,
- FreiChenKernel,
- RobertsKernel,
- PrewittKernel,
- CompassKernel,
- KirschKernel,
- DiamondKernel, /* Shape Kernels */
- SquareKernel,
- RectangleKernel,";
+ info ~= "CometKernel,
+ LaplacianKernel, /* Convolution Kernels, by Name */";
+
+ static if ( MagickLibVersion < 0x662 )
+ {
+ info ~= "DoGKernel,
+ LoGKernel,
+ RectangleKernel /* Shape Kernels */,
+ SquareKernel,
+ DiamondKernel,";
+ }
+
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "SobelKernel,
+ FreiChenKernel,
+ RobertsKernel,
+ PrewittKernel,
+ CompassKernel,
+ KirschKernel,
+ DiamondKernel, /* Shape Kernels */
+ SquareKernel,
+ RectangleKernel,";
+ }
static if ( MagickLibVersion >= 0x670 )
{
info ~= "OctagonKernel,";
}
- info ~= "
- DiskKernel,
- PlusKernel,
- CrossKernel,
- RingKernel,
- PeaksKernel, /* Hit And Miss Kernels */
- EdgesKernel,
- CornersKernel,";
+ info ~= "DiskKernel,
+ PlusKernel,";
+
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "CrossKernel,
+ RingKernel,
+ PeaksKernel, /* Hit And Miss Kernels */
+ EdgesKernel,
+ CornersKernel,";
+ }
static if ( MagickLibVersion < 0x663 )
{
@@ -62,64 +87,79 @@ extern(C)
info ~= "ThinDiagonalsKernel,";
}
- info ~= "
- LineEndsKernel,
- LineJunctionsKernel,";
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "LineEndsKernel,
+ LineJunctionsKernel,";
+ }
static if ( MagickLibVersion >= 0x663 )
{
info ~= "RidgesKernel,";
}
- info ~= "
- ConvexHullKernel,
- SkeletonKernel,
- ChebyshevKernel, /* Distance Measuring Kernels */
- ManhattanKernel,
- EuclideanKernel,
- UserDefinedKernel /* User Specified Kernel Array */
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ info ~= "ConvexHullKernel,
+ SkeletonKernel,";
+ }
+
+ info ~= "ChebyshevKernel, /* Distance Measuring Kernels */
+ ManhattanKernel,
+ EuclideanKernel,
+ UserDefinedKernel /* User Specified Kernel Array */
}";
return info;
}());
- enum MorphologyMethod
+ mixin(
{
- UndefinedMorphology,
-
- /* Convolve / Correlate weighted sums */
- ConvolveMorphology, /* Weighted Sum with reflected kernel */
- CorrelateMorphology, /* Weighted Sum using a sliding window */
-
- /* Low-level Morphology methods */
- ErodeMorphology, /* Minimum Value in Neighbourhood */
- DilateMorphology, /* Maximum Value in Neighbourhood */
- ErodeIntensityMorphology, /* Pixel Pick using GreyScale Erode */
- DilateIntensityMorphology, /* Pixel Pick using GreyScale Dialate */
- DistanceMorphology, /* Add Kernel Value, take Minimum */
-
- /* Second-level Morphology methods */
- OpenMorphology, /* Dilate then Erode */
- CloseMorphology, /* Erode then Dilate */
- OpenIntensityMorphology, /* Pixel Pick using GreyScale Open */
- CloseIntensityMorphology, /* Pixel Pick using GreyScale Close */
- SmoothMorphology, /* Open then Close */
-
- /* Difference Morphology methods */
- EdgeInMorphology, /* Dilate difference from Original */
- EdgeOutMorphology, /* Erode difference from Original */
- EdgeMorphology, /* Dilate difference with Erode */
- TopHatMorphology, /* Close difference from Original */
- BottomHatMorphology, /* Open difference from Original */
-
- /* Recursive Morphology methods */
- HitAndMissMorphology, /* Foreground/Background pattern matching */
- ThinningMorphology, /* Remove matching pixels from image */
- ThickenMorphology, /* Add matching pixels from image */
-
- /* Experimental Morphology methods */
- VoronoiMorphology
- }
+ string method = "enum MorphologyMethod
+ {
+ UndefinedMorphology,
+
+ /* Convolve / Correlate weighted sums */
+ ConvolveMorphology, /* Weighted Sum with reflected kernel */
+ CorrelateMorphology, /* Weighted Sum using a sliding window */
+
+ /* Low-level Morphology methods */
+ ErodeMorphology, /* Minimum Value in Neighbourhood */
+ DilateMorphology, /* Maximum Value in Neighbourhood */
+ ErodeIntensityMorphology, /* Pixel Pick using GreyScale Erode */
+ DilateIntensityMorphology, /* Pixel Pick using GreyScale Dialate */
+ DistanceMorphology, /* Add Kernel Value, take Minimum */
+
+ /* Second-level Morphology methods */
+ OpenMorphology, /* Dilate then Erode */
+ CloseMorphology, /* Erode then Dilate */
+ OpenIntensityMorphology, /* Pixel Pick using GreyScale Open */
+ CloseIntensityMorphology, /* Pixel Pick using GreyScale Close */";
+
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ method ~= "SmoothMorphology, /* Open then Close */";
+ }
+
+ method ~= "
+ /* Difference Morphology methods */
+ EdgeInMorphology, /* Dilate difference from Original */
+ EdgeOutMorphology, /* Erode difference from Original */
+ EdgeMorphology, /* Dilate difference with Erode */
+ TopHatMorphology, /* Close difference from Original */
+ BottomHatMorphology, /* Open difference from Original */
+
+ /* Recursive Morphology methods */
+ HitAndMissMorphology, /* Foreground/Background pattern matching */
+ ThinningMorphology, /* Remove matching pixels from image */
+ ThickenMorphology, /* Add matching pixels from image */
+
+ /* Experimental Morphology methods */
+ VoronoiMorphology
+ }";
+
+ return method;
+ }());
struct KernelInfo
{
@@ -140,11 +180,16 @@ extern(C)
minimum,
maximum,
negative_range,
- positive_range,
- angle;
+ positive_range;
- KernelInfo*
- next;
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ double
+ angle;
+
+ KernelInfo*
+ next;
+ }
size_t
signature;
@@ -159,6 +204,14 @@ extern(C)
Image* MorphologyImage(const(Image)*, const MorphologyMethod, const ssize_t, const(KernelInfo)*, ExceptionInfo*);
Image* MorphologyImageChannel(const(Image)*, const ChannelType, const MorphologyMethod, const ssize_t, const(KernelInfo)*, ExceptionInfo*);
- void ScaleGeometryKernelInfo(KernelInfo*, const(char)*);
+ static if ( MagickLibVersion >= 0x662 )
+ {
+ void ScaleGeometryKernelInfo(KernelInfo*, const(char)*);
+ }
+ else
+ {
+ void ScaleKernelInfo(KernelInfo*, const double, const GeometryFlags);
+ }
+
void ShowKernelInfo(const(KernelInfo)*);
}