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