1 module dmagick.c.resample; 2 3 import dmagick.c.cacheView; 4 import dmagick.c.exception; 5 import dmagick.c.image; 6 import dmagick.c.magickType; 7 import dmagick.c.magickVersion; 8 import dmagick.c.pixel; 9 10 //A mixin with static if has problems with circular imports. (dmagick.c.image) 11 version(MagickCore_660) {} else 12 version(MagickCore_661) {} else 13 version(MagickCore_662) {} else 14 version(MagickCore_663) {} else 15 version(MagickCore_664) {} else 16 version(MagickCore_665) {} else 17 { 18 version = MagickCore_666_and_up; 19 } 20 21 extern(C) 22 { 23 version ( MagickCore_666_and_up ) 24 { 25 /** 26 * Used to adjust the filter algorithm used when resizing images. 27 * Different filters experience varying degrees of success with 28 * various images and can take significantly different amounts of 29 * processing time. ImageMagick uses the LanczosFilter by default 30 * since this filter has been shown to provide the best results for 31 * most images in a reasonable amount of time. Other filter types 32 * (e.g. TriangleFilter) may execute much faster but may show 33 * artifacts when the image is re-sized or around diagonal lines. 34 * The only way to be sure is to test the filter with sample images. 35 * 36 * See_Also: $(LINK2 http://www.imagemagick.org/Usage/resize/, 37 * Resize Filters) in the Examples of ImageMagick Usage. 38 */ 39 enum FilterTypes 40 { 41 UndefinedFilter, /// 42 PointFilter, /// ditto 43 BoxFilter, /// ditto 44 TriangleFilter, /// ditto 45 HermiteFilter, /// ditto 46 HanningFilter, /// ditto 47 HammingFilter, /// ditto 48 BlackmanFilter, /// ditto 49 GaussianFilter, /// ditto 50 QuadraticFilter, /// ditto 51 CubicFilter, /// ditto 52 CatromFilter, /// ditto 53 MitchellFilter, /// ditto 54 JincFilter, /// ditto 55 SincFilter, /// ditto 56 SincFastFilter, /// ditto 57 KaiserFilter, /// ditto 58 WelshFilter, /// ditto 59 ParzenFilter, /// ditto 60 BohmanFilter, /// ditto 61 BartlettFilter, /// ditto 62 LagrangeFilter, /// ditto 63 LanczosFilter, /// ditto 64 LanczosSharpFilter, /// ditto 65 Lanczos2Filter, /// ditto 66 Lanczos2SharpFilter, /// ditto 67 RobidouxFilter, /// ditto 68 RobidouxSharpFilter, /// ditto 69 CosineFilter, /// ditto 70 SplineFilter, /// ditto 71 LanczosRadiusFilter, /// ditto 72 SentinelFilter, // a count of all the filters, not a real filter 73 74 BesselFilter = JincFilter, 75 Lanczos2DFilter = Lanczos2Filter, 76 Lanczos2DSharpFilter = Lanczos2SharpFilter 77 } 78 } 79 else 80 { 81 enum FilterTypes 82 { 83 UndefinedFilter, 84 PointFilter, 85 BoxFilter, 86 TriangleFilter, 87 HermiteFilter, 88 HanningFilter, 89 HammingFilter, 90 BlackmanFilter, 91 GaussianFilter, 92 QuadraticFilter, 93 CubicFilter, 94 CatromFilter, 95 MitchellFilter, 96 LanczosFilter, 97 JincFilter, 98 SincFilter, 99 KaiserFilter, 100 WelshFilter, 101 ParzenFilter, 102 LagrangeFilter, 103 BohmanFilter, 104 BartlettFilter, 105 SincFastFilter, 106 Lanczos2DFilter, 107 Lanczos2DSharpFilter, 108 RobidouxFilter, 109 RobidouxSharpFilter, 110 CosineFilter, 111 SentinelFilter, /* a count of all the filters, not a real filter */ 112 113 BesselFilter = JincFilter 114 } 115 } 116 117 struct ResampleFilter {} 118 119 MagickBooleanType ResamplePixelColor(ResampleFilter*, const double, const double, MagickPixelPacket*); 120 MagickBooleanType SetResampleFilterInterpolateMethod(ResampleFilter*, const InterpolatePixelMethod); 121 MagickBooleanType SetResampleFilterVirtualPixelMethod(ResampleFilter*, const VirtualPixelMethod); 122 123 ResampleFilter* AcquireResampleFilter(const(Image)*, ExceptionInfo*); 124 ResampleFilter* DestroyResampleFilter(ResampleFilter*); 125 126 void ScaleResampleFilter(ResampleFilter*, const double, const double, const double, const double); 127 void SetResampleFilter(ResampleFilter*, const FilterTypes, const double); 128 }