1 module dmagick.c.colorspace; 2 3 import dmagick.c.exception; 4 import dmagick.c.image; 5 import dmagick.c.magickType; 6 import dmagick.c.magickVersion; 7 8 extern(C) 9 { 10 /** 11 * Specify the colorspace that quantization (color reduction and mapping) 12 * is done under or to specify the colorspace when encoding an output 13 * image. Colorspaces are ways of describing colors to fit the 14 * requirements of a particular application (e.g. Television, offset 15 * printing, color monitors). Color reduction, by default, takes place 16 * in the RGBColorspace. Empirical evidence suggests that distances in 17 * color spaces such as YUVColorspace or YIQColorspace correspond to 18 * perceptual color differences more closely than do distances in RGB 19 * space. These color spaces may give better results when color reducing 20 * an image. 21 * 22 * When encoding an output image, the colorspaces RGBColorspace, 23 * CMYKColorspace, and GRAYColorspace may be specified. The 24 * CMYKColorspace option is only applicable when writing TIFF, JPEG, 25 * and Adobe Photoshop bitmap (PSD) files. 26 */ 27 enum ColorspaceType 28 { 29 /** 30 * No colorspace has been specified. 31 */ 32 UndefinedColorspace, 33 34 /** 35 * Linear RGB colorspace 36 */ 37 RGBColorspace, 38 39 /** 40 * Full-range grayscale 41 */ 42 GRAYColorspace, 43 44 /** 45 * The Transparent color space behaves uniquely in that it preserves 46 * the matte channel of the image if it exists. 47 */ 48 TransparentColorspace, 49 50 /** 51 * Red-Green-Blue colorspace 52 */ 53 OHTAColorspace, 54 55 /** 56 * ditto 57 */ 58 LabColorspace, 59 60 /** 61 * CIE XYZ 62 */ 63 XYZColorspace, 64 65 /** 66 * Kodak PhotoCD PhotoYCC 67 */ 68 YCbCrColorspace, 69 70 /** 71 * ditto 72 */ 73 YCCColorspace, 74 75 /** 76 * Y-signal, U-signal, and V-signal colorspace. YUV is most widely 77 * used to encode color for use in television transmission. 78 */ 79 YIQColorspace, 80 81 /** 82 * ditto 83 */ 84 YPbPrColorspace, 85 86 /** 87 * ditto 88 */ 89 YUVColorspace, 90 91 /** 92 * Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive color 93 * system used by printers and photographers for the rendering of 94 * colors with ink or emulsion, normally on a white surface. 95 */ 96 CMYKColorspace, 97 98 /** 99 * Kodak PhotoCD sRGB. 100 */ 101 sRGBColorspace, 102 103 /** 104 * Hue, saturation, luminosity 105 */ 106 HSBColorspace, 107 108 /** 109 * ditto 110 */ 111 HSLColorspace, 112 113 /** 114 * Hue, whiteness, blackness 115 */ 116 HWBColorspace, 117 118 /** 119 * Luma (Y) according to ITU-R 601 120 */ 121 Rec601LumaColorspace, 122 123 /** 124 * YCbCr according to ITU-R 601 125 */ 126 Rec601YCbCrColorspace, 127 128 /** 129 * Luma (Y) according to ITU-R 709 130 */ 131 Rec709LumaColorspace, 132 133 /** 134 * YCbCr according to ITU-R 709 135 */ 136 Rec709YCbCrColorspace, 137 138 /** 139 * Red-Green-Blue colorspace 140 */ 141 LogColorspace, 142 143 /** 144 * Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive color 145 * system used by printers and photographers for the rendering of 146 * colors with ink or emulsion, normally on a white surface. 147 */ 148 CMYColorspace, 149 150 /** 151 * CIE 1976 (L*, u*, v*) color space. 152 */ 153 LuvColorspace, 154 155 /** 156 * HCL is a color space that tries to combine the advantages of 157 * perceptual uniformity of Luv, and the simplicity of specification 158 * of HSV and HSL. 159 */ 160 HCLColorspace, 161 162 /** Alias for LCHuv. */ 163 LCHColorspace, 164 165 /** 166 * LMS is a color space represented by the response of the three types 167 * of cones of the human eye, named after their responsivity 168 * (sensitivity) at long, medium and short wavelengths. 169 */ 170 LMSColorspace, 171 172 /** 173 * CIE 1976 cylindrical version of Lab. 174 */ 175 LCHabColorspace, 176 177 /** 178 * CIE 1976 cylindrical version of Luv 179 */ 180 LCHuvColorspace, 181 182 /** 183 * scRGB is a wide color gamut RGB (Red Green Blue) color space 184 * created by Microsoft and HP that uses the same color primaries 185 * and white/black points as the sRGB color space but allows 186 * coordinates below zero and greater than one. 187 */ 188 scRGBColorspace, 189 190 /** */ 191 HSIColorspace, 192 193 /* Alias for HSB. */ 194 HSVColorspace, 195 196 /** */ 197 HCLpColorspace, 198 199 /** */ 200 YDbDrColorspace, 201 202 /** 203 * In CIE xyY, Y is the luminance and x and y represents the chrominance 204 * values derived from the tristimulus values X, Y and Z in the CIE XYZ 205 * color space. 206 */ 207 xyYColorspace 208 } 209 210 MagickBooleanType RGBTransformImage(Image*, const ColorspaceType); 211 MagickBooleanType SetImageColorspace(Image*, const ColorspaceType); 212 213 static if ( MagickLibVersion >= 0x692 ) 214 { 215 MagickBooleanType SetImageGray(Image*, ExceptionInfo*); 216 MagickBooleanType SetImageMonochrome(Image*, ExceptionInfo*); 217 } 218 219 MagickBooleanType TransformImageColorspace(Image*, const ColorspaceType); 220 MagickBooleanType TransformRGBImage(Image*, const ColorspaceType); 221 }