1 /* Header file guard bands */
2 #ifndef ICC_H
3 #define ICC_H
4 
5 /*****************************************************************
6  Copyright (c) 1994-1996 SunSoft, Inc.
7 
8                     Rights Reserved
9 
10 Permission is hereby granted, free of charge, to any person
11 obtaining a copy of this software and associated documentation
12 files (the "Software"), to deal in the Software without restrict-
13 ion, including without limitation the rights to use, copy, modify,
14 merge, publish distribute, sublicense, and/or sell copies of the
15 Software, and to permit persons to whom the Software is furnished
16 to do so, subject to the following conditions:
17 
18 The above copyright notice and this permission notice shall be
19 included in all copies or substantial portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
24 INFRINGEMENT.  IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
25 COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 OTHER DEALINGS IN THE SOFTWARE.
29 
30 Except as contained in this notice, the name of SunSoft, Inc.
31 shall not be used in advertising or otherwise to promote the
32 sale, use or other dealings in this Software without written
33 authorization from SunSoft Inc.
34 ******************************************************************/
35 
36 /*
37  * This version of the header file corresponds to the profile
38  * specification version 3.4.
39  *
40  * All header file entries are pre-fixed with "ic" to help
41  * avoid name space collisions. Signatures are pre-fixed with
42  * icSig.
43  *
44  * The structures defined in this header file were created to
45  * represent a description of an ICC profile on disk. Rather
46  * than use pointers a technique is used where a single byte array
47  * was placed at the end of each structure. This allows us in "C"
48  * to extend the structure by allocating more data than is needed
49  * to account for variable length structures.
50  *
51  * This also ensures that data following is allocated
52  * contiguously and makes it easier to write and read data from
53  * the file.
54  *
55  * For example to allocate space for a 256 count length UCR
56  * and BG array, and fill the allocated data.  Note strlen + 1
57  * to remember NULL terminator.
58  *
59         icUcrBgCurve    *ucrCurve, *bgCurve;
60         int             ucr_nbytes, bg_nbytes, string_bytes;
61         icUcrBg         *ucrBgWrite;
62         char            ucr_string[100], *ucr_char;
63 
64         strcpy(ucr_string, "Example ucrBG curves");
65         ucr_nbytes = sizeof(icUInt32Number) +
66                  (UCR_CURVE_SIZE * sizeof(icUInt16Number));
67         bg_nbytes = sizeof(icUInt32Number) +
68                  (BG_CURVE_SIZE * sizeof(icUInt16Number));
69         string_bytes = strlen(ucr_string) + 1;
70 
71         ucrBgWrite = (icUcrBg *)malloc(
72                                 (ucr_nbytes + bg_nbytes + string_bytes));
73 
74         ucrCurve = (icUcrBgCurve *)ucrBgWrite->data;
75         ucrCurve->count = UCR_CURVE_SIZE;
76         for (i=0; i<ucrCurve->count; i++)
77                 ucrCurve->curve[i] = (icUInt16Number)i;
78 
79         bgCurve = (icUcrBgCurve *)((char *)ucrCurve + ucr_nbytes);
80         bgCurve->count = BG_CURVE_SIZE;
81         for (i=0; i<bgCurve->count; i++)
82                 bgCurve->curve[i] = 255 - (icUInt16Number)i;
83 
84         ucr_char = (char *)((char *)bgCurve + bg_nbytes);
85         memcpy(ucr_char, ucr_string, string_bytes);
86  *
87  */
88 
89 /*
90  * Many of the structures contain variable length arrays. This
91  * is represented by the use of the convention.
92  *
93  *      type    data[icAny];
94  */
95 
96 /*------------------------------------------------------------------------*/
97 /*
98  * Defines used in the specification
99  */
100 #define icMagicNumber                   0x61637370L     /* 'acsp' */
101 #define icVersionNumber                 0x02100000L     /* 2.1.0, BCD */
102 
103 /* Screening Encodings */
104 #define icPrtrDefaultScreensFalse       0x00000000L     /* Bit pos 0 */
105 #define icPrtrDefaultScreensTrue        0x00000001L     /* Bit pos 0 */
106 #define icLinesPerInch                  0x00000002L     /* Bit pos 1 */
107 #define icLinesPerCm                    0x00000000L     /* Bit pos 1 */
108 
109 /*
110  * Device attributes, currently defined values correspond
111  * to the low 4 bytes of the 8 byte attribute quantity, see
112  * the header for their location.
113  */
114 #define icReflective                    0x00000000L     /* Bit pos 0 */
115 #define icTransparency                  0x00000001L     /* Bit pos 0 */
116 #define icGlossy                        0x00000000L     /* Bit pos 1 */
117 #define icMatte                         0x00000002L     /* Bit pos 1 */
118 
119 /*
120  * Profile header flags, the low 16 bits are reserved for consortium
121  * use.
122  */
123 #define icEmbeddedProfileFalse          0x00000000L     /* Bit pos 0 */
124 #define icEmbeddedProfileTrue           0x00000001L     /* Bit pos 0 */
125 #define icUseAnywhere                   0x00000000L     /* Bit pos 1 */
126 #define icUseWithEmbeddedDataOnly       0x00000002L     /* Bit pos 1 */
127 
128 /* Ascii or Binary data */
129 #define icAsciiData                     0x00000000L
130 #define icBinaryData                    0x00000001L
131 
132 /*
133  * Define used to indicate that this is a variable length array
134  */
135 #define icAny                           1
136 
137 
138 /*------------------------------------------------------------------------*/
139 /*
140  * Use this area to translate platform definitions of long
141  * etc into icXXX form. The rest of the header uses the icXXX
142  * typedefs. Signatures are 4 byte quantities.
143  *
144  */
145 
146 
147 #ifdef PACKAGE_NAME
148 /*
149   June 9, 2003, Adapted for use with configure by Bob Friesenhahn
150   Added the stupid check for autoconf by Marti Maria.
151   PACKAGE_NAME is defined if autoconf is being used
152 */
153 
154 typedef @UINT8_T@	icUInt8Number;
155 typedef @UINT16_T@	icUInt16Number;
156 typedef @UINT32_T@	icUInt32Number;
157 typedef @UINT32_T@	icUInt64Number[2];
158 
159 typedef @INT8_T@	icInt8Number;
160 typedef @INT16_T@	icInt16Number;
161 typedef @INT32_T@	icInt32Number;
162 typedef @INT32_T@	icInt64Number[2];
163 
164 #elif defined (__digital__) && defined (__unix__)
165 
166 /*
167  *Apr-17-2002: Modified by Marti Maria in order to provide wider portability.
168  */
169 
170 /* Tru64 */
171 
172 #include <inttypes.h>
173 
174 typedef uint8_t   icUInt8Number;
175 typedef uint16_t  icUInt16Number;
176 typedef uint32_t  icUInt32Number;
177 typedef uint32_t  icUInt64Number[2];
178 
179 typedef int8_t     icInt8Number;
180 typedef int16_t    icInt16Number;
181 typedef int32_t    icInt32Number;
182 typedef int32_t    icInt64Number[2];
183 
184 #elif defined(__sgi)
185 #include "sgidefs.h"
186 
187 
188 /*
189  * Number definitions
190  */
191 
192 /* Unsigned integer numbers */
193 typedef unsigned char   icUInt8Number;
194 typedef unsigned short  icUInt16Number;
195 typedef __uint32_t      icUInt32Number;
196 typedef __uint32_t      icUInt64Number[2];
197 
198 /* Signed numbers */
199 typedef char            icInt8Number;
200 typedef short           icInt16Number;
201 typedef __int32_t       icInt32Number;
202 typedef __int32_t       icInt64Number[2];
203 
204 
205 #elif defined(__GNUC__) || defined(__unix__) || defined(__unix)
206 
207 #include <sys/types.h>
208 
209 #if defined(__sun) || defined(__hpux) || defined (__MINGW) || defined(__MINGW32__) || defined(HAVE_STDINT_H)
210 
211 #if defined (__MINGW) || defined(__MINGW32__) || defined(HAVE_STDINT_H)
212 #include <stdint.h>
213 #endif
214 
215 
216 typedef uint8_t   icUInt8Number;
217 typedef uint16_t  icUInt16Number;
218 typedef uint32_t  icUInt32Number;
219 typedef uint32_t  icUInt64Number[2];
220 
221 #else
222 
223 /* Unsigned integer numbers */
224 typedef u_int8_t   icUInt8Number;
225 typedef u_int16_t  icUInt16Number;
226 typedef u_int32_t  icUInt32Number;
227 typedef u_int32_t  icUInt64Number[2];
228 
229 #endif /* defined(__sun) || defined(__hpux) || defined (__MINGW) || defined(__MINGW32__) || defined(HAVE_STDINT_H) */
230 
231 
232 /* Signed numbers */
233 typedef int8_t     icInt8Number;
234 typedef int16_t    icInt16Number;
235 typedef int32_t    icInt32Number;
236 typedef int32_t    icInt64Number[2];
237 
238 
239 #else /* default definitions */
240 
241 /*
242  * Number definitions
243  */
244 
245 /* Unsigned integer numbers */
246 typedef unsigned char   icUInt8Number;
247 typedef unsigned short  icUInt16Number;
248 typedef unsigned long   icUInt32Number;
249 typedef unsigned long   icUInt64Number[2];
250 
251 /* Signed numbers */
252 typedef char            icInt8Number;
253 typedef short           icInt16Number;
254 typedef long            icInt32Number;
255 typedef long            icInt64Number[2];
256 
257 
258 #endif  /* default defs */
259 
260 /* Base types */
261 
262 typedef icInt32Number    icSignature;
263 typedef icInt32Number    icS15Fixed16Number;
264 typedef icUInt32Number   icU16Fixed16Number;
265 
266 
267 /*------------------------------------------------------------------------*/
268 /* public tags and sizes */
269 typedef enum {
270     icSigAToB0Tag                       = 0x41324230L,  /* 'A2B0' */
271     icSigAToB1Tag                       = 0x41324231L,  /* 'A2B1' */
272     icSigAToB2Tag                       = 0x41324232L,  /* 'A2B2' */
273     icSigBlueColorantTag                = 0x6258595AL,  /* 'bXYZ' */
274     icSigBlueTRCTag                     = 0x62545243L,  /* 'bTRC' */
275     icSigBToA0Tag                       = 0x42324130L,  /* 'B2A0' */
276     icSigBToA1Tag                       = 0x42324131L,  /* 'B2A1' */
277     icSigBToA2Tag                       = 0x42324132L,  /* 'B2A2' */
278     icSigCalibrationDateTimeTag         = 0x63616C74L,  /* 'calt' */
279     icSigCharTargetTag                  = 0x74617267L,  /* 'targ' */
280     icSigCopyrightTag                   = 0x63707274L,  /* 'cprt' */
281     icSigCrdInfoTag                     = 0x63726469L,  /* 'crdi' */
282     icSigDeviceMfgDescTag               = 0x646D6E64L,  /* 'dmnd' */
283     icSigDeviceModelDescTag             = 0x646D6464L,  /* 'dmdd' */
284     icSigGamutTag                       = 0x67616D74L,  /* 'gamt ' */
285     icSigGrayTRCTag                     = 0x6b545243L,  /* 'kTRC' */
286     icSigGreenColorantTag               = 0x6758595AL,  /* 'gXYZ' */
287     icSigGreenTRCTag                    = 0x67545243L,  /* 'gTRC' */
288     icSigLuminanceTag                   = 0x6C756d69L,  /* 'lumi' */
289     icSigMeasurementTag                 = 0x6D656173L,  /* 'meas' */
290     icSigMediaBlackPointTag             = 0x626B7074L,  /* 'bkpt' */
291     icSigMediaWhitePointTag             = 0x77747074L,  /* 'wtpt' */
292     icSigNamedColorTag                  = 0x6E636f6CL,  /* 'ncol'
293                                                          * OBSOLETE, use ncl2 */
294     icSigNamedColor2Tag                 = 0x6E636C32L,  /* 'ncl2' */
295     icSigPreview0Tag                    = 0x70726530L,  /* 'pre0' */
296     icSigPreview1Tag                    = 0x70726531L,  /* 'pre1' */
297     icSigPreview2Tag                    = 0x70726532L,  /* 'pre2' */
298     icSigProfileDescriptionTag          = 0x64657363L,  /* 'desc' */
299     icSigProfileSequenceDescTag         = 0x70736571L,  /* 'pseq' */
300     icSigPs2CRD0Tag                     = 0x70736430L,  /* 'psd0' */
301     icSigPs2CRD1Tag                     = 0x70736431L,  /* 'psd1' */
302     icSigPs2CRD2Tag                     = 0x70736432L,  /* 'psd2' */
303     icSigPs2CRD3Tag                     = 0x70736433L,  /* 'psd3' */
304     icSigPs2CSATag                      = 0x70733273L,  /* 'ps2s' */
305     icSigPs2RenderingIntentTag          = 0x70733269L,  /* 'ps2i' */
306     icSigRedColorantTag                 = 0x7258595AL,  /* 'rXYZ' */
307     icSigRedTRCTag                      = 0x72545243L,  /* 'rTRC' */
308     icSigScreeningDescTag               = 0x73637264L,  /* 'scrd' */
309     icSigScreeningTag                   = 0x7363726EL,  /* 'scrn' */
310     icSigTechnologyTag                  = 0x74656368L,  /* 'tech' */
311     icSigUcrBgTag                       = 0x62666420L,  /* 'bfd ' */
312     icSigViewingCondDescTag             = 0x76756564L,  /* 'vued' */
313     icSigViewingConditionsTag           = 0x76696577L,  /* 'view' */
314     icMaxEnumTag                        = 0xFFFFFFFFL
315 } icTagSignature;
316 
317 /* technology signature descriptions */
318 typedef enum {
319     icSigDigitalCamera                  = 0x6463616DL,  /* 'dcam' */
320     icSigFilmScanner                    = 0x6673636EL,  /* 'fscn' */
321     icSigReflectiveScanner              = 0x7273636EL,  /* 'rscn' */
322     icSigInkJetPrinter                  = 0x696A6574L,  /* 'ijet' */
323     icSigThermalWaxPrinter              = 0x74776178L,  /* 'twax' */
324     icSigElectrophotographicPrinter     = 0x6570686FL,  /* 'epho' */
325     icSigElectrostaticPrinter           = 0x65737461L,  /* 'esta' */
326     icSigDyeSublimationPrinter          = 0x64737562L,  /* 'dsub' */
327     icSigPhotographicPaperPrinter       = 0x7270686FL,  /* 'rpho' */
328     icSigFilmWriter                     = 0x6670726EL,  /* 'fprn' */
329     icSigVideoMonitor                   = 0x7669646DL,  /* 'vidm' */
330     icSigVideoCamera                    = 0x76696463L,  /* 'vidc' */
331     icSigProjectionTelevision           = 0x706A7476L,  /* 'pjtv' */
332     icSigCRTDisplay                     = 0x43525420L,  /* 'CRT ' */
333     icSigPMDisplay                      = 0x504D4420L,  /* 'PMD ' */
334     icSigAMDisplay                      = 0x414D4420L,  /* 'AMD ' */
335     icSigPhotoCD                        = 0x4B504344L,  /* 'KPCD' */
336     icSigPhotoImageSetter               = 0x696D6773L,  /* 'imgs' */
337     icSigGravure                        = 0x67726176L,  /* 'grav' */
338     icSigOffsetLithography              = 0x6F666673L,  /* 'offs' */
339     icSigSilkscreen                     = 0x73696C6BL,  /* 'silk' */
340     icSigFlexography                    = 0x666C6578L,  /* 'flex' */
341     icMaxEnumTechnology                 = 0xFFFFFFFFL
342 } icTechnologySignature;
343 
344 /* type signatures */
345 typedef enum {
346     icSigCurveType                      = 0x63757276L,  /* 'curv' */
347     icSigDataType                       = 0x64617461L,  /* 'data' */
348     icSigDateTimeType                   = 0x6474696DL,  /* 'dtim' */
349     icSigLut16Type                      = 0x6d667432L,  /* 'mft2' */
350     icSigLut8Type                       = 0x6d667431L,  /* 'mft1' */
351     icSigMeasurementType                = 0x6D656173L,  /* 'meas' */
352     icSigNamedColorType                 = 0x6E636f6CL,  /* 'ncol'
353                                                          * OBSOLETE, use ncl2 */
354     icSigProfileSequenceDescType        = 0x70736571L,  /* 'pseq' */
355     icSigS15Fixed16ArrayType            = 0x73663332L,  /* 'sf32' */
356     icSigScreeningType                  = 0x7363726EL,  /* 'scrn' */
357     icSigSignatureType                  = 0x73696720L,  /* 'sig ' */
358     icSigTextType                       = 0x74657874L,  /* 'text' */
359     icSigTextDescriptionType            = 0x64657363L,  /* 'desc' */
360     icSigU16Fixed16ArrayType            = 0x75663332L,  /* 'uf32' */
361     icSigUcrBgType                      = 0x62666420L,  /* 'bfd ' */
362     icSigUInt16ArrayType                = 0x75693136L,  /* 'ui16' */
363     icSigUInt32ArrayType                = 0x75693332L,  /* 'ui32' */
364     icSigUInt64ArrayType                = 0x75693634L,  /* 'ui64' */
365     icSigUInt8ArrayType                 = 0x75693038L,  /* 'ui08' */
366     icSigViewingConditionsType          = 0x76696577L,  /* 'view' */
367     icSigXYZType                        = 0x58595A20L,  /* 'XYZ ' */
368     icSigXYZArrayType                   = 0x58595A20L,  /* 'XYZ ' */
369     icSigNamedColor2Type                = 0x6E636C32L,  /* 'ncl2' */
370     icSigCrdInfoType                    = 0x63726469L,  /* 'crdi' */
371     icMaxEnumType                       = 0xFFFFFFFFL
372 } icTagTypeSignature;
373 
374 /*
375  * Color Space Signatures
376  * Note that only icSigXYZData and icSigLabData are valid
377  * Profile Connection Spaces (PCSs)
378  */
379 typedef enum {
380     icSigXYZData                        = 0x58595A20L,  /* 'XYZ ' */
381     icSigLabData                        = 0x4C616220L,  /* 'Lab ' */
382     icSigLuvData                        = 0x4C757620L,  /* 'Luv ' */
383     icSigYCbCrData                      = 0x59436272L,  /* 'YCbr' */
384     icSigYxyData                        = 0x59787920L,  /* 'Yxy ' */
385     icSigRgbData                        = 0x52474220L,  /* 'RGB ' */
386     icSigGrayData                       = 0x47524159L,  /* 'GRAY' */
387     icSigHsvData                        = 0x48535620L,  /* 'HSV ' */
388     icSigHlsData                        = 0x484C5320L,  /* 'HLS ' */
389     icSigCmykData                       = 0x434D594BL,  /* 'CMYK' */
390     icSigCmyData                        = 0x434D5920L,  /* 'CMY ' */
391     icSig2colorData                     = 0x32434C52L,  /* '2CLR' */
392     icSig3colorData                     = 0x33434C52L,  /* '3CLR' */
393     icSig4colorData                     = 0x34434C52L,  /* '4CLR' */
394     icSig5colorData                     = 0x35434C52L,  /* '5CLR' */
395     icSig6colorData                     = 0x36434C52L,  /* '6CLR' */
396     icSig7colorData                     = 0x37434C52L,  /* '7CLR' */
397     icSig8colorData                     = 0x38434C52L,  /* '8CLR' */
398     icSig9colorData                     = 0x39434C52L,  /* '9CLR' */
399     icSig10colorData                    = 0x41434C52L,  /* 'ACLR' */
400     icSig11colorData                    = 0x42434C52L,  /* 'BCLR' */
401     icSig12colorData                    = 0x43434C52L,  /* 'CCLR' */
402     icSig13colorData                    = 0x44434C52L,  /* 'DCLR' */
403     icSig14colorData                    = 0x45434C52L,  /* 'ECLR' */
404     icSig15colorData                    = 0x46434C52L,  /* 'FCLR' */
405     icMaxEnumData                       = 0xFFFFFFFFL
406 } icColorSpaceSignature;
407 
408 /* profileClass enumerations */
409 typedef enum {
410     icSigInputClass                     = 0x73636E72L,  /* 'scnr' */
411     icSigDisplayClass                   = 0x6D6E7472L,  /* 'mntr' */
412     icSigOutputClass                    = 0x70727472L,  /* 'prtr' */
413     icSigLinkClass                      = 0x6C696E6BL,  /* 'link' */
414     icSigAbstractClass                  = 0x61627374L,  /* 'abst' */
415     icSigColorSpaceClass                = 0x73706163L,  /* 'spac' */
416     icSigNamedColorClass                = 0x6e6d636cL,  /* 'nmcl' */
417     icMaxEnumClass                      = 0xFFFFFFFFL
418 } icProfileClassSignature;
419 
420 /* Platform Signatures */
421 typedef enum {
422     icSigMacintosh                      = 0x4150504CL,  /* 'APPL' */
423     icSigMicrosoft                      = 0x4D534654L,  /* 'MSFT' */
424     icSigSolaris                        = 0x53554E57L,  /* 'SUNW' */
425     icSigSGI                            = 0x53474920L,  /* 'SGI ' */
426     icSigTaligent                       = 0x54474E54L,  /* 'TGNT' */
427     icMaxEnumPlatform                   = 0xFFFFFFFFL
428 } icPlatformSignature;
429 
430 /*------------------------------------------------------------------------*/
431 /*
432  * Other enums
433  */
434 
435 /* Measurement Flare, used in the measurmentType tag */
436 typedef enum {
437     icFlare0                            = 0x00000000L,  /* 0% flare */
438     icFlare100                          = 0x00000001L,  /* 100% flare */
439     icMaxFlare                          = 0xFFFFFFFFL
440 } icMeasurementFlare;
441 
442 /* Measurement Geometry, used in the measurmentType tag */
443 typedef enum {
444     icGeometryUnknown                   = 0x00000000L,  /* Unknown */
445     icGeometry045or450                  = 0x00000001L,  /* 0/45, 45/0 */
446     icGeometry0dord0                    = 0x00000002L,  /* 0/d or d/0 */
447     icMaxGeometry                       = 0xFFFFFFFFL
448 } icMeasurementGeometry;
449 
450 /* Rendering Intents, used in the profile header */
451 typedef enum {
452     icPerceptual                        = 0,
453     icRelativeColorimetric              = 1,
454     icSaturation                        = 2,
455     icAbsoluteColorimetric              = 3,
456     icMaxEnumIntent                     = 0xFFFFFFFFL
457 } icRenderingIntent;
458 
459 /* Different Spot Shapes currently defined, used for screeningType */
460 typedef enum {
461     icSpotShapeUnknown                  = 0,
462     icSpotShapePrinterDefault           = 1,
463     icSpotShapeRound                    = 2,
464     icSpotShapeDiamond                  = 3,
465     icSpotShapeEllipse                  = 4,
466     icSpotShapeLine                     = 5,
467     icSpotShapeSquare                   = 6,
468     icSpotShapeCross                    = 7,
469     icMaxEnumSpot                       = 0xFFFFFFFFL
470 } icSpotShape;
471 
472 /* Standard Observer, used in the measurmentType tag */
473 typedef enum {
474     icStdObsUnknown                     = 0x00000000L,  /* Unknown */
475     icStdObs1931TwoDegrees              = 0x00000001L,  /* 2 deg */
476     icStdObs1964TenDegrees              = 0x00000002L,  /* 10 deg */
477     icMaxStdObs                         = 0xFFFFFFFFL
478 } icStandardObserver;
479 
480 /* Pre-defined illuminants, used in measurement and viewing conditions type */
481 typedef enum {
482     icIlluminantUnknown                 = 0x00000000L,
483     icIlluminantD50                     = 0x00000001L,
484     icIlluminantD65                     = 0x00000002L,
485     icIlluminantD93                     = 0x00000003L,
486     icIlluminantF2                      = 0x00000004L,
487     icIlluminantD55                     = 0x00000005L,
488     icIlluminantA                       = 0x00000006L,
489     icIlluminantEquiPowerE              = 0x00000007L,
490     icIlluminantF8                      = 0x00000008L,
491     icMaxEnumIluminant                  = 0xFFFFFFFFL
492 } icIlluminant;
493 
494 
495 /*------------------------------------------------------------------------*/
496 /*
497  * Arrays of numbers
498  */
499 
500 /* Int8 Array */
501 typedef struct {
502     icInt8Number        data[icAny];    /* Variable array of values */
503 } icInt8Array;
504 
505 /* UInt8 Array */
506 typedef struct {
507     icUInt8Number       data[icAny];    /* Variable array of values */
508 } icUInt8Array;
509 
510 /* uInt16 Array */
511 typedef struct {
512     icUInt16Number      data[icAny];    /* Variable array of values */
513 } icUInt16Array;
514 
515 /* Int16 Array */
516 typedef struct {
517     icInt16Number       data[icAny];    /* Variable array of values */
518 } icInt16Array;
519 
520 /* uInt32 Array */
521 typedef struct {
522     icUInt32Number      data[icAny];    /* Variable array of values */
523 } icUInt32Array;
524 
525 /* Int32 Array */
526 typedef struct {
527     icInt32Number       data[icAny];    /* Variable array of values */
528 } icInt32Array;
529 
530 /* UInt64 Array */
531 typedef struct {
532     icUInt64Number      data[icAny];    /* Variable array of values */
533 } icUInt64Array;
534 
535 /* Int64 Array */
536 typedef struct {
537     icInt64Number       data[icAny];    /* Variable array of values */
538 } icInt64Array;
539 
540 /* u16Fixed16 Array */
541 typedef struct {
542     icU16Fixed16Number  data[icAny];    /* Variable array of values */
543 } icU16Fixed16Array;
544 
545 /* s15Fixed16 Array */
546 typedef struct {
547     icS15Fixed16Number  data[icAny];    /* Variable array of values */
548 } icS15Fixed16Array;
549 
550 /* The base date time number */
551 typedef struct {
552     icUInt16Number      year;
553     icUInt16Number      month;
554     icUInt16Number      day;
555     icUInt16Number      hours;
556     icUInt16Number      minutes;
557     icUInt16Number      seconds;
558 } icDateTimeNumber;
559 
560 /* XYZ Number  */
561 typedef struct {
562     icS15Fixed16Number  X;
563     icS15Fixed16Number  Y;
564     icS15Fixed16Number  Z;
565 } icXYZNumber;
566 
567 /* XYZ Array */
568 typedef struct {
569     icXYZNumber         data[icAny];    /* Variable array of XYZ numbers */
570 } icXYZArray;
571 
572 /* Curve */
573 typedef struct {
574     icUInt32Number      count;          /* Number of entries */
575     icUInt16Number      data[icAny];    /* The actual table data, real
576                                          * number is determined by count
577                                          * Interpretation depends on how
578                                          * data is used with a given tag
579                                          */
580 } icCurve;
581 
582 /* Data */
583 typedef struct {
584     icUInt32Number      dataFlag;       /* 0 = ascii, 1 = binary */
585     icInt8Number        data[icAny];    /* Data, size from tag */
586 } icData;
587 
588 /* lut16 */
589 typedef struct {
590     icUInt8Number       inputChan;      /* Number of input channels */
591     icUInt8Number       outputChan;     /* Number of output channels */
592     icUInt8Number       clutPoints;     /* Number of grid points */
593     icInt8Number        pad;            /* Padding for byte alignment */
594     icS15Fixed16Number  e00;            /* e00 in the 3 * 3 */
595     icS15Fixed16Number  e01;            /* e01 in the 3 * 3 */
596     icS15Fixed16Number  e02;            /* e02 in the 3 * 3 */
597     icS15Fixed16Number  e10;            /* e10 in the 3 * 3 */
598     icS15Fixed16Number  e11;            /* e11 in the 3 * 3 */
599     icS15Fixed16Number  e12;            /* e12 in the 3 * 3 */
600     icS15Fixed16Number  e20;            /* e20 in the 3 * 3 */
601     icS15Fixed16Number  e21;            /* e21 in the 3 * 3 */
602     icS15Fixed16Number  e22;            /* e22 in the 3 * 3 */
603     icUInt16Number      inputEnt;       /* Num of in-table entries */
604     icUInt16Number      outputEnt;      /* Num of out-table entries */
605     icUInt16Number      data[icAny];    /* Data follows see spec */
606 /*
607  *  Data that follows is of this form
608  *
609  *  icUInt16Number      inputTable[inputChan][icAny];   * The in-table
610  *  icUInt16Number      clutTable[icAny];               * The clut
611  *  icUInt16Number      outputTable[outputChan][icAny]; * The out-table
612  */
613 } icLut16;
614 
615 /* lut8, input & output tables are always 256 bytes in length */
616 typedef struct {
617     icUInt8Number       inputChan;      /* Num of input channels */
618     icUInt8Number       outputChan;     /* Num of output channels */
619     icUInt8Number       clutPoints;     /* Num of grid points */
620     icInt8Number        pad;
621     icS15Fixed16Number  e00;            /* e00 in the 3 * 3 */
622     icS15Fixed16Number  e01;            /* e01 in the 3 * 3 */
623     icS15Fixed16Number  e02;            /* e02 in the 3 * 3 */
624     icS15Fixed16Number  e10;            /* e10 in the 3 * 3 */
625     icS15Fixed16Number  e11;            /* e11 in the 3 * 3 */
626     icS15Fixed16Number  e12;            /* e12 in the 3 * 3 */
627     icS15Fixed16Number  e20;            /* e20 in the 3 * 3 */
628     icS15Fixed16Number  e21;            /* e21 in the 3 * 3 */
629     icS15Fixed16Number  e22;            /* e22 in the 3 * 3 */
630     icUInt8Number       data[icAny];    /* Data follows see spec */
631 /*
632  *  Data that follows is of this form
633  *
634  *  icUInt8Number       inputTable[inputChan][256];     * The in-table
635  *  icUInt8Number       clutTable[icAny];               * The clut
636  *  icUInt8Number       outputTable[outputChan][256];   * The out-table
637  */
638 } icLut8;
639 
640 /* Measurement Data */
641 typedef struct {
642     icStandardObserver          stdObserver;    /* Standard observer */
643     icXYZNumber                 backing;        /* XYZ for backing */
644     icMeasurementGeometry       geometry;       /* Meas. geometry */
645     icMeasurementFlare          flare;          /* Measurement flare */
646     icIlluminant                illuminant;     /* Illuminant */
647 } icMeasurement;
648 
649 /* Named color */
650 
651 /*
652  * icNamedColor2 takes the place of icNamedColor
653  */
654 typedef struct {
655     icUInt32Number      vendorFlag;     /* Bottom 16 bits for IC use */
656     icUInt32Number      count;          /* Count of named colors */
657     icUInt32Number      nDeviceCoords;  /* Num of device coordinates */
658     icInt8Number        prefix[32];     /* Prefix for each color name */
659     icInt8Number        suffix[32];     /* Suffix for each color name */
660     icInt8Number        data[icAny];    /* Named color data follows */
661 /*
662  *  Data that follows is of this form
663  *
664  * icInt8Number         root1[32];              * Root name for 1st color
665  * icUInt16Number       pcsCoords1[icAny];      * PCS coords of 1st color
666  * icUInt16Number       deviceCoords1[icAny];   * Dev coords of 1st color
667  * icInt8Number         root2[32];              * Root name for 2nd color
668  * icUInt16Number       pcsCoords2[icAny];      * PCS coords of 2nd color
669  * icUInt16Number       deviceCoords2[icAny];   * Dev coords of 2nd color
670  *                      :
671  *                      :
672  * Repeat for name and PCS and device color coordinates up to (count-1)
673  *
674  * NOTES:
675  * PCS and device space can be determined from the header.
676  *
677  * PCS coordinates are icUInt16 numbers and are described in Annex A of
678  * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of
679  * coordinates is consistent with the headers PCS.
680  *
681  * Device coordinates are icUInt16 numbers where 0x0000 represents
682  * the minimum value and 0xFFFF represents the maximum value.
683  * If the nDeviceCoords value is 0 this field is not given.
684  */
685 } icNamedColor2;
686 
687 /* Profile sequence structure */
688 typedef struct {
689     icSignature                 deviceMfg;      /* Dev Manufacturer */
690     icSignature                 deviceModel;    /* Dev Model */
691     icUInt64Number              attributes;     /* Dev attributes */
692     icTechnologySignature       technology;     /* Technology sig */
693     icInt8Number                data[icAny];    /* Desc text follows */
694 /*
695  *  Data that follows is of this form, this is an icInt8Number
696  *  to avoid problems with a compiler generating  bad code as
697  *  these arrays are variable in length.
698  *
699  * icTextDescription            deviceMfgDesc;  * Manufacturer text
700  * icTextDescription            modelDesc;      * Model text
701  */
702 } icDescStruct;
703 
704 /* Profile sequence description */
705 typedef struct {
706     icUInt32Number      count;          /* Number of descriptions */
707     icUInt8Number       data[icAny];    /* Array of desc structs */
708 } icProfileSequenceDesc;
709 
710 /* textDescription */
711 typedef struct {
712     icUInt32Number      count;          /* Description length */
713     icInt8Number        data[icAny];    /* Descriptions follow */
714 /*
715  *  Data that follows is of this form
716  *
717  * icInt8Number         desc[count]     * NULL terminated ascii string
718  * icUInt32Number       ucLangCode;     * UniCode language code
719  * icUInt32Number       ucCount;        * UniCode description length
720  * icInt16Number        ucDesc[ucCount];* The UniCode description
721  * icUInt16Number       scCode;         * ScriptCode code
722  * icUInt8Number        scCount;        * ScriptCode count
723  * icInt8Number         scDesc[67];     * ScriptCode Description
724  */
725 } icTextDescription;
726 
727 /* Screening Data */
728 typedef struct {
729     icS15Fixed16Number  frequency;      /* Frequency */
730     icS15Fixed16Number  angle;          /* Screen angle */
731     icSpotShape         spotShape;      /* Spot Shape encodings below */
732 } icScreeningData;
733 
734 typedef struct {
735     icUInt32Number      screeningFlag;  /* Screening flag */
736     icUInt32Number      channels;       /* Number of channels */
737     icScreeningData     data[icAny];    /* Array of screening data */
738 } icScreening;
739 
740 /* Text Data */
741 typedef struct {
742     icInt8Number        data[icAny];    /* Variable array of chars */
743 } icText;
744 
745 /* Structure describing either a UCR or BG curve */
746 typedef struct {
747     icUInt32Number      count;          /* Curve length */
748     icUInt16Number      curve[icAny];   /* The array of curve values */
749 } icUcrBgCurve;
750 
751 /* Under color removal, black generation */
752 typedef struct {
753     icInt8Number        data[icAny];            /* The Ucr BG data */
754 /*
755  *  Data that follows is of this form, this is a icInt8Number
756  *  to avoid problems with a compiler generating  bad code as
757  *  these arrays are variable in length.
758  *
759  * icUcrBgCurve         ucr;            * Ucr curve
760  * icUcrBgCurve         bg;             * Bg curve
761  * icInt8Number         string;         * UcrBg description
762  */
763 } icUcrBg;
764 
765 /* viewingConditionsType */
766 typedef struct {
767     icXYZNumber         illuminant;     /* In candelas per sq. meter */
768     icXYZNumber         surround;       /* In candelas per sq. meter */
769     icIlluminant        stdIluminant;   /* See icIlluminant defines */
770 } icViewingCondition;
771 
772 /* CrdInfo type */
773 typedef struct {
774     icUInt32Number      count;          /* Char count includes NULL */
775     icInt8Number        desc[icAny];    /* Null terminated string */
776 } icCrdInfo;
777 
778 /*------------------------------------------------------------------------*/
779 /*
780  * Tag Type definitions
781  */
782 
783 /*
784  * Many of the structures contain variable length arrays. This
785  * is represented by the use of the convention.
786  *
787  *      type    data[icAny];
788  */
789 
790 /* The base part of each tag */
791 typedef struct {
792     icTagTypeSignature  sig;            /* Signature */
793     icInt8Number        reserved[4];    /* Reserved, set to 0 */
794 } icTagBase;
795 
796 /* curveType */
797 typedef struct {
798     icTagBase           base;           /* Signature, "curv" */
799     icCurve             curve;          /* The curve data */
800 } icCurveType;
801 
802 /* dataType */
803 typedef struct {
804     icTagBase           base;           /* Signature, "data" */
805     icData              data;           /* The data structure */
806 } icDataType;
807 
808 /* dateTimeType */
809 typedef struct {
810     icTagBase           base;           /* Signature, "dtim" */
811     icDateTimeNumber    date;           /* The date */
812 } icDateTimeType;
813 
814 /* lut16Type */
815 typedef struct {
816     icTagBase           base;           /* Signature, "mft2" */
817     icLut16             lut;            /* Lut16 data */
818 } icLut16Type;
819 
820 /* lut8Type, input & output tables are always 256 bytes in length */
821 typedef struct {
822     icTagBase           base;           /* Signature, "mft1" */
823     icLut8              lut;            /* Lut8 data */
824 } icLut8Type;
825 
826 /* Measurement Type */
827 typedef struct {
828     icTagBase           base;           /* Signature, "meas" */
829     icMeasurement       measurement;    /* Measurement data */
830 } icMeasurementType;
831 
832 /* Named color type */
833 /* icNamedColor2Type, replaces icNamedColorType */
834 typedef struct {
835     icTagBase           base;           /* Signature, "ncl2" */
836     icNamedColor2       ncolor;         /* Named color data */
837 } icNamedColor2Type;
838 
839 /* Profile sequence description type */
840 typedef struct {
841     icTagBase                   base;   /* Signature, "pseq" */
842     icProfileSequenceDesc       desc;   /* The seq description */
843 } icProfileSequenceDescType;
844 
845 /* textDescriptionType */
846 typedef struct {
847     icTagBase                   base;   /* Signature, "desc" */
848     icTextDescription           desc;   /* The description */
849 } icTextDescriptionType;
850 
851 /* s15Fixed16Type */
852 typedef struct {
853     icTagBase           base;           /* Signature, "sf32" */
854     icS15Fixed16Array   data;           /* Array of values */
855 } icS15Fixed16ArrayType;
856 
857 typedef struct {
858     icTagBase           base;           /* Signature, "scrn" */
859     icScreening         screen;         /* Screening structure */
860 } icScreeningType;
861 
862 /* sigType */
863 typedef struct {
864     icTagBase           base;           /* Signature, "sig" */
865     icSignature         signature;      /* The signature data */
866 } icSignatureType;
867 
868 /* textType */
869 typedef struct {
870     icTagBase           base;           /* Signature, "text" */
871     icText              data;           /* Variable array of chars */
872 } icTextType;
873 
874 /* u16Fixed16Type */
875 typedef struct {
876     icTagBase           base;           /* Signature, "uf32" */
877     icU16Fixed16Array   data;           /* Variable array of values */
878 } icU16Fixed16ArrayType;
879 
880 /* Under color removal, black generation type */
881 typedef struct {
882     icTagBase           base;           /* Signature, "bfd " */
883     icUcrBg             data;           /* ucrBg structure */
884 } icUcrBgType;
885 
886 /* uInt16Type */
887 typedef struct {
888     icTagBase           base;           /* Signature, "ui16" */
889     icUInt16Array       data;           /* Variable array of values */
890 } icUInt16ArrayType;
891 
892 /* uInt32Type */
893 typedef struct {
894     icTagBase           base;           /* Signature, "ui32" */
895     icUInt32Array       data;           /* Variable array of values */
896 } icUInt32ArrayType;
897 
898 /* uInt64Type */
899 typedef struct {
900     icTagBase           base;           /* Signature, "ui64" */
901     icUInt64Array       data;           /* Variable array of values */
902 } icUInt64ArrayType;
903 
904 /* uInt8Type */
905 typedef struct {
906     icTagBase           base;           /* Signature, "ui08" */
907     icUInt8Array        data;           /* Variable array of values */
908 } icUInt8ArrayType;
909 
910 /* viewingConditionsType */
911 typedef struct {
912     icTagBase           base;           /* Signature, "view" */
913     icViewingCondition  view;           /* Viewing conditions */
914 } icViewingConditionType;
915 
916 /* XYZ Type */
917 typedef struct {
918     icTagBase           base;           /* Signature, "XYZ" */
919     icXYZArray          data;           /* Variable array of XYZ nums */
920 } icXYZType;
921 
922 /* CRDInfoType where [0] is the CRD product name count and string and
923  * [1] -[5] are the rendering intents 0-4 counts and strings
924  */
925 typedef struct {
926     icTagBase           base;           /* Signature, "crdi" */
927     icCrdInfo           info;           /* 5 sets of counts & strings */
928 }icCrdInfoType;
929      /*   icCrdInfo       productName;     PS product count/string */
930      /*   icCrdInfo       CRDName0;        CRD name for intent 0 */
931      /*   icCrdInfo       CRDName1;        CRD name for intent 1 */
932      /*   icCrdInfo       CRDName2;        CRD name for intent 2 */
933      /*   icCrdInfo       CRDName3;        CRD name for intent 3 */
934 
935 /*------------------------------------------------------------------------*/
936 
937 /*
938  * Lists of tags, tags, profile header and profile structure
939  */
940 
941 /* A tag */
942 typedef struct {
943     icTagSignature      sig;            /* The tag signature */
944     icUInt32Number      offset;         /* Start of tag relative to
945                                          * start of header, Spec
946                                          * Clause 5 */
947     icUInt32Number      size;           /* Size in bytes */
948 } icTag;
949 
950 /* A Structure that may be used independently for a list of tags */
951 typedef struct {
952     icUInt32Number      count;          /* Num tags in the profile */
953     icTag               tags[icAny];    /* Variable array of tags */
954 } icTagList;
955 
956 /* The Profile header */
957 typedef struct {
958     icUInt32Number              size;           /* Prof size in bytes */
959     icSignature                 cmmId;          /* CMM for profile */
960     icUInt32Number              version;        /* Format version */
961     icProfileClassSignature     deviceClass;    /* Type of profile */
962     icColorSpaceSignature       colorSpace;     /* Clr space of data */
963     icColorSpaceSignature       pcs;            /* PCS, XYZ or Lab */
964     icDateTimeNumber            date;           /* Creation Date */
965     icSignature                 magic;          /* icMagicNumber */
966     icPlatformSignature         platform;       /* Primary Platform */
967     icUInt32Number              flags;          /* Various bits */
968     icSignature                 manufacturer;   /* Dev manufacturer */
969     icUInt32Number              model;          /* Dev model number */
970     icUInt64Number              attributes;     /* Device attributes */
971     icUInt32Number              renderingIntent;/* Rendering intent */
972     icXYZNumber                 illuminant;     /* Profile illuminant */
973     icSignature                 creator;        /* Profile creator */
974     icInt8Number                reserved[44];   /* Reserved */
975 } icHeader;
976 
977 /*
978  * A profile,
979  * we can't use icTagList here because its not at the end of the structure
980  */
981 typedef struct {
982     icHeader            header;         /* The header */
983     icUInt32Number      count;          /* Num tags in the profile */
984     icInt8Number        data[icAny];    /* The tagTable and tagData */
985 /*
986  * Data that follows is of the form
987  *
988  * icTag        tagTable[icAny];        * The tag table
989  * icInt8Number tagData[icAny];         * The tag data
990  */
991 } icProfile;
992 
993 /*------------------------------------------------------------------------*/
994 /* Obsolete entries */
995 
996 /* icNamedColor was replaced with icNamedColor2 */
997 typedef struct {
998     icUInt32Number      vendorFlag;     /* Bottom 16 bits for IC use */
999     icUInt32Number      count;          /* Count of named colors */
1000     icInt8Number        data[icAny];    /* Named color data follows */
1001 /*
1002  *  Data that follows is of this form
1003  *
1004  * icInt8Number         prefix[icAny];  * Prefix
1005  * icInt8Number         suffix[icAny];  * Suffix
1006  * icInt8Number         root1[icAny];   * Root name
1007  * icInt8Number         coords1[icAny]; * Color coordinates
1008  * icInt8Number         root2[icAny];   * Root name
1009  * icInt8Number         coords2[icAny]; * Color coordinates
1010  *                      :
1011  *                      :
1012  * Repeat for root name and color coordinates up to (count-1)
1013  */
1014 } icNamedColor;
1015 
1016 /* icNamedColorType was replaced by icNamedColor2Type */
1017 typedef struct {
1018     icTagBase           base;           /* Signature, "ncol" */
1019     icNamedColor        ncolor;         /* Named color data */
1020 } icNamedColorType;
1021 
1022 #endif /* ICC_H */
1023