1 /**
2  * @file icm.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _ICM_H
25 #define _ICM_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN98)
34 #define MAX_COLOR_CHANNELS 8
35 #define PROFILE_FILENAME 1
36 #define PROFILE_MEMBUFFER 2
37 #define PROFILE_READ 1
38 #define PROFILE_READWRITE 2
39 #define CLASS_SCANNER 0x73636E72
40 #define CLASS_MONITOR 0x6D6E7472
41 #define CLASS_PRINTER 0x70727472
42 #define CLASS_LINK 0x6C696E6B
43 #define CLASS_COLORSPAC 0x73706163
44 #define CLASS_ABSTRACT 0x61627374
45 #define CLASS_NAMED 0x6E6D636C
46 #define SPACE_XYZ 0x58595A20
47 #define SPACE_Lab 0x4C616220
48 #define SPACE_Luv 0x4C757620
49 #define SPACE_YCbCr 0x59436272
50 #define SPACE_Yxy 0x59787920
51 #define SPACE_RGB 0x52474220
52 #define SPACE_GRAY 0x47524159
53 #define SPACE_HSV 0x48535620
54 #define SPACE_HLS 0x484C5320
55 #define SPACE_CMYK 0x434D594B
56 #define SPACE_CMY 0x434D5920
57 #define SPACE_2_CHANNEL 0x32434C52
58 #define SPACE_3_CHANNEL 0x33434C52
59 #define SPACE_4_CHANNEL 0x34434C52
60 #define SPACE_5_CHANNEL 0x35434C52
61 #define SPACE_6_CHANNEL 0x36434C52
62 #define SPACE_7_CHANNEL 0x37434C52
63 #define SPACE_8_CHANNEL 0x38434C52
64 #define FLAG_EMBEDDEDPROFILE 1
65 #define FLAG_DEPENDENTONDATA 2
66 #define ATTRIB_TRANSPARENCY 1
67 #define ATTRIB_MATTE 2
68 #define INTENT_PERCEPTUAL 0
69 #define INTENT_RELATIVE_COLORIMETRIC 1
70 #define INTENT_SATURATION 2
71 #define INTENT_ABSOLUTE_COLORIMETRIC 3
72 #define COLOR_MATCH_VERSION 0x200
73 #define CMS_DISABLEICM 0x1
74 #define CMS_ENABLEPROOFING 0x2
75 #define CMS_SETRENDERINTENT 0x4
76 #define CMS_SETPROOFINTENT 0x8
77 #define CMS_SETMONITORPROFILE 0x10
78 #define CMS_SETPRINTERPROFILE 0x20
79 #define CMS_SETTARGETPROFILE 0x40
80 #define CMS_USEHOOK 0x80
81 #define CMS_USEAPPLYCALLBACK 0x100
82 #define CMS_USEDESCRIPTION 0x200
83 #define CMS_TARGETOVERFLOW 0x20000000
84 #define CMS_PRINTERROVERFLOW 0x40000000
85 #define CMS_MONITOROVERFLOW 0x80000000
86 
87 DECLARE_HANDLE(HPROFILE);
88 typedef HPROFILE *PHPROFILE,*LPHPROFILE;
89 DECLARE_HANDLE(HTRANSFORM);\
90 
91 typedef BOOL (CALLBACK *PBMCALLBACKFN)(ULONG,ULONG,LPARAM);
92 struct _tagCOLORMATCHSETUPA;
93 struct _tagCOLORMATCHSETUPW;
94 typedef BOOL (CALLBACK *PCMSCALLBACKA)(struct _tagCOLORMATCHSETUPA*,LPARAM);
95 typedef BOOL (CALLBACK *PCMSCALLBACKW)(struct _tagCOLORMATCHSETUPW*,LPARAM);
96 
97 typedef CHAR COLOR_NAME[32];
98 typedef COLOR_NAME *PCOLOR_NAME,*LPCOLOR_NAME;
99 typedef DWORD TAGTYPE,*PTAGTYPE,*LPTAGTYPE;
100 typedef enum
101 {
102   BM_x555RGB      = 0x0000,
103   BM_x555XYZ      = 0x0101,
104   BM_x555Yxy,
105   BM_x555Lab,
106   BM_x555G3CH,
107   BM_RGBTRIPLETS  = 0x0002,
108   BM_BGRTRIPLETS  = 0x0004,
109   BM_XYZTRIPLETS  = 0x0201,
110   BM_YxyTRIPLETS,
111   BM_LabTRIPLETS,
112   BM_G3CHTRIPLETS,
113   BM_5CHANNEL,
114   BM_6CHANNEL,
115   BM_7CHANNEL,
116   BM_8CHANNEL,
117   BM_GRAY,
118   BM_xRGBQUADS    = 0x0008,
119   BM_xBGRQUADS    = 0x0010,
120   BM_xG3CHQUADS   = 0x0304,
121   BM_KYMCQUADS,
122   BM_CMYKQUADS    = 0x0020,
123   BM_10b_RGB      = 0x0009,
124   BM_10b_XYZ      = 0x0401,
125   BM_10b_Yxy,
126   BM_10b_Lab,
127   BM_10b_G3CH,
128   BM_NAMED_INDEX,
129   BM_16b_RGB      = 0x000A,
130   BM_16b_XYZ      = 0x0501,
131   BM_16b_Yxy,
132   BM_16b_Lab,
133   BM_16b_G3CH,
134   BM_16b_GRAY,
135   BM_565RGB       = 0x0001
136 } BMFORMAT,*PBMFORMAT,*LPBMFORMAT;
137 typedef enum
138 {
139   COLOR_GRAY       =   1,
140   COLOR_RGB,
141   COLOR_XYZ,
142   COLOR_Yxy,
143   COLOR_Lab,
144   COLOR_3_CHANNEL,
145   COLOR_CMYK,
146   COLOR_5_CHANNEL,
147   COLOR_6_CHANNEL,
148   COLOR_7_CHANNEL,
149   COLOR_8_CHANNEL,
150   COLOR_NAMED
151 } COLORTYPE,*PCOLORTYPE,*LPCOLORTYPE;
152 struct GRAYCOLOR {
153   WORD    gray;
154 };
155 struct RGBCOLOR {
156   WORD    red;
157   WORD    green;
158   WORD    blue;
159 };
160 struct CMYKCOLOR {
161   WORD    cyan;
162   WORD    magenta;
163   WORD    yellow;
164   WORD    black;
165 };
166 struct XYZCOLOR {
167   WORD    X;
168   WORD    Y;
169   WORD    Z;
170 };
171 struct YxyCOLOR {
172   WORD    Y;
173   WORD    x;
174   WORD    y;
175 };
176 struct LabCOLOR {
177   WORD    L;
178   WORD    a;
179   WORD    b;
180 };
181 struct GENERIC3CHANNEL {
182   WORD    ch1;
183   WORD    ch2;
184   WORD    ch3;
185 };
186 struct NAMEDCOLOR {
187   DWORD   dwIndex;
188 };
189 struct HiFiCOLOR {
190   BYTE    channel[MAX_COLOR_CHANNELS];
191 };
192 typedef union tagCOLOR {
193   struct GRAYCOLOR        gray;
194   struct RGBCOLOR         rgb;
195   struct CMYKCOLOR        cmyk;
196   struct XYZCOLOR         XYZ;
197   struct YxyCOLOR         Yxy;
198   struct LabCOLOR         Lab;
199   struct GENERIC3CHANNEL  gen3ch;
200   struct NAMEDCOLOR       named;
201   struct HiFiCOLOR        hifi;
202 } COLOR,*PCOLOR,*LPCOLOR;
203 typedef struct _tagCOLORMATCHSETUPA {
204   DWORD         dwSize;
205   DWORD         dwVersion;
206   DWORD         dwFlags;
207   HWND          hwndOwner;
208   PCSTR         pSourceName;
209   PCSTR         pDisplayName;
210   PCSTR         pPrinterName;
211   DWORD         dwRenderIntent;
212   DWORD         dwProofingIntent;
213   PSTR          pMonitorProfile;
214   DWORD         ccMonitorProfile;
215   PSTR          pPrinterProfile;
216   DWORD         ccPrinterProfile;
217   PSTR          pTargetProfile;
218   DWORD         ccTargetProfile;
219   DLGPROC       lpfnHook;
220   LPARAM        lParam;
221   PCMSCALLBACKA lpfnApplyCallback;
222   LPARAM        lParamApplyCallback;
223 } COLORMATCHSETUPA,*PCOLORMATCHSETUPA,*LPCOLORMATCHSETUPA;
224 typedef struct _tagCOLORMATCHSETUPW {
225   DWORD         dwSize;
226   DWORD         dwVersion;
227   DWORD         dwFlags;
228   HWND          hwndOwner;
229   PCWSTR        pSourceName;
230   PCWSTR        pDisplayName;
231   PCWSTR        pPrinterName;
232   DWORD         dwRenderIntent;
233   DWORD         dwProofingIntent;
234   PWSTR         pMonitorProfile;
235   DWORD         ccMonitorProfile;
236   PWSTR         pPrinterProfile;
237   DWORD         ccPrinterProfile;
238   PWSTR         pTargetProfile;
239   DWORD         ccTargetProfile;
240   DLGPROC       lpfnHook;
241   LPARAM        lParam;
242   PCMSCALLBACKW lpfnApplyCallback;
243   LPARAM        lParamApplyCallback;
244 } COLORMATCHSETUPW,*PCOLORMATCHSETUPW,*LPCOLORMATCHSETUPW;
245 typedef struct tagENUMTYPEW {
246   DWORD   dwSize;
247   DWORD   dwVersion;
248   DWORD   dwFields;
249   PCWSTR  pDeviceName;
250   DWORD   dwMediaType;
251   DWORD   dwDitheringMode;
252   DWORD   dwResolution[2];
253   DWORD   dwCMMType;
254   DWORD   dwClass;
255   DWORD   dwDataColorSpace;
256   DWORD   dwConnectionSpace;
257   DWORD   dwSignature;
258   DWORD   dwPlatform;
259   DWORD   dwProfileFlags;
260   DWORD   dwManufacturer;
261   DWORD   dwModel;
262   DWORD   dwAttributes[2];
263   DWORD   dwRenderingIntent;
264   DWORD   dwCreator;
265   DWORD   dwDeviceClass;
266 } ENUMTYPEW,*PENUMTYPEW,*LPENUMTYPEW;
267 typedef struct tagENUMTYPEA {
268   DWORD   dwSize;
269   DWORD   dwVersion;
270   DWORD   dwFields;
271   PCSTR   pDeviceName;
272   DWORD   dwMediaType;
273   DWORD   dwDitheringMode;
274   DWORD   dwResolution[2];
275   DWORD   dwCMMType;
276   DWORD   dwClass;
277   DWORD   dwDataColorSpace;
278   DWORD   dwConnectionSpace;
279   DWORD   dwSignature;
280   DWORD   dwPlatform;
281   DWORD   dwProfileFlags;
282   DWORD   dwManufacturer;
283   DWORD   dwModel;
284   DWORD   dwAttributes[2];
285   DWORD   dwRenderingIntent;
286   DWORD   dwCreator;
287   DWORD   dwDeviceClass;
288 } ENUMTYPEA,*PENUMTYPEA,*LPENUMTYPEA;
289 typedef struct tagNAMED_PROFILE_INFO{
290   DWORD         dwFlags;
291   DWORD         dwCount;
292   DWORD         dwCountDevCoordinates;
293   COLOR_NAME    szPrefix;
294   COLOR_NAME    szSuffix;
295 } NAMED_PROFILE_INFO,*PNAMED_PROFILE_INFO,*LPNAMED_PROFILE_INFO;
296 typedef struct tagPROFILE {
297   DWORD    dwType;
298   PVOID    pProfileData;
299   DWORD    cbDataSize;
300 } PROFILE,*PPROFILE,*LPPROFILE;
301 typedef struct tagPROFILEHEADER {
302   DWORD   phSize;
303   DWORD   phCMMType;
304   DWORD   phVersion;
305   DWORD   phClass;
306   DWORD   phDataColorSpace;
307   DWORD   phConnectionSpace;
308   DWORD   phDateTime[3];
309   DWORD   phSignature;
310   DWORD   phPlatform;
311   DWORD   phProfileFlags;
312   DWORD   phManufacturer;
313   DWORD   phModel;
314   DWORD   phAttributes[2];
315   DWORD   phRenderingIntent;
316   CIEXYZ  phIlluminant;
317   DWORD   phCreator;
318   BYTE    phReserved[44];
319 } PROFILEHEADER,*PPROFILEHEADER,*LPPROFILEHEADER;
320 
321 BOOL WINAPI AssociateColorProfileWithDeviceA(PCSTR,PCSTR,PCSTR);
322 BOOL WINAPI AssociateColorProfileWithDeviceW(PCWSTR,PCWSTR,PCWSTR);
323 BOOL WINAPI CheckBitmapBits(HTRANSFORM,PVOID,BMFORMAT,DWORD,DWORD,DWORD,PBYTE,PBMCALLBACKFN,LPARAM);
324 BOOL WINAPI CheckColors(HTRANSFORM,PCOLOR,DWORD,COLORTYPE,PBYTE);
325 BOOL WINAPI CloseColorProfile(HPROFILE);
326 BOOL WINAPI ConvertColorNameToIndex(HPROFILE,PCOLOR_NAME,PDWORD,DWORD);
327 BOOL WINAPI ConvertIndexToColorName(HPROFILE,PDWORD,PCOLOR_NAME,DWORD);
328 HTRANSFORM WINAPI CreateColorTransformA(LPLOGCOLORSPACEA,HPROFILE,HPROFILE,DWORD);
329 HTRANSFORM WINAPI CreateColorTransformW(LPLOGCOLORSPACEW,HPROFILE,HPROFILE,DWORD);
330 BOOL WINAPI CreateDeviceLinkProfile(PHPROFILE,DWORD,PDWORD,DWORD,DWORD,PBYTE*,DWORD);
331 HTRANSFORM WINAPI CreateMultiProfileTransform(PHPROFILE,DWORD,PDWORD,DWORD,DWORD,DWORD);
332 BOOL WINAPI CreateProfileFromLogColorSpaceA(LPLOGCOLORSPACEA,PBYTE*);
333 BOOL WINAPI CreateProfileFromLogColorSpaceW(LPLOGCOLORSPACEW,PBYTE*);
334 BOOL WINAPI DeleteColorTransform(HTRANSFORM);
335 BOOL WINAPI DisassociateColorProfileFromDeviceA(PCSTR,PCSTR,PCSTR);
336 BOOL WINAPI DisassociateColorProfileFromDeviceW(PCWSTR,PCWSTR,PCWSTR);
337 BOOL WINAPI EnumColorProfilesA(PCSTR,PENUMTYPEA,PBYTE,PDWORD,PDWORD);
338 BOOL WINAPI EnumColorProfilesW(PCWSTR,PENUMTYPEW,PBYTE,PDWORD,PDWORD);
339 DWORD WINAPI GetCMMInfo(HTRANSFORM,DWORD);
340 BOOL WINAPI GetColorDirectoryA(PCSTR,PSTR,PDWORD);
341 BOOL WINAPI GetColorDirectoryW(PCWSTR,PWSTR,PDWORD);
342 BOOL WINAPI GetColorProfileElement(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID,PBOOL);
343 BOOL WINAPI GetColorProfileElementTag(HPROFILE,DWORD,PTAGTYPE);
344 BOOL WINAPI GetColorProfileFromHandle(HPROFILE,PBYTE,PDWORD);
345 BOOL WINAPI GetColorProfileHeader(HPROFILE,PPROFILEHEADER);
346 BOOL WINAPI GetCountColorProfileElements(HPROFILE,PDWORD);
347 BOOL WINAPI GetNamedProfileInfo(HPROFILE,PNAMED_PROFILE_INFO);
348 BOOL WINAPI GetPS2ColorRenderingDictionary(HPROFILE,DWORD,PBYTE,PDWORD,PBOOL);
349 BOOL WINAPI GetPS2ColorRenderingIntent(HPROFILE,DWORD,PBYTE,PDWORD);
350 BOOL WINAPI GetPS2ColorSpaceArray(HPROFILE,DWORD,DWORD,PBYTE,PDWORD,PBOOL);
351 BOOL WINAPI GetStandardColorSpaceProfileA(PCSTR,DWORD,PSTR,PDWORD);
352 BOOL WINAPI GetStandardColorSpaceProfileW(PCWSTR,DWORD,PWSTR,PDWORD);
353 BOOL WINAPI InstallColorProfileA(PCSTR,PCSTR);
354 BOOL WINAPI InstallColorProfileW(PCWSTR,PCWSTR);
355 BOOL WINAPI IsColorProfileTagPresent(HPROFILE,TAGTYPE,PBOOL);
356 BOOL WINAPI IsColorProfileValid(HPROFILE,PBOOL);
357 HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD);
358 HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD);
359 BOOL WINAPI RegisterCMMA(PCSTR,DWORD,PCSTR);
360 BOOL WINAPI RegisterCMMW(PCWSTR,DWORD,PCWSTR);
361 BOOL WINAPI SelectCMM(DWORD);
362 BOOL WINAPI SetColorProfileElement(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID);
363 BOOL WINAPI SetColorProfileElementReference(HPROFILE,TAGTYPE,TAGTYPE);
364 BOOL WINAPI SetColorProfileElementSize(HPROFILE,TAGTYPE,DWORD);
365 BOOL WINAPI SetColorProfileHeader(HPROFILE,PPROFILEHEADER);
366 BOOL WINAPI SetStandardColorSpaceProfileA(PCSTR,DWORD,PCSTR);
367 BOOL WINAPI SetStandardColorSpaceProfileW(PCWSTR,DWORD,PCSTR);
368 BOOL WINAPI SetupColorMatchingA(PCOLORMATCHSETUPA);
369 BOOL WINAPI SetupColorMatchingW(PCOLORMATCHSETUPW);
370 BOOL WINAPI TranslateBitmapBits(HTRANSFORM,PVOID,BMFORMAT,DWORD,DWORD,DWORD,PVOID,BMFORMAT,DWORD,PBMCALLBACKFN,ULONG);
371 BOOL WINAPI TranslateColors(HTRANSFORM,PCOLOR,DWORD,COLORTYPE,PCOLOR,COLORTYPE);
372 BOOL WINAPI UninstallColorProfileA(PCSTR,PCSTR,BOOL);
373 BOOL WINAPI UninstallColorProfileW(PCWSTR,PCWSTR,BOOL);
374 BOOL WINAPI UnregisterCMMA(PCSTR,DWORD);
375 BOOL WINAPI UnregisterCMMW(PCWSTR,DWORD);
376 
377 typedef __AW(PCMSCALLBACK) PCMSCALLBACK;
378 typedef __AW(COLORMATCHSETUP) COLORMATCHSETUP,*PCOLORMATCHSETUP,*LPCOLORMATCHSETUP;
379 typedef __AW(ENUMTYPE) ENUMTYPE,*PENUMTYPE,*LPENUMTYPE;
380 #define AssociateColorProfileWithDevice __AW(AssociateColorProfileWithDevice)
381 #define CreateColorTransform __AW(CreateColorTransform)
382 #define CreateProfileFromLogColorSpace __AW(CreateProfileFromLogColorSpace)
383 #define DisassociateColorProfileFromDevice __AW(DisassociateColorProfileFromDevice)
384 #define EnumColorProfiles __AW(EnumColorProfiles)
385 #define GetColorDirectory __AW(GetColorDirectory)
386 #define GetStandardColorSpaceProfile __AW(GetStandardColorSpaceProfile)
387 #define InstallColorProfile __AW(InstallColorProfile)
388 #define OpenColorProfile __AW(OpenColorProfile)
389 #define RegisterCMM __AW(RegisterCMM)
390 #define SetStandardColorSpaceProfile __AW(SetStandardColorSpaceProfile)
391 #define SetupColorMatching __AW(SetupColorMatching)
392 #define UninstallColorProfile __AW(UninstallColorProfile)
393 #define UnregisterCMM __AW(UnregisterCMM)
394 
395 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN98) */
396 
397 #ifdef __cplusplus
398 }
399 #endif
400 
401 #endif /* _ICM_H */
402