diff options
| author | Mike Wey | 2011-10-29 17:26:18 +0200 |
|---|---|---|
| committer | Mike Wey | 2011-10-29 17:26:18 +0200 |
| commit | f93b586b832de0bf6133f07c8897d15cfdc6e156 (patch) | |
| tree | 22a4fce887a8eb41dcec66b16f2fc561ea8e369b | |
| parent | e094346d3db171d040eecb62217e5142a421f1f8 (diff) | |
Document some of the symbols used by dmagick.Image.
| -rw-r--r-- | dmagick/c/colorspace.d | 114 | ||||
| -rw-r--r-- | dmagick/c/distort.d | 269 | ||||
| -rw-r--r-- | dmagick/c/image.d | 119 | ||||
| -rw-r--r-- | dmagick/c/magickType.d | 135 |
4 files changed, 545 insertions, 92 deletions
diff --git a/dmagick/c/colorspace.d b/dmagick/c/colorspace.d index 59d4efd..9986a47 100644 --- a/dmagick/c/colorspace.d +++ b/dmagick/c/colorspace.d @@ -5,30 +5,144 @@ import dmagick.c.magickType; extern(C) { + /** + * Specify the colorspace that quantization (color reduction and mapping) + * is done under or to specify the colorspace when encoding an output + * image. Colorspaces are ways of describing colors to fit the + * requirements of a particular application (e.g. Television, offset + * printing, color monitors). Color reduction, by default, takes place + * in the RGBColorspace. Empirical evidence suggests that distances in + * color spaces such as YUVColorspace or YIQColorspace correspond to + * perceptual color differences more closely than do distances in RGB + * space. These color spaces may give better results when color reducing + * an image. + * + * When encoding an output image, the colorspaces RGBColorspace, + * CMYKColorspace, and GRAYColorspace may be specified. The + * CMYKColorspace option is only applicable when writing TIFF, JPEG, + * and Adobe Photoshop bitmap (PSD) files. + */ enum ColorspaceType { + /** + * No colorspace has been specified. + */ UndefinedColorspace, + + /** + * Red-Green-Blue colorspace + */ RGBColorspace, + + /** + * Full-range grayscale + */ GRAYColorspace, + + /** + * The Transparent color space behaves uniquely in that it preserves + * the matte channel of the image if it exists. + */ TransparentColorspace, + + /** + * Red-Green-Blue colorspace + */ OHTAColorspace, + + /** + * ditto + */ LabColorspace, + + /** + * CIE XYZ + */ XYZColorspace, + + /** + * Kodak PhotoCD PhotoYCC + */ YCbCrColorspace, + + /** + * ditto + */ YCCColorspace, + + /** + * Y-signal, U-signal, and V-signal colorspace. YUV is most widely + * used to encode color for use in television transmission. + */ YIQColorspace, + + /** + * ditto + */ YPbPrColorspace, + + /** + * ditto + */ YUVColorspace, + + /** + * Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive color + * system used by printers and photographers for the rendering of + * colors with ink or emulsion, normally on a white surface. + */ CMYKColorspace, + + /** + * Kodak PhotoCD sRGB. + */ sRGBColorspace, + + /** + * Hue, saturation, luminosity + */ HSBColorspace, + + /** + * ditto + */ HSLColorspace, + + /** + * Hue, whiteness, blackness + */ HWBColorspace, + + /** + * Luma (Y) according to ITU-R 601 + */ Rec601LumaColorspace, + + /** + * YCbCr according to ITU-R 601 + */ Rec601YCbCrColorspace, + + /** + * Luma (Y) according to ITU-R 709 + */ Rec709LumaColorspace, + + /** + * YCbCr according to ITU-R 709 + */ Rec709YCbCrColorspace, + + /** + * Red-Green-Blue colorspace + */ LogColorspace, + + /** + * Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive color + * system used by printers and photographers for the rendering of + * colors with ink or emulsion, normally on a white surface. + */ CMYColorspace } diff --git a/dmagick/c/distort.d b/dmagick/c/distort.d index 98e800c..371d83d 100644 --- a/dmagick/c/distort.d +++ b/dmagick/c/distort.d @@ -7,46 +7,275 @@ import dmagick.c.magickVersion; extern(C) { - mixin( + version(D_Ddoc) { - string methods = "enum DistortImageMethod + /** + * The distortion method to use when distorting an image. + */ + enum DistortImageMethod { + /** */ UndefinedDistortion, + + /** + * Distort the image linearly by moving a list of at least 3 or + * more sets of control points (as defined below). Ideally 3 sets + * or 12 floating point values are given allowing the image to + * be linearly scaled, rotated, sheared, and translated, according + * to those three points. See also the related AffineProjection + * and ScaleRotateTranslateDistortion distortions. + * + * More than 3 sets given control point pairs (12 numbers) is least + * squares fitted to best match a lineary affine distortion. If only + * 2 control point pairs (8 numbers) are given a two point image + * translation rotation and scaling is performed, without any possible + * shearing, flipping or changes in aspect ratio to the resulting image. + * If only one control point pair is provides the image is only + * translated, (which may be a floating point non-integer translation). + * + * This distortion does not include any form of perspective distortion. + */ AffineDistortion, + + /** + * Linearly distort an image using the given Affine Matrix of 6 pre-calculated + * coefficients forming a set of Affine Equations to map the source + * image to the destination image. + * + * Sx,Rx,Ry,Sy,Tx,Ty + */ AffineProjectionDistortion, + + /** + * Distort image by first scaling and rotating about a given + * 'center', before translating that 'center' to the new location, + * in that order. It is an alternative method of specifying a + * 'Affine' type of distortion, but without shearing effects. It + * also provides a good way of rotating and displacing a smaller + * image for tiling onto a larger background (IE 2-dimensional + * animations). + * + * The number of arguments determine the specific meaning of each + * argument for the scales, rotation, and translation operations. + * $(TABLE + * $(HEADERS #, arguments meaning ) + * $(ROW 1:, $(COMMA Angle_of_Rotation )) + * $(ROW 2:, $(COMMA Scale Angle )) + * $(ROW 3:, $(COMMA X,Y Angle )) + * $(ROW 4:, $(COMMA X,Y Scale Angle )) + * $(ROW 5:, $(COMMA X,Y ScaleX,ScaleY Angle )) + * $(ROW 6:, $(COMMA X,Y Scale Angle NewX,NewY )) + * $(ROW 7:, $(COMMA X,Y ScaleX,ScaleY Angle NewX,NewY )) + * ) + * + * This is actually an alternative way of specifying a 2 dimensional + * linear 'Affine' or 'AffineProjection' distortion. + */ ScaleRotateTranslateDistortion, + + /** + * Perspective distort the images, using a list of 4 or more sets of + * control points (as defined below). More that 4 sets (16 numbers) of + * control points provide least squares fitting for more accurate + * distortions (for the purposes of image registration and panarama + * effects). Less than 4 sets will fall back to a 'Affine' linear distortion. + * + * Perspective Distorted images ensures that straight lines remain straight, + * but the scale of the distorted image will vary. The horizon is + * anti-aliased, and the 'sky' color may be set using the -mattecolor setting. + */ PerspectiveDistortion, + + /** + * Do a Perspective distortion biased on a set of 8 pre-calculated coefficients. + * If the last two perspective scaling coefficients are zero, the remaining + * 6 represents a transposed 'Affine Matrix'. + */ PerspectiveProjectionDistortion, + + /** + * Bilinear Distortion, given a minimum of 4 sets of coordinate pairs, + * or 16 values (see below). Not that lines may not appear straight + * after distortion, though the distance between coordinates will + * remain consistent. + * + * The BilinearForward is used to map rectangles to any quadrilateral, + * while the BilinearReverse form maps any quadrilateral to a rectangle, + * while preserving the straigth line edges in each case. + * + * Note that BilinearForward can generate invalid pixels which will be + * colored using the -mattecolor color setting. Also if the quadraterial + * becomes 'flipped' the image may dissappear. + * + * There are future plans to produce a true Bilinear distortion that will + * attempt to map any quadrilateral to any other quadrilateral, + * while preserving edges (and edge distance ratios). + */ BilinearForwardDistortion, + + /** + * ditto + */ BilinearDistortion = BilinearForwardDistortion, + + /** + * ditto + */ BilinearReverseDistortion, + + /** + * + */ PolynomialDistortion, + + /** + * Arc the image (variation of polar mapping) over the angle given around a circle. + * $(TABLE + * $(HEADERS Argument, Meaning) + * $(ROW arc_angle, The angle over which to arc the image side-to-side) + * $(ROW rotate_angle, Angle to rotate resulting image from vertical center) + * $(ROW top_radius, Set top edge of source image at this radius) + * $(ROW bottom_radius, Set bottom edge to this radius (radial scaling)) + * ) + * + * The resulting image is always resized to best fit the resulting image, while + * attempting to preserve scale and aspect ratio of the original image as much + * as possible with the arguments given by the user. All four arguments will be + * needed to change the overall aspect ratio of an 'Arc'ed image. + * + * This a variation of a polar distortion designed to try to preserve the aspect + * ratio of the image rather than direct Cartesian to Polar conversion. + */ ArcDistortion, + + /** + * Like ArcDistortion but do a complete Cartesian to Polar mapping of the image. + * that is the height of the input image is mapped to the radius limits, while + * the width is wrapped around between the angle limits. + * + * Arguments : Rmax,Rmin CenterX,CenterY, start,end_angle + * + * All arguments are optional. With Rmin defaulting to zero, the center to the + * center of the image, and the angles going from -180 (top) to +180 (top). If + * Rmax is given the special value of '0', the the distance from the center to + * the nearest edge is used for the radius of the output image, which will ensure + * the whole image is visible (though scaled smaller). However a special value of + * '-1' will use the distance from the center to the furthest corner, This may + * 'clip' the corners from the input rectangular image, but will generate the + * exact reverse of a 'DePolar' with the same arguments. + */ PolarDistortion, - DePolarDistortion,"; - - static if ( MagickLibVersion >= 0x671 ) - { - methods ~= "Cylinder2PlaneDistortion, - Plane2CylinderDistortion,"; - } - - methods ~= " + + /** + * Uses the same arguments and meanings as a Polar distortion but generates the + * reverse Polar to Cartesian distortion. + * + * The special Rmax setting of '0' may however clip the corners of the input image. + * However using the special Rmax setting of '-1' (maximum center to corner distance) + * will ensure the whole distorted image is preserved in the generated result, so that + * the same argument to 'Polar' will reverse the distortion re-producing the original. + * Note that as this distortion requires the area resampling of a circular arc, which + * can not be handled by the builtin EWA resampling function. As such the normal EWA + * filters are turned off. It is recommended some form of 'super-sampling' image + * processing technique be used to produce a high quality result. + */ + DePolarDistortion, + + /** */ + Cylinder2PlaneDistortion, + + /** */ + Plane2CylinderDistortion, + + /** + * Given the four coefficients (A,B,C,D) as defined by Helmut Dersch, perform a barrell or + * pin-cushion distortion appropriate to correct radial lens distortions. That is in + * photographs, make straight lines straight again. + * + * Arguments : A B C [D [X,Y]] $(BR) + * or Ax Bx Cx Dx Ay By Cy Dy [X,Y] $(BR) + * So that it forms the function $(BR) + * Rsrc = r * ( A*r³ + B*r² + C*r + D ) + * + * Where X,Y is the optional center of the distortion (defaulting to the center of the image). + * The second form is typically used to distort images, rather than correct lens distortions. + */ BarrelDistortion, + + /** + * This is very simular to BarrelDistortion with the same set of arguments, and argument handling. + * However it uses the inverse of the radial polynomial, so that it forms the function + * + * Rsrc = r / ( A*r³ + B*r² + C*r + D ) + * + * Note that this is not the reverse of the Barrel distortion, + * just a different barrel-like radial distortion method. + */ BarrelInverseDistortion, - ShepardsDistortion,"; + + /** + * Distort the given list control points (any number) using an Inverse Squared Distance + * Interpolation Method (Shepards Method). The control points in effect do 'localized' + * displacement of the image around the given control point (preserving the look and the + * rotation of the area near the control points. For best results extra control points + * should be added to 'lock' the positions of the corners, edges and other unchanging + * parts of the image, to prevent their movement. + * + * The distortion has been likened to 'taffy pulling' using nails, or pins' stuck in a + * block of 'jelly' which is then moved to the new position, distorting te surface of the jelly. + */ + ShepardsDistortion, + + /** */ + ResizeDistortion, - static if ( MagickLibVersion >= 0x670 ) + /* Not a real distortion, ImageMagick uses this to get the amount of Distortions supported */ + SentinelDistortion + } + } + else + { + mixin( + { + string methods = "enum DistortImageMethod { - methods ~= "ResizeDistortion,"; - } + UndefinedDistortion, + AffineDistortion, + AffineProjectionDistortion, + ScaleRotateTranslateDistortion, + PerspectiveDistortion, + PerspectiveProjectionDistortion, + BilinearForwardDistortion, + BilinearDistortion = BilinearForwardDistortion, + BilinearReverseDistortion, + PolynomialDistortion, + ArcDistortion, + PolarDistortion, + DePolarDistortion,"; - methods ~= " - SentinelDistortion - }"; + static if ( MagickLibVersion >= 0x671 ) + { + methods ~= "Cylinder2PlaneDistortion, + Plane2CylinderDistortion,"; + } + + methods ~= " + BarrelDistortion, + BarrelInverseDistortion, + ShepardsDistortion,"; - return methods; - }()); + static if ( MagickLibVersion >= 0x670 ) + { + methods ~= "ResizeDistortion,"; + } + + methods ~= " + SentinelDistortion + }"; + + return methods; + }()); + } enum SparseColorMethod { diff --git a/dmagick/c/image.d b/dmagick/c/image.d index 2886651..4e0551c 100644 --- a/dmagick/c/image.d +++ b/dmagick/c/image.d @@ -107,60 +107,122 @@ extern(C) TransparentAlphaChannel } + /** + * Indicate the type classification of the image. + */ enum ImageType { - UndefinedType, - BilevelType, - GrayscaleType, - GrayscaleMatteType, - PaletteType, - PaletteMatteType, - TrueColorType, - TrueColorMatteType, - ColorSeparationType, - ColorSeparationMatteType, - OptimizeType, - PaletteBilevelMatteType + UndefinedType, /// No type has been specified. + BilevelType, /// Monochrome image. + GrayscaleType, /// Grayscale image. + GrayscaleMatteType, /// Grayscale image with opacity. + PaletteType, /// Indexed color (palette) image. + PaletteMatteType, /// Indexed color (palette) image with opacity. + TrueColorType, /// Truecolor image. + TrueColorMatteType, /// Truecolor image with opacity. + ColorSeparationType, /// Cyan/Yellow/Magenta/Black (CYMK) image. + ColorSeparationMatteType, /// Cyan/Yellow/Magenta/Black (CYMK) image with opacity. + OptimizeType, /// + PaletteBilevelMatteType /// } + /** + * Specify the ordering of the red, green, and blue pixel information in + * the image. Interlacing is usually used to make image information + * available to the user faster by taking advantage of the space vs + * time tradeoff. For example, interlacing allows images on the Web to + * be recognizable sooner and satellite images to accumulate/render with + * image resolution increasing over time. Use LineInterlace or + * PlaneInterlace to create an interlaced GIF or progressive JPEG image. + */ enum InterlaceType { + /** + * No interlace type has been specified. + */ UndefinedInterlace, + + /** + * Don't interlace image (RGBRGBRGBRGBRGBRGB...). + */ NoInterlace, + + /** + * Use scanline interlacing (RRR...GGG...BBB...RRR...GGG...BBB...). + */ LineInterlace, + + /** + * Use plane interlacing (RRRRRR...GGGGGG...BBBBBB...). + */ PlaneInterlace, + + /** + * Similar to plane interlacing except that the different planes are + * saved to individual files (e.g. image.R, image.G, and image.B) + */ PartitionInterlace, + + /** */ GIFInterlace, + + /** */ JPEGInterlace, + + /** */ PNGInterlace } + /** + * Specify the orientation of the image pixels. + */ enum OrientationType { + /** + * See_Also: $(LINK http://jpegclub.org/exif_orientation.html ) + */ UndefinedOrientation, - TopLeftOrientation, - TopRightOrientation, - BottomRightOrientation, - BottomLeftOrientation, - LeftTopOrientation, - RightTopOrientation, - RightBottomOrientation, - LeftBottomOrientation + TopLeftOrientation, /// ditto + TopRightOrientation, /// ditto + BottomRightOrientation, /// ditto + BottomLeftOrientation, /// ditto + LeftTopOrientation, /// ditto + RightTopOrientation, /// ditto + RightBottomOrientation, /// ditto + LeftBottomOrientation /// ditto } + /** + * By default, ImageMagick defines resolutions in pixels per inch. + * ResolutionType provides a means to adjust this. + */ enum ResolutionType { + /** + * No resolution has been specified. + */ UndefinedResolution, + + /** + * Density specifications are specified in units + * of pixels per inch (English units). + */ PixelsPerInchResolution, + + /** + * Density specifications are specified in units + * of pixels per centimeter (metric units). + */ PixelsPerCentimeterResolution } + /** */ struct PrimaryInfo { double - x, - y, - z; + x, /// X ordinate. + y, /// Y ordinate. + z; /// Z ordinate. This attribute is always ignored. } struct SegmentInfo @@ -181,13 +243,16 @@ extern(C) ImageTransmitType } + /** + * A Chromaticity object represents chromaticity values. + */ struct ChromaticityInfo { PrimaryInfo - red_primary, - green_primary, - blue_primary, - white_point; + red_primary, /// Red primary point (e.g. red_primary.x=0.64, red_primary.y=0.33) + green_primary, /// Green primary point (e.g. green_primary.x=0.3, green_primary.y=0.6) + blue_primary, /// Blue primary point (e.g. blue_primary.x=0.15, blue_primary.y=0.06) + white_point; /// White point (e.g. white_point.x=0.3127, white_point.y=0.329) } struct Image diff --git a/dmagick/c/magickType.d b/dmagick/c/magickType.d index f2eabb0..7a8b845 100644 --- a/dmagick/c/magickType.d +++ b/dmagick/c/magickType.d @@ -65,58 +65,103 @@ extern (C) enum MaxTextExtent = 4096; enum OpaqueOpacity = 0; - mixin( + version(D_Ddoc) { - string channels = "enum ChannelType + /** + * Specify an image channel. A channel is a color component of a + * pixel. In the RGB colorspace the channels are red, green, and + * blue. There may also be an alpha (transparency/opacity) channel. + * In the CMYK colorspace the channels area cyan, magenta, yellow, + * and black. In the HSL colorspace the channels are hue, saturation, + * and lightness. In the Gray colorspace the only channel is gray. + */ + enum ChannelType { UndefinedChannel, - RedChannel = 0x0001, - GrayChannel = 0x0001, - CyanChannel = 0x0001, - GreenChannel = 0x0002, - MagentaChannel = 0x0002, - BlueChannel = 0x0004, - YellowChannel = 0x0004, - AlphaChannel = 0x0008, - OpacityChannel = 0x0008, - MatteChannel = 0x0008, // deprecated - BlackChannel = 0x0020, - IndexChannel = 0x0020, - CompositeChannels = 0x002F,"; - - static if ( MagickLibVersion < 0x670 ) - { - channels ~= "AllChannels = 0x002F,"; - } - else static if ( MagickLibVersion == 0x670 ) - { - channels ~= "AllChannels = ~0UL,"; - } - else static if ( MagickLibVersion == 0x671 ) - { - channels ~= "AllChannels = ~0L,"; - } - else + RedChannel = 0x0001, /// + GrayChannel = 0x0001, /// + CyanChannel = 0x0001, /// + GreenChannel = 0x0002, /// + MagentaChannel = 0x0002, /// + BlueChannel = 0x0004, /// + YellowChannel = 0x0004, /// + AlphaChannel = 0x0008, /// Same as OpacityChannel + OpacityChannel = 0x0008, /// + MatteChannel = 0x0008, /// deprecated + BlackChannel = 0x0020, /// + IndexChannel = 0x0020, /// + CompositeChannels = 0x002F, /// + AllChannels = 0x7ffffff, /// + + TrueAlphaChannel = 0x0040, /// extract actual alpha channel from opacity + RGBChannels = 0x0080, /// set alpha from grayscale mask in RGB + GrayChannels = 0x0080, /// + SyncChannels = 0x0100, /// channels should be modified equally + + /** + * Same as AllChannels, excluding OpacityChannel + */ + DefaultChannels = ((AllChannels | SyncChannels) &~ OpacityChannel) + } + } + else + { + mixin( + { + string channels = "enum ChannelType { - channels ~= "AllChannels = 0x7FFFFFF,"; - } - - channels ~= " - TrueAlphaChannel = 0x0040, // extract actual alpha channel from opacity - RGBChannels = 0x0080, // set alpha from grayscale mask in RGB - GrayChannels = 0x0080, - SyncChannels = 0x0100, // channels should be modified equally - DefaultChannels = ( (AllChannels | SyncChannels) &~ OpacityChannel) - }"; - - return channels; - }()); + UndefinedChannel, + RedChannel = 0x0001, + GrayChannel = 0x0001, + CyanChannel = 0x0001, + GreenChannel = 0x0002, + MagentaChannel = 0x0002, + BlueChannel = 0x0004, + YellowChannel = 0x0004, + AlphaChannel = 0x0008, + OpacityChannel = 0x0008, + MatteChannel = 0x0008, // deprecated + BlackChannel = 0x0020, + IndexChannel = 0x0020, + CompositeChannels = 0x002F,"; + + static if ( MagickLibVersion < 0x670 ) + { + channels ~= "AllChannels = 0x002F,"; + } + else static if ( MagickLibVersion == 0x670 ) + { + channels ~= "AllChannels = ~0UL,"; + } + else static if ( MagickLibVersion == 0x671 ) + { + channels ~= "AllChannels = ~0L,"; + } + else + { + channels ~= "AllChannels = 0x7FFFFFF,"; + } + + channels ~= " + TrueAlphaChannel = 0x0040, // extract actual alpha channel from opacity + RGBChannels = 0x0080, // set alpha from grayscale mask in RGB + GrayChannels = 0x0080, + SyncChannels = 0x0100, // channels should be modified equally + DefaultChannels = ( (AllChannels | SyncChannels) &~ OpacityChannel) + }"; + + return channels; + }()); + } + /** + * Specify the image storage class. + */ enum ClassType { - UndefinedClass, - DirectClass, - PseudoClass + UndefinedClass, /// No storage class has been specified. + DirectClass, /// Image is composed of pixels which represent literal color values. + PseudoClass /// Image is composed of pixels which specify an index in a color palette. } struct BlobInfo {} |
