Add PreviewType enum and missing struct members.
[magickd.git] / source / magickd / core / c / image.d
blob0d90cb052836f2ff43111023e26cf4d0e7b23fa4
1 /* Copyright (C) kaerou 2021.
2 ** Distributed under the Boost Software License, Version 1.0.
3 ** (See accompanying file LICENSE_1_0.txt or copy at
4 ** https://www.boost.org/LICENSE_1_0.txt)
5 */
6 module magickd.core.c.image;
8 private
10 import core.stdc.config : c_long, c_ulong;
11 import core.stdc.stdio : FILE;
13 import magickd.core.c.common;
14 import magickd.core.c.colorspace;
15 import magickd.core.c.error;
16 import magickd.core.c.timer;
19 @nogc @system extern(C):
21 enum QuantumDepth = 16;
23 static if (QuantumDepth == 8)
25 enum MaxColormapSize = 256U;
26 enum MaxMap = 255U;
27 enum MaxMapDepth = 8;
28 enum MaxMapFloat = 255.0f;
29 enum MaxMapDouble = 255.0;
30 enum MaxRGB = 255U;
31 enum MaxRGBFloat = 255.0f;
32 enum MaxRGBDouble = 255.0;
33 /* TODO: Scale functions */
34 alias Quantum = ubyte;
36 else static if (QuantumDepth == 16)
38 enum MaxColormapSize = 65536U;
39 enum MaxMap = 65535U;
40 enum MaxMapDepth = 16;
41 enum MaxMapFloat = 65535.0f;
42 enum MaxMapDouble = 65535.0;
43 enum MaxRGB = 65535U;
44 enum MaxRGBFloat = 65535.0f;
45 enum MaxRGBDouble = 65535.0;
46 /* TODO: Scale functions */
47 alias Quantum = ushort;
49 else static if (QuenatumDepth == 32)
51 enum MaxColormapSize = 65536U;
52 enum MaxRGB = 4294967295U;
53 enum MaxRGBFloat = 4294967295.0f;
54 enum MaxRGBDouble = 4294967295.0;
55 /* MaxMap defines the maximum index value for algorithms which depend on
56 * lookup tables (e.g. colorspace transformations and normalizations).
57 * When MaxMap is less than MaxRGB it is necessary to downscale samples to
58 * fit the range of MaxMap. The number of bits which are effectively
59 * preserved depend on the size of MaxMap. MaxMap should be a multiple of
60 * 255 and no larger the MaxRGB. Note that tables can become quite large
61 * and as tables grow larger it may take more time to compute the table
62 * than to process the image. */
63 enum MaxMap = 65535U;
64 enum MaxMapDepth = 16;
65 enum MaxMapFloat = 65535.0f;
66 enum MaxMapDouble = 65535.0;
68 static if (MaxMap == 65535U)
70 /* TODO: Scale functions */
72 else
74 /* TODO: Scale functions */
76 alias Quantum = uint;
78 else
80 static assert(false, "Specified value of QuantumDepth is not supported");
84 alias AlphaType = int;
85 enum : int
87 UnspecifiedAlpha,
88 AssociatedAlpha,
89 UnassociatedAlpha
92 alias ChannelType = int;
93 enum : int
95 UndefinedChannel,
96 RedChannel, /* RGB Red channel */
97 CyanChannel, /* CMYK Cyan channel */
98 GreenChannel, /* RGB Green channel */
99 MagentaChannel, /* CMYK Magenta channel */
100 BlueChannel, /* RGB Blue channel */
101 YellowChannel, /* CMYK Yellow channel */
102 OpacityChannel, /* Opacity channel */
103 BlackChannel, /* CMYK Black (K) channel */
104 MatteChannel, /* Same as Opacity channel (deprecated) */
105 AllChannels, /* Color channels */
106 GrayChannel /* Color channels represent an intensity. */
109 /// ClassType enumeration specifies the image storage class.
110 alias ClassType = int;
111 enum : int
113 /// Unset values
114 UndefinedClass,
115 /// Image is composed of pixels which represent literal color values.
116 DirectClass,
117 /// Image is composed of pixels which specify an index in a color palette.
118 PseudoClass
122 + CompositeOperator is used to select the image composition algorithm used to
123 + compose a "composite image" with an "image".
125 + By default, each of the "composite image" pixels are replaced by the
126 + corresponding "image" tile pixel. Specify CompositeOperator to select a
127 + different algorithm.
129 + The image compositor requires a matte, or alpha channel in the image for
130 + some operations. This extra channel usually defines a mask which
131 + represents a sort of a cookie-cutter for the image. This is the case when
132 + matte is 255 (full coverage) for pixels inside the shape, zero outside, and
133 + between zero and 255 on the boundary. For certain operations, if "image"
134 + does not have a matte channel, it is initialized with `0` for any pixel
135 + matching in color to pixel location `(0, 0)`, otherwise 255 (to work
136 + properly borderWidth must be `0`).
138 alias CompositeOperator = int;
139 /// Ditto
140 enum : int
143 + Unset value.
145 UndefinedCompositeOp = 0,
147 + The result is the union of the two image shapes with the "composite
148 + image" obscuring the "image" in the region of overlap.
150 OverCompositeOp,
152 + The result is a simply "composite image" cut by the shape of "image".
153 + None of the image data of "image" is included in the result.
155 InCompositeOp,
157 + The resulting image is "composite image" with the shape of "image" cut
158 + out.
160 OutCompositeOp,
162 + The result is the same shape as "image", with "composite image"
163 + obscuring "image" where the image shapes overlap.
165 + Note that this differs from `OverCompositeOp` because the portion of
166 + "composite image" outside of "image"'s shape does not appear in the
167 + result.
169 AtopCompositeOp,
171 + The result is the image data from both "composite image" and "image"
172 + that is outside the overlap region.
174 + The overlap region will be blank.
176 XorCompositeOp,
178 + The result is just the sum of image data.
180 + Output values are cropped to 255 (no overflow). This operation is
181 + independent of the matte channels.
183 PlusCompositeOp,
185 + The result of `"composite image" - "image"`, with overflow cropped to
186 + zero.
188 + The matte channel is ignored (set to 255, full coverate).
190 MinusCompositeOp,
192 + The result of `"composite image" + "image"`, with overflow wrapping
193 + around (mod 256).
195 AddCompositeOp,
197 + The result of `"composite image" - "image"`, with underflow wrapping
198 + around (mod 256).
200 + The add and subtract operators can be used to perform reversible
201 + transformations.
203 SubtractCompositeOp,
205 + The result of `abs("composite image" - "image")`.
207 + This is useful for comparing two very similar images.
209 DifferenceCompositeOp,
211 + The result image shaded by "composite image".
213 BumpmapCompositeOp,
215 + The resulting image is "image" replaced with "composite image".
217 + Here the matte information is ignored.
219 CopyCompositeOp,
221 + The resulting image is the red layer in "image" replaced with the red
222 + layer in the "composite image".
224 + The othe layers are copied untouched.
226 CopyRedCompositeOp,
228 + The resulting image is the green layer in "image" replaced with the
229 + green layer in the "composite image".
231 + The othe layers are copied untouched.
233 CopyGreenCompositeOp,
235 + The resulting image is the blue layer in "image" replaced with the blue
236 + layer in the "composite image".
238 + The othe layers are copied untouched.
240 CopyBlueCompositeOp,
242 + The resulting image is the matte layer in "image" replaced with the
243 + matte layer in the "composite image".
245 + The othe layers are copied untouched.
247 CopyOpacityCompositeOp,
249 + Pixels in the region are set to Transparent.
251 ClearCompositeOp,
252 DissolveCompositeOp,
253 DisplaceCompositeOp,
255 + Modulate brightness in HSL space.
257 ModulateCompositeOp,
258 ThresholdCompositeOp,
260 + Do nothing at all.
262 NoCompositeOp,
263 DarkenCompositeOp,
264 LightenCompositeOp,
266 + Copy Hue channel (from HSL colorspace)
268 HueCompositeOp,
270 + Copy Saturation channel (from HSL colorspace)
272 SaturateCompositeOp,
274 + Copy Hue and Saturation channels (from HSL colorspace)
276 ColorizeCompositeOp,
278 + Copy Brightness channel (from HSL colorspace)
280 LuminizeCompositeOp,
281 /// [Not yet implemented]
282 ScreenCompositeOp,
283 /// [Not yet implemented]
284 OverlayCompositeOp,
286 + Copy the Cyan channel.
288 CopyCyanCompositeOp,
290 + Copy the Magenta channel.
292 CopyMagentaCompositeOp,
294 + Copy the Yellow channel.
296 CopyYellowCompositeOp,
298 + Copy the Black channel.
300 CopyBlackCompositeOp,
301 DivideCompositeOp,
302 HardLightCompositeOp,
303 ExclusionCompositeOp,
304 ColorDodgeCompositeOp,
305 ColorBurnCompositeOp,
306 SoftLightCompositeOp,
307 LinearBurnCompositeOp,
308 LinearDodgeCompositeOp,
309 LinearLightCompositeOp,
310 VividLightCompositeOp,
311 PinLightCompositeOp,
312 HardMixCompositeOp
316 + CompressionType is used to express the desired compression type when
317 + encoding an image.
319 + Be aware that most image types only support a sub-set of the available
320 + compression types. If the compression type specified is incompatible with
321 + the image, Magick will select a compression type compatible with the image
322 + type, which might be no compression at all.
324 alias CompressionType = int;
325 /// Ditto
326 enum : int
328 /// Unset value
329 UndefinedCompression,
330 /// No compression
331 NoCompression,
333 + BZip (Burrows-Wheeler block-sorting text compression algorithm and
334 + Huffman coding) as used by bzip2 utilities.
336 BZipCompression,
337 /// CCITT Group 3 FAX compression
338 FaxCompression,
339 /// CCITT Group 4 FAX compression (used only for TIFF)
340 Group4Compression,
341 /// JPEG compression
342 JPEGCompression,
343 /// Lossless JPEG compression
344 LosslessJPEGCompression,
345 /// Lempel-Ziv-Welch (LZW) compression (caution: patented by Unisys)
346 LZWCompression,
347 /// Run-Length encoded (RLE) compression
348 RLECompression,
349 /// Lempel-Ziv compression (LZ77) as used in PKZIP and GNU gzip.
350 ZipCompression,
351 /// LZMA - Lempel-Ziv-Markov chain algorithm
352 LZMACompression,
353 /// JPEG 2000 - ISO/IEC std 15444-1
354 JPEG2000Compression,
355 /// JBIG v1 - ISO/IEC std 11544 / ITU-T rec T.82
356 JBIG1Compression,
357 /// JBIG v2 - ISO/IEC std 14492 / ITU-T rec T.88
358 JBIG2Compression,
359 /// Facebook's Zstandard/Zstd
360 ZSTDCompression,
361 /// Google's WebP
362 WebPCompression,
365 alias DisposeType = int;
366 enum : int
368 UndefinedDispose,
369 NoneDispose,
370 BackgroundDispose,
371 PreviousDispose
374 alias EndianType = int;
375 enum : int
377 UndefinedEndian,
378 LSBEndian, /* "little" endian */
379 MSDEndian, /* "big" endian */
380 NativeEndian /* native endian */
383 alias FilterTypes = int;
384 enum : int
386 UndefinedFilter,
387 PointFilter,
388 BoxFilter,
389 TriangleFilter,
390 HermiteFilter,
391 HanningFilter,
392 HammingFilter,
393 BlackmanFilter,
394 GaussianFilter,
395 QuadraticFilter,
396 CubicFilter,
397 CatromFilter,
398 MitchellFilter,
399 LanczosFilter,
400 BesselFilter,
401 SincFilter
405 + GravityType specifies positioning of an object (e.g. text, image) within a
406 + bouding region (e.g. an image).
408 + Gravity provides a convenient way to locate objects irrespective of the
409 + size of the bounding region, in other words, you don't need to provide
410 + absolute coordinates in order to position an object. A common default for
411 + gravity is NorthWestGravity.
413 alias GravityType = int;
414 /// Ditto
415 enum : int
417 /// Don't use gravity.
418 ForgetGravity,
419 /// Position object at top-left of region.
420 NorthWestGravity,
421 /// Position object at top-center of region.
422 NorthGravity,
423 /// Position object at top-right of region.
424 NorthEastGravity,
425 /// Position object at left-center of region.
426 WestGravity,
427 /// Position object at center of region.
428 CenterGravity,
429 /// Position object at right-center of region.
430 EastGravity,
431 /// Position object at left-bottom of region.
432 SouthWestGravity,
433 /// Position object at bottom-center of region.
434 SouthGravity,
435 /// Position object at bottom-right of region.
436 SouthEastGravity,
437 StaticGravity
441 + ImageType indicates the type classification of the image.
443 alias ImageType = int;
444 /// Ditto
445 enum : int
447 /// Unset value
448 UndefinedType,
449 /// Monochrome image.
450 BilevelType,
451 /// Grayscale image.
452 GrayscaleType,
453 /// Grayscale image with opacity
454 GrayscaleMatteType,
455 /// Indexed color (palette) image.
456 PaletteType,
457 /// Indexed color (palette) image with opacity.
458 PaletteMatteType,
459 /// Truecolor image.
460 TrueColorType,
461 /// Truecolor image with opacity.
462 TrueColorMatteType,
463 /// Cyan/Yellow/Magenta/Black (CYMK) image
464 ColorSeparationType,
465 /// Cyan/Yellow/Magenta/Black (CYMK) image with opacity.
466 ColorSeparationMatteType,
467 OptimizeType
471 + InterlaceType specifies the ordering of the red, green, and blue pixel
472 + information in the image.
474 + Interlacing is usually used to make image information available to the user
475 + faster by taking advantage of the space vs. time tradeoff. For example,
476 + interlacing allows images on the Web to be recognizable sooner and
477 + satellite images to accumulate/render with image resolution increasing over
478 + time.
480 + Use `LineInterlace` or `PlaneInterlace` to create an interlace GIF or
481 + progressive JPEG image.
483 alias InterlaceType = int;
484 /// Ditto
485 enum : int
488 + Unset value.
490 UndefinedInterlace,
492 + Don't interlace image (RGBRGBRGBRGBRGBRGB...)
494 NoInterlace,
496 + Use scanline interlacing (RRR...GGG...BBB...RRR...GGG...BBB)
498 LineInterlace,
500 + Use plane interlacing (RRRRRR...GGGGGG...BBBBBB...)
502 PlaneInterlace,
504 + Similar to plane interlacing except that the different planes are
505 + saved to individual files (e.g. image.R, image.G, and image.B)
507 PartitionInterlace
511 + NoiseType is used as an argument to select the type of noise to be added to
512 + the image.
514 alias NoiseType = int;
515 /// Ditto
516 enum : int
518 UniformNoise,
519 GaussianNoise,
520 MultiplicativeGaussianNoise,
521 ImpulseNoise,
522 LaplacianNoise,
523 PoissonNoise,
524 RandomNoise,
525 UndefinedNoise
529 + OrientationType specifies the orientation of the image.
531 + Useful for when the image is produced via a different ordinate system, the
532 + camera was turned on its side, or the page was scanned sideways.
534 alias OrientationType = int;
535 /// Ditto
536 enum : int
538 /// Scanline dir: Unknown; Frame dir: Unknown
539 UndefinedOrientation,
540 /// Scanline dir: Left to Right; Frame dir: Top to Bottom
541 TopLeftOrientation,
542 /// Scanline dir: Right to Left; Frame dir: Top to Bottom
543 TopRightOrientation,
544 /// Scanline dir: Right to Left; Frame dir: Bottom to Top
545 BottomRightOrientation,
546 /// Scanline dir: Left to Right; Frame dir: Bottom to Top
547 BottomLeftOrientation,
548 /// Scanline dir: Top to Bottom; Frame dir: Left to Right
549 LeftTopOrientation,
550 /// Scanline dir: Top to Bottom; Frame dir: Right to Left
551 RightTopOrientation,
552 /// Scanline dir: Bottom to Top; Frame dir: Right to Left
553 RightBottomOrientation,
554 /// Scanline dir: Bottom to Top; Frame dir: Left to Right
555 LeftBottomOrientation
558 alias PreviewType = int;
559 enum : int
561 UndefinedPreview = 0,
562 RotatePreview,
563 ShearPreview,
564 RollPreview,
565 HuePreview,
566 SaturationPreview,
567 BrightnessPreview,
568 GammaPreview,
569 SpiffPreview,
570 DullPreview,
571 GrayscalePreview,
572 QuantizePreview,
573 DespecklePreview,
574 ReduceNoisePreview,
575 AddNoisePreview,
576 SharpenPreview,
577 BlurPreview,
578 ThresholdPreview,
579 EdgeDetectPreview,
580 SpreadPreview,
581 SolarizePreview,
582 ShadePreview,
583 RaisePreview,
584 SegmentPreview,
585 SwirlPreview,
586 ImplodePreview,
587 WavePreview,
588 OilPaintPreview,
589 CharcoalDrawingPreview,
590 JPEGPreview
594 + Rendering intent is a concept defined by ICC Spec ICC.1:1998-09, "File
595 + Format for Color Profiles".
597 + GraphicsMagick uses RenderingIntent in order to support ICC Color Profiles.
599 + From the specification:
600 + "Rendering intent specifies the style of reproduction to be used during the
601 + evaluation of this profile in a sequence of profiles. It applies
602 + specifically to that profile in the sequence and not to th entire sequence.
603 + Typically, the user or application will set the rendering intent
604 + dynamically at runtime or embedding time."
606 alias RenderingIntent = int;
607 /// Ditto
608 enum : int
611 + Unset value.
613 UndefinedIntent,
615 + A rendering intent that specifies the saturation of the pixels in the
616 + image is preserved perhaps at the expense of accuracy in hue and
617 + lightness.
619 SaturationIntent,
621 + A rendering intent that specifies the full gamut of the image is
622 + compressed or expanded to fill the gamut of the destination device.
624 + Gray balance is preserved but colorimetric accuracy might not be
625 + preseved.
627 PerceptualIntent,
629 + Absolute colorimetric.
631 AbsoluteIntent,
633 + Relative colorimetric
635 RelativeIntent
639 + By default, Magick defines resolution pixels per inch.
641 + ResolutionType provides a means to adjust this.
643 alias ResolutionType = int;
644 /// Ditto
645 enum : int
647 /// Unset Value.
648 UndefinedResolution,
650 + Density specifications are specified in units of pixels per inch
651 + (english units).
653 PixelsPerInchResolution,
655 + Density specifications are specified in units of pixels per centimeter
656 + (metric units).
658 PixelsPerCentimeterResolution
663 + --------------------------------------------------------------------------
664 + Structure Definitions
665 + --------------------------------------------------------------------------
668 struct AffineMatrix
670 double
679 struct PrimaryInfo
681 double x,
687 + The ChromaticityInfo structure is used to represent chromaticity
688 + (colorspace primary coordinates in xy space) values for images in Magick.
690 struct ChromaticityInfo
692 /// Chromaticity red primary point (e.g. x=0.64, y=0.33)
693 PrimaryInfo red_primary;
694 /// Chromaticity green primary point (e.g. x=3, y=0.6)
695 PrimaryInfo green_primary;
696 /// Chromaticity blue primary point (e.g. x=0.15, y=0.06)
697 PrimaryInfo blue_primary;
698 /// Chromaticity white point (e.g. x=0.3127, y=0.329)
699 PrimaryInfo white_point;
702 struct PixelPacket
704 version(BigEndian) {
705 /* RGBA */
706 // enum MAGICK_PIXELS_RGBA = 1;
707 Quantum red,
708 green,
709 blue,
710 opacity;
712 else {
713 /* BGRA (as used by Microsoft Windows DIB) */
714 // enum MAGICK_PIXELS_BGRA = 1;
715 Quantum blue,
716 green,
717 red,
718 opacity;
722 struct DoublePixelPacket
724 double red,
725 green,
726 blue,
727 opacity;
730 struct FloatPixelPacket
732 float red,
733 green,
734 blue,
735 opacity;
739 + ErrorInfo is used to record statistical difference (error) information
740 + based on computed Euclidean distance in RGB space.
742 struct ErrorInfo
744 /// Average error per pixel (absolute range).
745 double mean_error_per_pixel;
746 /// Average error per pixel (normalized to 1.0).
747 double normalized_mean_error;
748 /// Maximum error encountered (normalized to 1.0).
749 double normalized_maximum_error;
753 + The RectangleInfo structure is used to represent positioning information
754 + in GraphicsMagick.
756 struct RectangleInfo
758 /// Rectangle width
759 c_ulong width;
760 /// Rectangle height
761 c_ulong height;
762 /// Rectangle horizontal offset
763 c_long x;
764 /// Rectangle vertical offset.
765 c_long y;
768 /* forward decl. */
769 struct _ImageExtra;
770 struct _CacheInfo;
771 struct _ThreadViewSet;
772 struct _ImageAttribute;
773 struct _Ascii85Info;
774 struct _BlobInfo;
775 struct _SemaphoreInfo;
778 + The image structure represents a Magick image.
780 + It is initially allocated by AllocateImage() and deallocated by
781 + DestroyImage(). The functions ReadImage(), ReadImages(), BlobToImage,
782 + and CreateImage() return a new Image. Use CloneImage() to copy an image.
783 + An image consists of a structure containing image attributes as well as the
784 + image pixels.
786 struct Image
789 + Image storage class.
791 + If DirectClass then the image packets contain valid RGB or CMYK colors.
792 + If PseudoClass then the image has a colormap referenced by pixel's
793 + index member.
795 ClassType storage_class;
797 + Image pixel interpretation.
799 + If the colorspace is RGB the pixels are red, green, blue. If matte is
800 + true, then red, green, blue, and index. If it is CMYK, the pixels are
801 + cyan, yellow, magenta, black. Otherwise, the colorspace is ignored.
803 ColorspaceType colorspace;
805 + Image compression type.
807 + The default compression type of the specified image file.
809 CompressionType compression;
811 + Should the image be dithered.
813 MagickBool dither;
815 + If non-zero, then the index member of pixels represents the alpha
816 + channel.
818 MagickBool matte;
820 + Image width.
822 c_ulong columns;
824 + Image height.
826 c_ulong rows;
828 + The desired number of colors.
830 + Used by QuantizeImage().
832 uint colors;
834 + Image depth.
836 + Number of encoding bits per sample. Usually 8 or 16, but sometimes
837 + 10 or 12.
839 uint depth;
841 + PseudoColor palette array.
843 PixelPacket* colormap;
845 + Image background color.
847 PixelPacket background_color;
849 + Image border color.
851 PixelPacket border_color;
853 + Image matte (transparent) color.
855 PixelPacket matte_color;
856 double gamma;
857 ChromaticityInfo chromaticity;
858 OrientationType orientation;
859 RenderingIntent rendering_intent;
860 ResolutionType units;
861 char* montage;
862 char* directory;
863 char* geometry;
864 c_long offset;
865 double x_resolution;
866 double y_resolution;
867 RectangleInfo page;
868 RectangleInfo tile_info;
869 double blur;
870 double fuzz;
871 FilterTypes filter;
872 InterlaceType interlace;
873 EndianType endian;
874 GravityType gravity;
875 CompositeOperator compose;
876 DisposeType dispose;
877 c_ulong scene;
878 c_ulong delay;
879 c_ulong iterations;
880 c_ulong total_colors;
881 c_long start_loop;
882 ErrorInfo error;
883 TimerInfo timer;
884 void* client_data;
885 char[MaxTextExtent] filename;
886 char[MaxTextExtent] magick_filename;
887 char[MaxTextExtent] magick;
888 c_ulong magick_columns;
889 c_ulong magick_rows;
890 ExceptionInfo exception;
891 Image* previous;
892 Image* next;
894 /* private */
895 void* profiles;
896 uint is_monochrome,
897 is_grayscale,
898 taint;
900 _ImageExtra* extra;
902 MagickBool ping;
904 _CacheInfo* cache;
905 _ThreadViewSet* default_views;
906 _ImageAttribute* attributes;
907 _Ascii85Info* ascii85;
908 _BlobInfo* blob;
910 c_long reference_count;
912 _SemaphoreInfo* semaphore;
914 uint logging;
916 Image* list;
917 c_ulong signature;
920 struct ImageInfo
923 + Image compresion type.
925 + The default is the compression type of the specified image file.
927 CompressionType compression;
929 + Remove file "filename" once it has been read.
931 MagickBool temporary;
933 + Join images into a single multi-image file.
935 MagickBool adjoin;
937 + Control antialiasing of rendered Postscript and Postscript or TrueType
938 + fonts. Enabled by default.
940 MagickBool antialias;
942 + Subimage of an image sequence.
944 c_ulong subimage;
946 + Number of images relative to the base image.
948 c_ulong subrange;
950 + Image depth (8 or 16).
952 c_ulong depth;
954 + Width and height of a raw image (an image which does not support width
955 + and height information).
957 + Size may also be used to affect the image size read from a
958 + multi-resolution format (e.g. Photo CD, JBIG, or JPEG).
960 char* size;
962 + Tile name.
964 char* tile;
966 + Equivalent size of Postscript page.
968 char* page;
970 + The type of interlacing scheme (default NoInterlace).
972 + This option is used to specify the type of interlacing scheme for raw
973 + image formats such as RGB or YUV. NoInterlace means to not interlace,
974 + LineInterlace uses scanline interlacing, and PlaneInterlace uses plane
975 + interlacing. PartitionInterlace is like PlaneInterlace except the
976 + different planes are saved to individual files (e.g. image.R, image.G,
977 + and image.B). Use LineInterlace or PlaneInterlace to create an
978 + interlaced GIF or progressive JPEG image.
980 InterlaceType interlace;
982 + Select MSB/LSB endian output for TIFF format.
984 EndianType endian;
986 + Units of image resolution.
988 ResolutionType units;
990 + JPEG/MIFF/PNG compression level (default 75).
992 c_ulong quality;
994 + JPEG, MPEG, and YUV chroma downsample factor.
996 char* sampling_factor;
998 + X11 display to obtain fonts from, or to capture image from.
1000 char* sever_name;
1002 + Text rendering font.
1004 + If the font is a fully qualified X server font name, the font is
1005 + obtained from an X server. To use a TrueType font, precede the
1006 + TrueType filename with an `@`. Otherwise, specify a Postscript font
1007 + name (e.g. "helvetica").
1009 char* font;
1011 + Image filename to use as background texture.
1013 char* texture;
1015 + Vertical and horizontal resolution in pixels of the image.
1017 + This option specifies an image density when decoding a Postscript or
1018 + Portable Document page. Often used with page.
1020 char* density;
1022 + Text rendering font point size.
1024 double pointsize;
1026 + Colors within this distance are considered equal.
1028 + A number of algorithms seach for a target color. By default the color
1029 + must be exact. Use this option to match colors that are close to the
1030 + target color in RGB space.
1032 double fuzz;
1034 + Stroke or fill color while drawing.
1036 PixelPacket pen;
1038 + Image background color
1040 PixelPacket background_color;
1042 + Image border color.
1044 PixelPacket border_color;
1046 + Image matte (transparent) color.
1048 PixelPacket matte_color;
1050 + Apply Floyd/Steinberg error diffusion to the image.
1052 + The basic strategy of dithering is to trade intensity resolution for
1053 + spacial resolution by averaging the intesities of several neighboring
1054 + pixels. Images which suffer from severe contouring when reducing
1055 + colors can be improved with this option. The colors or monochrome
1056 + option must be set for this option to take effect.
1058 MagickBool dither;
1060 + Transform the image to black and white.
1062 MagickBool monochrome;
1064 + Show progress indication.
1066 MagickBool progress;
1068 + Image pixel interpretation.
1070 + If the colorspace is RGB the pixels are red, green, blue. If `matte`
1071 + is true, then red, green, blue, and index. If it is CMYK, the pixels
1072 + are cyan, yellow, magenta, black. Otherwise the colorspace is ignored.
1074 ColorspaceType colorspace;
1076 + Desired image type (used while reading or writing).
1078 ImageType type;
1080 + X11 Window group ID
1082 c_long group;
1084 + Print detailed information about the image if True.
1086 uint verbose;
1088 + FlashPix viewing parameters.
1090 char* view;
1092 + Password used to decrypt file.
1094 char* authenticate;
1096 + User-specified data to pass to coder.
1098 void* client_data;
1100 + stdio stream to read image from or write image to.
1102 + If set, Magick will read from or write to the stream rather than
1103 + opening a file. Used by ReadImage() and WriteImage(). The stream is
1104 + closed when the operation completes.
1106 FILE* file;
1108 + Image encoding format (e.g. "GIF").
1110 char[MaxTextExtent] magick;
1112 + Image file name to read or write.
1114 char[MaxTextExtent] filename;
1116 /* private members */
1118 /* private. used to pass image via open cache */
1119 _CacheInfo* cache;
1121 /* private. Map of coder specific options passed by user. */
1122 void* definitions;
1124 Image* attributes;
1126 MagickBool ping;
1128 PreviewType preview;
1130 MagickBool affirm;
1132 _BlobInfo* blob;
1134 size_t length;
1136 char[MaxTextExtent] unique;
1137 char[MaxTextExtent] zero;
1139 c_ulong signature;
1144 + --------------------------------------------------------------------------
1145 + Image Functions
1146 + --------------------------------------------------------------------------
1151 + AccessDefinition() searches the definitions for an entry matching the
1152 + specified magick and key.
1154 + NULL is returned if no matching entry is found.
1156 + Params:
1157 + image_info = The image info.
1158 + magick = Format ID. This is usually the same as the coder name.
1159 + key = The key to search for.
1161 const(char)* AccessDefinition(const ImageInfo* image_info, const char* magick,
1162 const char* key);
1165 + AddDefinition() adds a key/value definition to the current map of
1166 + definitions in ImageInfo.
1168 + Definitions may be used by coders/decoders that read and write images.
1170 + Params:
1171 + image_info = The image info.
1172 + magick = Format/classification identifier.
1173 + key = Subidentifier within format/classification.
1174 + value = Definition value
1175 + exception = Errors result in updates to this structure.
1177 MagickPassFail AddDefinition(ImageInfo* image_info, const char* magick,
1178 const char* key, const char* value,
1179 ExceptionInfo* exception);
1182 + CloneImageInfo() copies an image and returns the copy as a new image
1183 + object.
1185 + If the specified `columns and `rows` is `0`, an exact copy of the image is
1186 + returned, otherwise, the pixel data is undefined and must be initialzed
1187 + with the SetImagePixels() and SyncImagePixels() methods. On failure, a
1188 + NULL image is returned and `exception` describes the reason for failure.
1190 + Params:
1191 + image = The image
1192 + columns = The number of columns in the cloned image.
1193 + rows = The numbe of rows in the cloned image.
1194 + orphan = With a value other than 0, the cloned image is an orphan. An
1195 + orphan is a stand-alone image that is not associated with an image list.
1196 + In effect, the next and previous members of the cloned image is set to
1197 + NULL.
1198 + exception = Return any errors or warnings to this structure.
1200 Image* CloneImage(const Image* image, const c_ulong columns,
1201 const c_ulong rows, const uint orphan,
1202 ExceptionInfo* exception);
1205 + CloneImageInfo() makes a copy of the given `ImageInfo` structure.
1207 + If NULL is specified, a new image info structure is created an initialized
1208 + to default values.
1210 + Params:
1211 + image_info = The image info
1213 ImageInfo* CloneImageInfo(const ImageInfo* image_info);
1216 + DestroyImage() dereferences an image, deallocating memory associated with
1217 + the image if the reference count becomes zero.
1219 + There is no effect if the image pointer is null.
1221 + In the interest of avoiding dangling pointers or memory leaks, the image
1222 + previous and next pointers should be null when this function is called, and
1223 + no othe image should refer to it. In the future this may be enforced.
1225 + Params:
1226 + image = The image.
1228 void DestroyImage(Image* image);
1231 + DestroyImageInfo() deallocates memory associated with an `ImageInfo`
1232 + structure.
1234 + Params:
1235 + image_info = The image info.
1237 void DestroyImageInfo(ImageInfo* image_info);