lcms2_sys/
ffi.rs

1#![allow(dead_code,
2         non_camel_case_types,
3         non_upper_case_globals,
4         non_snake_case)]
5
6//!  Little Color Management System
7//!  Copyright (c) 1998-2014 Marti Maria Saguer
8//!
9//! Permission is hereby granted, free of charge, to any person obtaining
10//! a copy of this software and associated documentation files (the "Software"),
11//! to deal in the Software without restriction, including without limitation
12//! the rights to use, copy, modify, merge, publish, distribute, sublicense,
13//! and/or sell copies of the Software, and to permit persons to whom the Software
14//! is furnished to do so, subject to the following conditions:
15//!
16//! The above copyright notice and this permission notice shall be included in
17//! all copies or substantial portions of the Software.
18//!
19//! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20//! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21//! THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22//! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23//! LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24//! OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25//! WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26//!
27//!---------------------------------------------------------------------------------
28//!
29//! Version 2.16
30
31use std::os::raw::{c_char, c_int, c_long, c_void};
32#[doc(hidden)]
33use libc;
34use std::mem::MaybeUninit;
35use libc::FILE;
36use std::default::Default;
37
38// That one is missing in Rust's libc
39#[cfg(not(windows))]
40#[doc(hidden)]
41pub type tm = libc::tm;
42#[cfg(windows)]
43#[doc(hidden)]
44#[repr(C)]
45#[derive(Copy, Clone, PartialEq, Eq, Debug)]
46pub struct tm {
47    tm_sec: c_int,
48    tm_min: c_int,
49    tm_hour: c_int,
50    tm_mday: c_int,
51    tm_mon: c_int,
52    tm_year: c_int,
53    tm_wday: c_int,
54    tm_yday: c_int,
55    tm_isdst: c_int,
56}
57
58#[doc(hidden)]
59pub type wchar_t = libc::wchar_t;
60pub type Signature = u32;
61pub type S15Fixed16Number = i32;
62pub type Bool = c_int;
63
64
65/// D50 XYZ normalized to Y=1.0
66pub const D50X: f64 = 0.9642;
67pub const D50Y: f64 = 1.0;
68pub const D50Z: f64 = 0.8249;
69
70/// V4 perceptual black
71pub const PERCEPTUAL_BLACK_X: f64 = 0.00336;
72pub const PERCEPTUAL_BLACK_Y: f64 = 0.0034731;
73pub const PERCEPTUAL_BLACK_Z: f64 = 0.00287;
74
75/// Definitions in ICC spec
76/// 'acsp'
77pub const MagicNumber: Signature = 0x61637370;
78/// 'lcms'
79pub const lcmsSignature: Signature = 0x6c636d73;
80
81#[derive(Copy, Clone, PartialEq, Eq, Hash)]
82#[repr(u32)]
83#[derive(Debug)]
84#[non_exhaustive]
85pub enum TagTypeSignature {
86    /// 'chrm'
87    ChromaticityType                  = 0x6368726D,
88    /// 'clro'
89    ColorantOrderType                 = 0x636C726F,
90    /// 'clrt'
91    ColorantTableType                 = 0x636C7274,
92    /// 'crdi'
93    CrdInfoType                       = 0x63726469,
94    /// 'curv'
95    CurveType                         = 0x63757276,
96    /// 'data'
97    DataType                          = 0x64617461,
98    /// 'dict'
99    DictType                          = 0x64696374,
100    /// 'dtim'
101    DateTimeType                      = 0x6474696D,
102    /// 'devs'
103    DeviceSettingsType                = 0x64657673,
104    /// 'mft2'
105    Lut16Type                         = 0x6d667432,
106    /// 'mft1'
107    Lut8Type                          = 0x6d667431,
108    /// 'mAB '
109    LutAtoBType                       = 0x6d414220,
110    /// 'mBA '
111    LutBtoAType                       = 0x6d424120,
112    /// 'meas'
113    MeasurementType                   = 0x6D656173,
114    /// 'mluc'
115    MultiLocalizedUnicodeType         = 0x6D6C7563,
116    /// 'mpet'
117    MultiProcessElementType           = 0x6D706574,
118    /// 'ncol' -- DEPRECATED!
119    NamedColorType                    = 0x6E636F6C,
120    /// 'ncl2'
121    NamedColor2Type                   = 0x6E636C32,
122    /// 'para'
123    ParametricCurveType               = 0x70617261,
124    /// 'pseq'
125    ProfileSequenceDescType           = 0x70736571,
126    /// 'psid'
127    ProfileSequenceIdType             = 0x70736964,
128    /// 'rcs2'
129    ResponseCurveSet16Type            = 0x72637332,
130    /// 'sf32'
131    S15Fixed16ArrayType               = 0x73663332,
132    /// 'scrn'
133    ScreeningType                     = 0x7363726E,
134    /// 'sig '
135    SignatureType                     = 0x73696720,
136    /// 'text'
137    TextType                          = 0x74657874,
138    /// 'desc'
139    TextDescriptionType               = 0x64657363,
140    /// 'uf32'
141    U16Fixed16ArrayType               = 0x75663332,
142    /// 'bfd '
143    UcrBgType                         = 0x62666420,
144    /// 'ui16'
145    UInt16ArrayType                   = 0x75693136,
146    /// 'ui32'
147    UInt32ArrayType                   = 0x75693332,
148    /// 'ui64'
149    UInt64ArrayType                   = 0x75693634,
150    /// 'ui08'
151    UInt8ArrayType                    = 0x75693038,
152    /// 'vcgt'
153    VcgtType                          = 0x76636774,
154    /// 'view'
155    ViewingConditionsType             = 0x76696577,
156    /// 'XYZ '
157    XYZType                           = 0x58595A20,
158    /// `cicp`
159    CicpType                          = 0x63696370,
160    MHC2Type                          = 1296581426,
161}
162
163pub const BlueMatrixColumnTag: TagSignature = TagSignature::BlueColorantTag;
164pub const GreenMatrixColumnTag: TagSignature = TagSignature::GreenColorantTag;
165pub const RedMatrixColumnTag: TagSignature = TagSignature::RedColorantTag;
166
167#[derive(Copy, Clone, PartialEq, Eq, Hash)]
168#[repr(u32)]
169#[derive(Debug)]
170#[non_exhaustive]
171pub enum TagSignature {
172    /// 'A2B0'
173    AToB0Tag                          = 0x41324230,
174    /// 'A2B1'
175    AToB1Tag                          = 0x41324231,
176    /// 'A2B2'
177    AToB2Tag                          = 0x41324232,
178    /// 'bXYZ'
179    BlueColorantTag                   = 0x6258595A,
180    /// 'bTRC'
181    BlueTRCTag                        = 0x62545243,
182    /// 'B2A0'
183    BToA0Tag                          = 0x42324130,
184    /// 'B2A1'
185    BToA1Tag                          = 0x42324131,
186    /// 'B2A2'
187    BToA2Tag                          = 0x42324132,
188    /// 'calt'
189    CalibrationDateTimeTag            = 0x63616C74,
190    /// 'targ'
191    CharTargetTag                     = 0x74617267,
192    /// 'chad'
193    ChromaticAdaptationTag            = 0x63686164,
194    /// 'chrm'
195    ChromaticityTag                   = 0x6368726D,
196    /// 'clro'
197    ColorantOrderTag                  = 0x636C726F,
198    /// 'clrt'
199    ColorantTableTag                  = 0x636C7274,
200    /// 'clot'
201    ColorantTableOutTag               = 0x636C6F74,
202    /// 'ciis'
203    ColorimetricIntentImageStateTag   = 0x63696973,
204    /// 'cprt'
205    CopyrightTag                      = 0x63707274,
206    /// 'crdi'
207    CrdInfoTag                        = 0x63726469,
208    /// 'data'
209    DataTag                           = 0x64617461,
210    /// 'dtim'
211    DateTimeTag                       = 0x6474696D,
212    /// 'dmnd'
213    DeviceMfgDescTag                  = 0x646D6E64,
214    /// 'dmdd'
215    DeviceModelDescTag                = 0x646D6464,
216    /// 'devs'
217    DeviceSettingsTag                 = 0x64657673,
218    /// 'D2B0'
219    DToB0Tag                          = 0x44324230,
220    /// 'D2B1'
221    DToB1Tag                          = 0x44324231,
222    /// 'D2B2'
223    DToB2Tag                          = 0x44324232,
224    /// 'D2B3'
225    DToB3Tag                          = 0x44324233,
226    /// 'B2D0'
227    BToD0Tag                          = 0x42324430,
228    /// 'B2D1'
229    BToD1Tag                          = 0x42324431,
230    /// 'B2D2'
231    BToD2Tag                          = 0x42324432,
232    /// 'B2D3'
233    BToD3Tag                          = 0x42324433,
234    /// 'gamt'
235    GamutTag                          = 0x67616D74,
236    /// 'kTRC'
237    GrayTRCTag                        = 0x6b545243,
238    /// 'gXYZ'
239    GreenColorantTag                  = 0x6758595A,
240    /// 'gTRC'
241    GreenTRCTag                       = 0x67545243,
242    /// 'lumi'
243    LuminanceTag                      = 0x6C756D69,
244    /// 'meas'
245    MeasurementTag                    = 0x6D656173,
246    /// 'bkpt'
247    MediaBlackPointTag                = 0x626B7074,
248    /// 'wtpt'
249    MediaWhitePointTag                = 0x77747074,
250    /// 'ncol' // Deprecated by the ICC
251    NamedColorTag                     = 0x6E636F6C,
252    /// 'ncl2'
253    NamedColor2Tag                    = 0x6E636C32,
254    /// 'resp'
255    OutputResponseTag                 = 0x72657370,
256    /// 'rig0'
257    PerceptualRenderingIntentGamutTag = 0x72696730,
258    /// 'pre0'
259    Preview0Tag                       = 0x70726530,
260    /// 'pre1'
261    Preview1Tag                       = 0x70726531,
262    /// 'pre2'
263    Preview2Tag                       = 0x70726532,
264    /// 'desc'
265    ProfileDescriptionTag             = 0x64657363,
266    /// 'dscm'
267    ProfileDescriptionMLTag           = 0x6473636D,
268    /// 'pseq'
269    ProfileSequenceDescTag            = 0x70736571,
270    /// 'psid'
271    ProfileSequenceIdTag              = 0x70736964,
272    /// 'psd0'
273    Ps2CRD0Tag                        = 0x70736430,
274    /// 'psd1'
275    Ps2CRD1Tag                        = 0x70736431,
276    /// 'psd2'
277    Ps2CRD2Tag                        = 0x70736432,
278    /// 'psd3'
279    Ps2CRD3Tag                        = 0x70736433,
280    /// 'ps2s'
281    Ps2CSATag                         = 0x70733273,
282    /// 'ps2i'
283    Ps2RenderingIntentTag             = 0x70733269,
284    /// 'rXYZ'
285    RedColorantTag                    = 0x7258595A,
286    /// 'rTRC'
287    RedTRCTag                         = 0x72545243,
288    /// 'rig2'
289    SaturationRenderingIntentGamutTag = 0x72696732,
290    /// 'scrd'
291    ScreeningDescTag                  = 0x73637264,
292    /// 'scrn'
293    ScreeningTag                      = 0x7363726E,
294    /// 'tech'
295    TechnologyTag                     = 0x74656368,
296    /// 'bfd '
297    UcrBgTag                          = 0x62666420,
298    /// 'vued'
299    ViewingCondDescTag                = 0x76756564,
300    /// 'view'
301    ViewingConditionsTag              = 0x76696577,
302    /// 'vcgt'
303    VcgtTag                           = 0x76636774,
304    /// 'meta'
305    MetaTag                           = 0x6D657461,
306    /// 'arts'
307    ArgyllArtsTag                     = 0x61727473,
308    /// `cicp`
309    CicpTag                           = 0x63696370,
310    MHC2Tag                           = 1296581426,
311}
312
313#[derive(Copy, Clone, PartialEq, Eq, Hash)]
314#[repr(u32)]
315#[derive(Debug)]
316#[non_exhaustive]
317pub enum TechnologySignature {
318    /// 'dcam'
319    DigitalCamera                     = 0x6463616D,
320    /// 'fscn'
321    FilmScanner                       = 0x6673636E,
322    /// 'rscn'
323    ReflectiveScanner                 = 0x7273636E,
324    /// 'ijet'
325    InkJetPrinter                     = 0x696A6574,
326    /// 'twax'
327    ThermalWaxPrinter                 = 0x74776178,
328    /// 'epho'
329    ElectrophotographicPrinter        = 0x6570686F,
330    /// 'esta'
331    ElectrostaticPrinter              = 0x65737461,
332    /// 'dsub'
333    DyeSublimationPrinter             = 0x64737562,
334    /// 'rpho'
335    PhotographicPaperPrinter          = 0x7270686F,
336    /// 'fprn'
337    FilmWriter                        = 0x6670726E,
338    /// 'vidm'
339    VideoMonitor                      = 0x7669646D,
340    /// 'vidc'
341    VideoCamera                       = 0x76696463,
342    /// 'pjtv'
343    ProjectionTelevision              = 0x706A7476,
344    /// 'CRT '
345    CRTDisplay                        = 0x43525420,
346    /// 'PMD '
347    PMDisplay                         = 0x504D4420,
348    /// 'AMD '
349    AMDisplay                         = 0x414D4420,
350    /// 'KPCD'
351    PhotoCD                           = 0x4B504344,
352    /// 'imgs'
353    PhotoImageSetter                  = 0x696D6773,
354    /// 'grav'
355    Gravure                           = 0x67726176,
356    /// 'offs'
357    OffsetLithography                 = 0x6F666673,
358    /// 'silk'
359    Silkscreen                        = 0x73696C6B,
360    /// 'flex'
361    Flexography                       = 0x666C6578,
362    /// 'mpfs'
363    MotionPictureFilmScanner          = 0x6D706673,
364    /// 'mpfr'
365    MotionPictureFilmRecorder         = 0x6D706672,
366    /// 'dmpc'
367    DigitalMotionPictureCamera        = 0x646D7063,
368    /// 'dcpj'
369    DigitalCinemaProjector            = 0x64636A70
370}
371
372#[derive(Copy, Clone, PartialEq, Eq, Hash)]
373#[repr(u32)]
374#[derive(Debug)]
375#[non_exhaustive]
376pub enum ColorSpaceSignature {
377    /// 'XYZ '
378    XYZData                           = 0x58595A20,
379    /// 'Lab '
380    LabData                           = 0x4C616220,
381    /// 'Luv '
382    LuvData                           = 0x4C757620,
383    /// 'YCbr'
384    YCbCrData                         = 0x59436272,
385    /// 'Yxy '
386    YxyData                           = 0x59787920,
387    /// 'RGB '
388    RgbData                           = 0x52474220,
389    /// 'GRAY'
390    GrayData                          = 0x47524159,
391    /// 'HSV '
392    HsvData                           = 0x48535620,
393    /// 'HLS '
394    HlsData                           = 0x484C5320,
395    /// 'CMYK'
396    CmykData                          = 0x434D594B,
397    /// 'CMY '
398    CmyData                           = 0x434D5920,
399    /// 'MCH1'
400    MCH1Data                          = 0x4D434831,
401    /// 'MCH2'
402    MCH2Data                          = 0x4D434832,
403    /// 'MCH3'
404    MCH3Data                          = 0x4D434833,
405    /// 'MCH4'
406    MCH4Data                          = 0x4D434834,
407    /// 'MCH5'
408    MCH5Data                          = 0x4D434835,
409    /// 'MCH6'
410    MCH6Data                          = 0x4D434836,
411    /// 'MCH7'
412    MCH7Data                          = 0x4D434837,
413    /// 'MCH8'
414    MCH8Data                          = 0x4D434838,
415    /// 'MCH9'
416    MCH9Data                          = 0x4D434839,
417    /// 'MCHA'
418    MCHAData                          = 0x4D434841,
419    /// 'MCHB'
420    MCHBData                          = 0x4D434842,
421    /// 'MCHC'
422    MCHCData                          = 0x4D434843,
423    /// 'MCHD'
424    MCHDData                          = 0x4D434844,
425    /// 'MCHE'
426    MCHEData                          = 0x4D434845,
427    /// 'MCHF'
428    MCHFData                          = 0x4D434846,
429    /// 'nmcl'
430    NamedData                         = 0x6e6d636c,
431    /// '1CLR'
432    Sig1colorData                     = 0x31434C52,
433    /// '2CLR'
434    Sig2colorData                     = 0x32434C52,
435    /// '3CLR'
436    Sig3colorData                     = 0x33434C52,
437    /// '4CLR'
438    Sig4colorData                     = 0x34434C52,
439    /// '5CLR'
440    Sig5colorData                     = 0x35434C52,
441    /// '6CLR'
442    Sig6colorData                     = 0x36434C52,
443    /// '7CLR'
444    Sig7colorData                     = 0x37434C52,
445    /// '8CLR'
446    Sig8colorData                     = 0x38434C52,
447    /// '9CLR'
448    Sig9colorData                     = 0x39434C52,
449    /// 'ACLR'
450    Sig10colorData                    = 0x41434C52,
451    /// 'BCLR'
452    Sig11colorData                    = 0x42434C52,
453    /// 'CCLR'
454    Sig12colorData                    = 0x43434C52,
455    /// 'DCLR'
456    Sig13colorData                    = 0x44434C52,
457    /// 'ECLR'
458    Sig14colorData                    = 0x45434C52,
459    /// 'FCLR'
460    Sig15colorData                    = 0x46434C52,
461    /// 'LuvK'
462    LuvKData                          = 0x4C75764B
463}
464
465#[derive(Copy, Clone, PartialEq, Eq, Hash)]
466#[repr(u32)]
467#[derive(Debug)]
468#[non_exhaustive]
469pub enum ProfileClassSignature {
470    /// 'scnr'
471    InputClass                        = 0x73636E72,
472    /// 'mntr'
473    DisplayClass                      = 0x6D6E7472,
474    /// 'prtr'
475    OutputClass                       = 0x70727472,
476    /// 'link'
477    LinkClass                         = 0x6C696E6B,
478    /// 'abst'
479    AbstractClass                     = 0x61627374,
480    /// 'spac'
481    ColorSpaceClass                   = 0x73706163,
482    /// 'nmcl'
483    NamedColorClass                   = 0x6e6d636c
484}
485
486#[derive(Copy, Clone, PartialEq, Eq, Hash)]
487#[repr(u32)]
488#[derive(Debug)]
489#[non_exhaustive]
490pub enum PlatformSignature {
491    /// 'APPL'
492    Macintosh                         = 0x4150504C,
493    /// 'MSFT'
494    Microsoft                         = 0x4D534654,
495    /// 'SUNW'
496    Solaris                           = 0x53554E57,
497    /// 'SGI '
498    SGI                               = 0x53474920,
499    /// 'TGNT'
500    Taligent                          = 0x54474E54,
501    /// '*nix'   // From argyll -- Not official
502    Unices                            = 0x2A6E6978
503}
504
505///'prmg'
506pub const PerceptualReferenceMediumGamut:u32 =         0x70726d67;
507
508#[derive(Copy, Clone, PartialEq, Eq, Hash)]
509#[repr(u32)]
510#[derive(Debug)]
511#[non_exhaustive]
512pub enum ColorimetricIntentImageState {
513    ///'scoe'
514    SceneColorimetryEstimates =              0x73636F65,
515    ///'sape'
516    SceneAppearanceEstimates =               0x73617065,
517    ///'fpce'
518    FocalPlaneColorimetryEstimates =         0x66706365,
519    ///'rhoc'
520    ReflectionHardcopyOriginalColorimetry =  0x72686F63,
521    ///'rpoc'
522    ReflectionPrintOutputColorimetry =       0x72706F63,
523}
524
525#[derive(Copy, Clone, PartialEq, Eq, Hash)]
526#[repr(u32)]
527#[derive(Debug)]
528#[non_exhaustive]
529pub enum StageSignature {
530    ///'cvst'
531    CurveSetElemType              = 0x63767374,
532    ///'matf'
533    MatrixElemType                = 0x6D617466,
534    ///'clut'
535    CLutElemType                  = 0x636C7574,
536
537    /// 'bACS'
538    BAcsElemType                  = 0x62414353,
539    /// 'eACS'
540    EAcsElemType                  = 0x65414353,
541
542    /// Custom from here, not in the ICC Spec
543    /// 'l2x '
544    XYZ2LabElemType               = 0x6C327820,
545    /// 'x2l '
546    Lab2XYZElemType               = 0x78326C20,
547    /// 'ncl '
548    NamedColorElemType            = 0x6E636C20,
549    /// '2 4 '
550    LabV2toV4                     = 0x32203420,
551    /// '4 2 '
552    LabV4toV2                     = 0x34203220,
553
554    /// Identities
555    /// 'idn '
556    IdentityElemType              = 0x69646E20,
557
558    /// Float to floatPCS
559    /// 'd2l '
560    Lab2FloatPCS                  = 0x64326C20,
561    /// 'l2d '
562    FloatPCS2Lab                  = 0x6C326420,
563    /// 'd2x '
564    XYZ2FloatPCS                  = 0x64327820,
565    /// 'x2d '
566    FloatPCS2XYZ                  = 0x78326420,
567    /// 'clp '
568    ClipNegativesElemType         = 0x636c7020
569}
570
571#[derive(Copy, Clone, PartialEq, Eq, Hash)]
572#[repr(u32)]
573#[derive(Debug)]
574#[non_exhaustive]
575pub enum CurveSegSignature {
576    /// 'parf'
577    FormulaCurveSeg               = 0x70617266,
578    /// 'samf'
579    SampledCurveSeg               = 0x73616D66,
580    /// 'curf'
581    SegmentedCurve                = 0x63757266
582}
583
584///'StaA'
585pub const StatusA:u32 =                    0x53746141;
586///'StaE'
587pub const StatusE:u32 =                    0x53746145;
588///'StaI'
589pub const StatusI:u32 =                    0x53746149;
590///'StaT'
591pub const StatusT:u32 =                    0x53746154;
592///'StaM'
593pub const StatusM:u32 =                    0x5374614D;
594///'DN  '
595pub const DN:u32 =                         0x444E2020;
596///'DN P'
597pub const DNP:u32 =                        0x444E2050;
598///'DNN '
599pub const DNN:u32 =                        0x444E4E20;
600///'DNNP'
601pub const DNNP:u32 =                       0x444E4E50;
602
603/// Device attributes, currently defined values correspond to the low 4 bytes
604/// of the 8 byte attribute quantity
605pub const Reflective:u32 =     0;
606pub const Transparency:u32 =   1;
607pub const Glossy:u32 =         0;
608pub const Matte:u32 =          2;
609
610#[repr(C)]
611#[derive(Copy, Clone)]
612#[derive(Debug)]
613pub struct ICCData {
614    pub len: u32,
615    pub flag: u32,
616    pub data: [u8; 1],
617}
618
619impl Default for ICCData {
620    #[inline]
621    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
622}
623
624#[repr(C)]
625#[derive(Copy, Clone, PartialEq, Eq)]
626#[derive(Debug)]
627pub struct DateTimeNumber {
628    pub year: u16,
629    pub month: u16,
630    pub day: u16,
631    pub hours: u16,
632    pub minutes: u16,
633    pub seconds: u16,
634}
635
636impl Default for DateTimeNumber {
637    #[inline]
638    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
639}
640
641#[repr(C)]
642#[derive(Copy, Clone, PartialEq, Eq)]
643#[derive(Debug)]
644pub struct EncodedXYZNumber {
645    pub X: S15Fixed16Number,
646    pub Y: S15Fixed16Number,
647    pub Z: S15Fixed16Number,
648}
649
650impl Default for EncodedXYZNumber {
651    #[inline]
652    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
653}
654
655#[repr(C)]
656#[derive(Copy, Clone, PartialEq, Eq, Hash)]
657#[derive(Debug)]
658/// Profile ID as computed by MD5 algorithm
659pub struct ProfileID {
660    pub ID32: [u32; 4],
661}
662
663impl Default for ProfileID {
664    #[inline]
665    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
666}
667
668#[repr(C)]
669#[derive(Copy, Clone)]
670#[derive(Debug)]
671pub struct ICCHeader {
672    /// Profile size in bytes
673    pub size: u32,
674    /// CMM for this profile
675    pub cmmId: Signature,
676    /// Format version number
677    pub version: u32,
678    /// Type of profile
679    pub deviceClass: ProfileClassSignature,
680    /// Color space of data
681    pub colorSpace: ColorSpaceSignature,
682    /// PCS, XYZ or Lab only
683    pub pcs: ColorSpaceSignature,
684    /// Date profile was created
685    pub date: DateTimeNumber,
686    /// Magic Number to identify an ICC profile
687    pub magic: Signature,
688    /// Primary Platform
689    pub platform: PlatformSignature,
690    /// Various bit settings
691    pub flags: u32,
692    /// Device manufacturer
693    pub manufacturer: Signature,
694    /// Device model number
695    pub model: u32,
696    /// Device attributes
697    pub attributes: u64,
698    /// Rendering intent
699    pub renderingIntent: Intent,
700    /// Profile illuminant
701    pub illuminant: EncodedXYZNumber,
702    /// Profile creator
703    pub creator: Signature,
704    /// Profile ID using MD5
705    pub profileID: ProfileID,
706    /// Reserved for future use
707    pub reserved: [i8; 28],
708}
709impl Default for ICCHeader {
710    #[inline]
711    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
712}
713
714#[repr(C)]
715#[derive(Copy, Clone)]
716#[derive(Debug)]
717pub struct TagBase {
718    pub sig: TagTypeSignature,
719    pub reserved: [i8; 4],
720}
721impl Default for TagBase {
722    #[inline]
723    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
724}
725
726#[repr(C)]
727#[derive(Copy, Clone, PartialEq)]
728#[derive(Debug)]
729pub struct TagEntry {
730    pub sig: TagSignature,
731    pub offset: u32,
732    pub size: u32,
733}
734impl Default for TagEntry {
735    #[inline]
736    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
737}
738
739pub type HANDLE = *mut c_void;
740#[repr(C)]
741pub struct _HPROFILE { _opaque_type: [u8; 0] }
742pub type HPROFILE = *mut _HPROFILE;
743#[repr(C)]
744pub struct _HTRANSFORM { _opaque_type: [u8; 0] }
745pub type HTRANSFORM = *mut _HTRANSFORM;
746
747/// Maximum number of channels in ICC profiles
748pub const MAXCHANNELS: usize =  16;
749
750#[repr(C)]
751#[derive(Debug, Copy, Clone, PartialEq, Eq)]
752pub struct PixelType(pub u32);
753
754// Pixel types
755/// Don't check colorspace
756pub const PT_ANY: PixelType =   PixelType(0);
757/// 1 & 2 are reserved
758pub const PT_GRAY: PixelType =  PixelType(3);
759pub const PT_RGB: PixelType =   PixelType(4);
760pub const PT_CMY: PixelType =   PixelType(5);
761pub const PT_CMYK: PixelType =  PixelType(6);
762pub const PT_YCbCr: PixelType = PixelType(7);
763/// Lu'v'
764pub const PT_YUV: PixelType =   PixelType(8);
765pub const PT_XYZ: PixelType =   PixelType(9);
766pub const PT_Lab: PixelType =   PixelType(10);
767/// Lu'v'K
768pub const PT_YUVK: PixelType =  PixelType(11);
769pub const PT_HSV: PixelType =   PixelType(12);
770pub const PT_HLS: PixelType =   PixelType(13);
771pub const PT_Yxy: PixelType =   PixelType(14);
772
773pub const PT_MCH1: PixelType =  PixelType(15);
774pub const PT_MCH2: PixelType =  PixelType(16);
775pub const PT_MCH3: PixelType =  PixelType(17);
776pub const PT_MCH4: PixelType =  PixelType(18);
777pub const PT_MCH5: PixelType =  PixelType(19);
778pub const PT_MCH6: PixelType =  PixelType(20);
779pub const PT_MCH7: PixelType =  PixelType(21);
780pub const PT_MCH8: PixelType =  PixelType(22);
781pub const PT_MCH9: PixelType =  PixelType(23);
782pub const PT_MCH10: PixelType = PixelType(24);
783pub const PT_MCH11: PixelType = PixelType(25);
784pub const PT_MCH12: PixelType = PixelType(26);
785pub const PT_MCH13: PixelType = PixelType(27);
786pub const PT_MCH14: PixelType = PixelType(28);
787pub const PT_MCH15: PixelType = PixelType(29);
788
789/// Identical to PT_Lab, but using the V2 old encoding
790pub const PT_LabV2: PixelType = PixelType(30);
791
792/// Format of pixel is defined by one u32, using bit fields as follows
793///
794///                               2                1          0
795///                        4 3 2 10987 6 5 4 3 2 1 098 7654 321
796///                        M A O TTTTT U Y F P X S EEE CCCC BBB
797///
798///            M: Premultiplied alpha (only works when extra samples is 1)
799///            A: Floating point -- With this flag we can differentiate 16 bits as float and as int
800///            O: Optimized -- previous optimization already returns the final 8-bit value
801///            T: Pixeltype
802///            F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
803///            P: Planar? 0=Chunky, 1=Planar
804///            X: swap 16 bps endianness?
805///            S: Do swap? ie, BGR, KYMC
806///            E: Extra samples
807///            C: Channels (Samples per pixel)
808///            B: bytes per sample
809///            Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
810#[repr(transparent)]
811#[derive(Debug, Copy, Clone, PartialEq, Eq)]
812pub struct PixelFormat(pub u32);
813
814impl PixelFormat {
815    pub const GRAY_8: PixelFormat = PixelFormat(196617);
816    pub const GRAY_8_REV: PixelFormat = PixelFormat(204809);
817    pub const GRAY_16: PixelFormat = PixelFormat(196618);
818    pub const GRAY_16_REV: PixelFormat = PixelFormat(204810);
819    pub const GRAY_16_SE: PixelFormat = PixelFormat(198666);
820    pub const GRAYA_8: PixelFormat = PixelFormat(196745);
821    pub const GRAYA_16: PixelFormat = PixelFormat(196746);
822    pub const GRAYA_16_SE: PixelFormat = PixelFormat(198794);
823    pub const GRAYA_8_PLANAR: PixelFormat = PixelFormat(200841);
824    pub const GRAYA_16_PLANAR: PixelFormat = PixelFormat(200842);
825    pub const RGB_8: PixelFormat = PixelFormat(262169);
826    pub const RGB_8_PLANAR: PixelFormat = PixelFormat(266265);
827    pub const BGR_8: PixelFormat = PixelFormat(263193);
828    pub const BGR_8_PLANAR: PixelFormat = PixelFormat(267289);
829    pub const RGB_16: PixelFormat = PixelFormat(262170);
830    pub const RGB_16_PLANAR: PixelFormat = PixelFormat(266266);
831    pub const RGB_16_SE: PixelFormat = PixelFormat(264218);
832    pub const BGR_16: PixelFormat = PixelFormat(263194);
833    pub const BGR_16_PLANAR: PixelFormat = PixelFormat(267290);
834    pub const BGR_16_SE: PixelFormat = PixelFormat(265242);
835    pub const RGBA_8: PixelFormat = PixelFormat(262297);
836    pub const RGBA_8_PLANAR: PixelFormat = PixelFormat(266393);
837    pub const RGBA_16: PixelFormat = PixelFormat(262298);
838    pub const RGBA_16_PLANAR: PixelFormat = PixelFormat(266394);
839    pub const RGBA_16_SE: PixelFormat = PixelFormat(264346);
840    pub const ARGB_8: PixelFormat = PixelFormat(278681);
841    pub const ARGB_8_PLANAR: PixelFormat = PixelFormat(282777);
842    pub const ARGB_16: PixelFormat = PixelFormat(278682);
843    pub const ABGR_8: PixelFormat = PixelFormat(263321);
844    pub const ABGR_8_PLANAR: PixelFormat = PixelFormat(267417);
845    pub const ABGR_16: PixelFormat = PixelFormat(263322);
846    pub const ABGR_16_PLANAR: PixelFormat = PixelFormat(267418);
847    pub const ABGR_16_SE: PixelFormat = PixelFormat(265370);
848    pub const BGRA_8: PixelFormat = PixelFormat(279705);
849    pub const BGRA_8_PLANAR: PixelFormat = PixelFormat(283801);
850    pub const BGRA_16: PixelFormat = PixelFormat(279706);
851    pub const BGRA_16_SE: PixelFormat = PixelFormat(281754);
852    pub const CMY_8: PixelFormat = PixelFormat(327705);
853    pub const CMY_8_PLANAR: PixelFormat = PixelFormat(331801);
854    pub const CMY_16: PixelFormat = PixelFormat(327706);
855    pub const CMY_16_PLANAR: PixelFormat = PixelFormat(331802);
856    pub const CMY_16_SE: PixelFormat = PixelFormat(329754);
857    pub const CMYK_8: PixelFormat = PixelFormat(393249);
858    pub const CMYKA_8: PixelFormat = PixelFormat(393377);
859    pub const CMYK_8_REV: PixelFormat = PixelFormat(401441);
860    pub const CMYK_8_PLANAR: PixelFormat = PixelFormat(397345);
861    pub const CMYK_16: PixelFormat = PixelFormat(393250);
862    pub const CMYK_16_REV: PixelFormat = PixelFormat(401442);
863    pub const CMYK_16_PLANAR: PixelFormat = PixelFormat(397346);
864    pub const CMYK_16_SE: PixelFormat = PixelFormat(395298);
865    pub const KYMC_8: PixelFormat = PixelFormat(394273);
866    pub const KYMC_16: PixelFormat = PixelFormat(394274);
867    pub const KYMC_16_SE: PixelFormat = PixelFormat(396322);
868    pub const KCMY_8: PixelFormat = PixelFormat(409633);
869    pub const KCMY_8_REV: PixelFormat = PixelFormat(417825);
870    pub const KCMY_16: PixelFormat = PixelFormat(409634);
871    pub const KCMY_16_REV: PixelFormat = PixelFormat(417826);
872    pub const KCMY_16_SE: PixelFormat = PixelFormat(411682);
873    pub const CMYK5_8: PixelFormat = PixelFormat(1245225);
874    pub const CMYK5_16: PixelFormat = PixelFormat(1245226);
875    pub const CMYK5_16_SE: PixelFormat = PixelFormat(1247274);
876    pub const KYMC5_8: PixelFormat = PixelFormat(1246249);
877    pub const KYMC5_16: PixelFormat = PixelFormat(1246250);
878    pub const KYMC5_16_SE: PixelFormat = PixelFormat(1248298);
879    pub const CMYK6_8: PixelFormat = PixelFormat(1310769);
880    pub const CMYK6_8_PLANAR: PixelFormat = PixelFormat(1314865);
881    pub const CMYK6_16: PixelFormat = PixelFormat(1310770);
882    pub const CMYK6_16_PLANAR: PixelFormat = PixelFormat(1314866);
883    pub const CMYK6_16_SE: PixelFormat = PixelFormat(1312818);
884    pub const CMYK7_8: PixelFormat = PixelFormat(1376313);
885    pub const CMYK7_16: PixelFormat = PixelFormat(1376314);
886    pub const CMYK7_16_SE: PixelFormat = PixelFormat(1378362);
887    pub const KYMC7_8: PixelFormat = PixelFormat(1377337);
888    pub const KYMC7_16: PixelFormat = PixelFormat(1377338);
889    pub const KYMC7_16_SE: PixelFormat = PixelFormat(1379386);
890    pub const CMYK8_8: PixelFormat = PixelFormat(1441857);
891    pub const CMYK8_16: PixelFormat = PixelFormat(1441858);
892    pub const CMYK8_16_SE: PixelFormat = PixelFormat(1443906);
893    pub const KYMC8_8: PixelFormat = PixelFormat(1442881);
894    pub const KYMC8_16: PixelFormat = PixelFormat(1442882);
895    pub const KYMC8_16_SE: PixelFormat = PixelFormat(1444930);
896    pub const CMYK9_8: PixelFormat = PixelFormat(1507401);
897    pub const CMYK9_16: PixelFormat = PixelFormat(1507402);
898    pub const CMYK9_16_SE: PixelFormat = PixelFormat(1509450);
899    pub const KYMC9_8: PixelFormat = PixelFormat(1508425);
900    pub const KYMC9_16: PixelFormat = PixelFormat(1508426);
901    pub const KYMC9_16_SE: PixelFormat = PixelFormat(1510474);
902    pub const CMYK10_8: PixelFormat = PixelFormat(1572945);
903    pub const CMYK10_16: PixelFormat = PixelFormat(1572946);
904    pub const CMYK10_16_SE: PixelFormat = PixelFormat(1574994);
905    pub const KYMC10_8: PixelFormat = PixelFormat(1573969);
906    pub const KYMC10_16: PixelFormat = PixelFormat(1573970);
907    pub const KYMC10_16_SE: PixelFormat = PixelFormat(1576018);
908    pub const CMYK11_8: PixelFormat = PixelFormat(1638489);
909    pub const CMYK11_16: PixelFormat = PixelFormat(1638490);
910    pub const CMYK11_16_SE: PixelFormat = PixelFormat(1640538);
911    pub const KYMC11_8: PixelFormat = PixelFormat(1639513);
912    pub const KYMC11_16: PixelFormat = PixelFormat(1639514);
913    pub const KYMC11_16_SE: PixelFormat = PixelFormat(1641562);
914    pub const CMYK12_8: PixelFormat = PixelFormat(1704033);
915    pub const CMYK12_16: PixelFormat = PixelFormat(1704034);
916    pub const CMYK12_16_SE: PixelFormat = PixelFormat(1706082);
917    pub const KYMC12_8: PixelFormat = PixelFormat(1705057);
918    pub const KYMC12_16: PixelFormat = PixelFormat(1705058);
919    pub const KYMC12_16_SE: PixelFormat = PixelFormat(1707106);
920    pub const XYZ_16: PixelFormat = PixelFormat(589850);
921    pub const Lab_8: PixelFormat = PixelFormat(655385);
922    pub const LabV2_8: PixelFormat = PixelFormat(1966105);
923    pub const ALab_8: PixelFormat = PixelFormat(671897);
924    pub const ALabV2_8: PixelFormat = PixelFormat(1982617);
925    pub const Lab_16: PixelFormat = PixelFormat(655386);
926    pub const LabV2_16: PixelFormat = PixelFormat(1966106);
927    pub const Yxy_16: PixelFormat = PixelFormat(917530);
928    pub const YCbCr_8: PixelFormat = PixelFormat(458777);
929    pub const YCbCr_8_PLANAR: PixelFormat = PixelFormat(462873);
930    pub const YCbCr_16: PixelFormat = PixelFormat(458778);
931    pub const YCbCr_16_PLANAR: PixelFormat = PixelFormat(462874);
932    pub const YCbCr_16_SE: PixelFormat = PixelFormat(460826);
933    pub const YUV_8: PixelFormat = PixelFormat(524313);
934    pub const YUV_8_PLANAR: PixelFormat = PixelFormat(528409);
935    pub const YUV_16: PixelFormat = PixelFormat(524314);
936    pub const YUV_16_PLANAR: PixelFormat = PixelFormat(528410);
937    pub const YUV_16_SE: PixelFormat = PixelFormat(526362);
938    pub const HLS_8: PixelFormat = PixelFormat(851993);
939    pub const HLS_8_PLANAR: PixelFormat = PixelFormat(856089);
940    pub const HLS_16: PixelFormat = PixelFormat(851994);
941    pub const HLS_16_PLANAR: PixelFormat = PixelFormat(856090);
942    pub const HLS_16_SE: PixelFormat = PixelFormat(854042);
943    pub const HSV_8: PixelFormat = PixelFormat(786457);
944    pub const HSV_8_PLANAR: PixelFormat = PixelFormat(790553);
945    pub const HSV_16: PixelFormat = PixelFormat(786458);
946    pub const HSV_16_PLANAR: PixelFormat = PixelFormat(790554);
947    pub const HSV_16_SE: PixelFormat = PixelFormat(788506);
948    // Named color index. Only 16 bits allowed (don't check colorspace)
949    pub const NAMED_COLOR_INDEX: PixelFormat = PixelFormat(10);
950    pub const XYZ_FLT: PixelFormat = PixelFormat(4784156);
951    pub const Lab_FLT: PixelFormat = PixelFormat(4849692);
952    pub const LabA_FLT: PixelFormat = PixelFormat(4849820);
953    pub const GRAY_FLT: PixelFormat = PixelFormat(4390924);
954    pub const RGB_FLT: PixelFormat = PixelFormat(4456476);
955    pub const RGBA_FLT: PixelFormat = PixelFormat(4456604);
956    pub const ARGB_FLT: PixelFormat = PixelFormat(4472988);
957    pub const BGR_FLT: PixelFormat = PixelFormat(4457500);
958    pub const BGRA_FLT: PixelFormat = PixelFormat(4474012);
959    pub const CMYK_FLT: PixelFormat = PixelFormat(4587556);
960    pub const XYZ_DBL: PixelFormat = PixelFormat(4784152);
961    pub const Lab_DBL: PixelFormat = PixelFormat(4849688);
962    pub const GRAY_DBL: PixelFormat = PixelFormat(4390920);
963    pub const RGB_DBL: PixelFormat = PixelFormat(4456472);
964    pub const BGR_DBL: PixelFormat = PixelFormat(4457496);
965    pub const CMYK_DBL: PixelFormat = PixelFormat(4587552);
966    pub const GRAY_HALF_FLT: PixelFormat = PixelFormat(4390922);
967    pub const RGB_HALF_FLT: PixelFormat = PixelFormat(4456474);
968    pub const RGBA_HALF_FLT: PixelFormat = PixelFormat(4456602);
969    pub const CMYK_HALF_FLT: PixelFormat = PixelFormat(4587554);
970    pub const ARGB_HALF_FLT: PixelFormat = PixelFormat(4472986);
971    pub const BGR_HALF_FLT: PixelFormat = PixelFormat(4457498);
972    pub const BGRA_HALF_FLT: PixelFormat = PixelFormat(4474010);
973
974    ///   M: Premultiplied alpha (only works when extra samples is 1)
975    #[must_use]
976    #[inline]
977    pub fn premultiplied(&self) -> bool {
978        ((self.0 >> 23) & 1) != 0
979    }
980
981    ///   A: Floating point -- With this flag we can differentiate 16 bits as float and as int
982    #[must_use]
983    #[inline]
984    pub fn float(&self) -> bool {
985        ((self.0 >> 22) & 1) != 0
986    }
987
988    ///   O: Optimized -- previous optimization already returns the final 8-bit value
989    #[must_use]
990    #[inline]
991    pub fn optimized(&self) -> bool {
992        ((self.0 >> 21) & 1) != 0
993    }
994
995    ///   T: Color space (`PT_*`)
996    #[must_use]
997    #[inline]
998    pub fn pixel_type(&self) -> PixelType {
999        PixelType((self.0 >> 16) & 31)
1000    }
1001
1002    ///   Y: Swap first - changes ABGR to BGRA and KCMY to CMYK
1003    #[must_use]
1004    #[inline]
1005    pub fn swapfirst(&self) -> bool {
1006        ((self.0 >> 14) & 1) != 0
1007    }
1008
1009    ///   F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
1010    #[must_use]
1011    #[inline]
1012    pub fn min_is_white(&self) -> bool {
1013        ((self.0 >> 13) & 1) != 0
1014    }
1015
1016    ///   P: Planar? 0=Chunky, 1=Planar
1017    #[must_use]
1018    #[inline]
1019    pub fn planar(&self) -> bool {
1020        ((self.0 >> 12) & 1) != 0
1021    }
1022
1023    ///   X: swap 16 bps endianness?
1024    #[must_use]
1025    #[inline]
1026    pub fn endian16(&self) -> bool {
1027        ((self.0 >> 11) & 1) != 0
1028    }
1029
1030    ///   S: Do swap? ie, BGR, KYMC
1031    #[must_use]
1032    #[inline]
1033    pub fn doswap(&self) -> bool {
1034        ((self.0 >> 10) & 1) != 0
1035    }
1036
1037    ///   E: Extra samples
1038    #[must_use]
1039    #[inline]
1040    pub fn extra(&self) -> usize {
1041        ((self.0 >> 7) & 7) as usize
1042    }
1043
1044    ///   C: Channels (Samples per pixel)
1045    #[must_use]
1046    #[inline]
1047    pub fn channels(&self) -> usize {
1048        ((self.0 >> 3) & 15) as usize
1049    }
1050
1051    ///   B: bytes per sample
1052    #[must_use]
1053    pub fn bytes_per_channel(&self) -> usize {
1054        let res = (self.0 & 7) as usize;
1055        // 8 overflows the field
1056        if res != 0 {res} else {8}
1057    }
1058
1059    /// size of pixel
1060    #[must_use]
1061    pub fn bytes_per_pixel(&self) -> usize {
1062        self.bytes_per_channel() * (self.extra() + self.channels())
1063    }
1064}
1065
1066#[test]
1067fn test_bpc() {
1068    assert_eq!(8, PixelFormat::XYZ_DBL.bytes_per_channel());
1069    assert_eq!(8, PixelFormat::Lab_DBL.bytes_per_channel());
1070    assert_eq!(8, PixelFormat::GRAY_DBL.bytes_per_channel());
1071    assert_eq!(8, PixelFormat::RGB_DBL.bytes_per_channel());
1072    assert_eq!(8, PixelFormat::BGR_DBL.bytes_per_channel());
1073    assert_eq!(8, PixelFormat::CMYK_DBL.bytes_per_channel());
1074}
1075
1076#[test]
1077fn test_pixelformat() {
1078    assert_eq!(4, PixelFormat::CMYKA_8.channels());
1079    assert_eq!(1, PixelFormat::CMYKA_8.extra());
1080
1081    assert!(!PixelFormat::CMYKA_8.doswap());
1082    assert_eq!(1, PixelFormat::CMYKA_8.bytes_per_channel());
1083    assert_eq!(5, PixelFormat::CMYKA_8.bytes_per_pixel());
1084
1085    assert_eq!(2, PixelFormat::CMYK_HALF_FLT.bytes_per_channel());
1086    assert_eq!(PT_CMYK, PixelFormat::CMYK_HALF_FLT.pixel_type());
1087}
1088
1089#[repr(C)]
1090#[derive(Copy, Clone, PartialEq)]
1091#[derive(Debug)]
1092pub struct CIEXYZ {
1093    pub X: f64,
1094    pub Y: f64,
1095    pub Z: f64,
1096}
1097impl Default for CIEXYZ {
1098    #[inline]
1099    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1100}
1101
1102#[repr(C)]
1103#[derive(Copy, Clone, PartialEq)]
1104#[derive(Debug)]
1105pub struct CIExyY {
1106    pub x: f64,
1107    pub y: f64,
1108    pub Y: f64,
1109}
1110impl Default for CIExyY {
1111    #[inline]
1112    fn default() -> Self { CIExyY{x:0., y:0., Y:1.} }
1113}
1114
1115#[repr(C)]
1116#[derive(Copy, Clone, PartialEq)]
1117#[derive(Debug)]
1118pub struct CIELab {
1119    pub L: f64,
1120    pub a: f64,
1121    pub b: f64,
1122}
1123impl Default for CIELab {
1124    #[inline]
1125    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1126}
1127
1128#[repr(C)]
1129#[derive(Copy, Clone, PartialEq)]
1130#[derive(Debug)]
1131pub struct CIELCh {
1132    pub L: f64,
1133    pub C: f64,
1134    pub h: f64,
1135}
1136impl Default for CIELCh {
1137    #[inline]
1138    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1139}
1140
1141#[repr(C)]
1142#[derive(Copy, Clone, PartialEq)]
1143#[derive(Debug)]
1144pub struct JCh {
1145    pub J: f64,
1146    pub C: f64,
1147    pub h: f64,
1148}
1149impl Default for JCh {
1150    #[inline]
1151    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1152}
1153
1154#[repr(C)]
1155#[derive(Copy, Clone, PartialEq)]
1156#[derive(Debug)]
1157pub struct CIEXYZTRIPLE {
1158    pub Red: CIEXYZ,
1159    pub Green: CIEXYZ,
1160    pub Blue: CIEXYZ,
1161}
1162
1163#[repr(C)]
1164#[derive(Copy, Clone, PartialEq)]
1165#[derive(Debug)]
1166pub struct CIExyYTRIPLE {
1167    pub Red: CIExyY,
1168    pub Green: CIExyY,
1169    pub Blue: CIExyY,
1170}
1171
1172/// Illuminant types for structs below
1173#[derive(Copy, Clone, PartialEq, Eq, Hash)]
1174#[repr(u32)]
1175#[derive(Debug)]
1176#[non_exhaustive]
1177pub enum IlluminantType {
1178    UNKNOWN = 0x0000000,
1179    D50 =     0x0000001,
1180    D65 =     0x0000002,
1181    D93 =     0x0000003,
1182    F2 =      0x0000004,
1183    D55 =     0x0000005,
1184    A =       0x0000006,
1185    E =       0x0000007,
1186    F8 =      0x0000008,
1187}
1188
1189#[repr(C)]
1190#[derive(Copy, Clone)]
1191#[derive(Debug)]
1192pub struct ICCMeasurementConditions {
1193    pub Observer: u32,
1194    pub Backing: CIEXYZ,
1195    pub Geometry: u32,
1196    pub Flare: f64,
1197    pub IlluminantType: IlluminantType,
1198}
1199impl Default for ICCMeasurementConditions {
1200    #[inline]
1201    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1202}
1203
1204#[repr(C)]
1205#[derive(Copy, Clone)]
1206#[derive(Debug)]
1207pub struct ICCViewingConditions {
1208    pub IlluminantXYZ: CIEXYZ,
1209    pub SurroundXYZ: CIEXYZ,
1210    pub IlluminantType: IlluminantType,
1211}
1212impl Default for ICCViewingConditions {
1213    #[inline]
1214    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1215}
1216
1217
1218#[repr(u32)]
1219#[derive(Copy, Clone, Eq, PartialEq)]
1220#[derive(Debug)]
1221pub enum Surround {
1222    Avg       = 1,
1223    Dim       = 2,
1224    Dark      = 3,
1225    Cutsheet  = 4,
1226}
1227
1228pub const D_CALCULATE: f64 = -1.;
1229
1230#[repr(C)]
1231pub struct _cmsContext_struct { _opaque_type: [u8; 0] }
1232// Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
1233// though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
1234pub type Context = *mut _cmsContext_struct;
1235pub type LogErrorHandlerFunction = ::std::option::Option<unsafe extern "C" fn(ContextID: Context, ErrorCode: u32, Text: *const c_char)>;
1236
1237#[repr(C)]
1238#[derive(Copy, Clone)]
1239#[derive(Debug)]
1240pub struct ViewingConditions {
1241    pub whitePoint: CIEXYZ,
1242    pub Yb: f64,
1243    pub La: f64,
1244    pub surround: Surround,
1245    pub D_value: f64,
1246}
1247impl Default for ViewingConditions {
1248    #[inline]
1249    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1250}
1251
1252#[repr(C)]
1253#[derive(Copy, Clone)]
1254#[derive(Debug)]
1255/// This describes a curve segment.
1256///
1257/// For a table of supported types, see the manual. User can increase the number of
1258/// available types by using a proper plug-in. Parametric segments allow 10 parameters at most
1259pub struct CurveSegment {
1260    pub x0: f32,
1261    pub x1: f32,
1262    pub Type: i32,
1263    pub Params: [f64; 10],
1264    pub nGridPoints: u32,
1265    pub SampledPoints: *mut f32,
1266}
1267impl Default for CurveSegment {
1268    #[inline]
1269    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1270}
1271
1272pub enum ToneCurve { }
1273pub enum Pipeline { }
1274pub enum Stage { }
1275
1276#[derive(Copy, Clone, PartialEq, Eq)]
1277#[repr(u32)]
1278#[derive(Debug)]
1279/// Where to place/locate the stages in the pipeline chain
1280pub enum StageLoc {
1281    AT_BEGIN = 0,
1282    AT_END = 1,
1283}
1284pub type SAMPLER16 = unsafe extern "C" fn(input: *const u16, output: *mut u16, user_data: *mut c_void) -> i32;
1285pub type SAMPLERFLOAT = unsafe extern "C" fn(input: *const f32, output: *mut f32, user_data: *mut c_void) -> i32;
1286
1287#[repr(C)]
1288pub struct MLU { _opaque_type: [u8; 0] }
1289
1290#[repr(C)]
1291#[derive(Copy, Clone)]
1292#[derive(Debug)]
1293pub struct UcrBg {
1294    pub Ucr: *mut ToneCurve,
1295    pub Bg: *mut ToneCurve,
1296    pub Desc: *mut MLU,
1297}
1298
1299pub const PRINTER_DEFAULT_SCREENS: u32 =     0x0001;
1300pub const FREQUENCE_UNITS_LINES_CM: u32 =    0x0000;
1301pub const FREQUENCE_UNITS_LINES_INCH: u32 =  0x0002;
1302
1303#[repr(C)]
1304#[derive(Copy, Clone)]
1305#[derive(Debug)]
1306pub enum SpotShape {
1307    UNKNOWN         = 0,
1308    PRINTER_DEFAULT = 1,
1309    ROUND           = 2,
1310    DIAMOND         = 3,
1311    ELLIPSE         = 4,
1312    LINE            = 5,
1313    SQUARE          = 6,
1314    CROSS           = 7,
1315}
1316
1317#[repr(C)]
1318#[derive(Copy, Clone)]
1319#[derive(Debug)]
1320pub struct ScreeningChannel {
1321    pub Frequency: f64,
1322    pub ScreenAngle: f64,
1323    pub SpotShape: SpotShape,
1324}
1325impl Default for ScreeningChannel {
1326    #[inline]
1327    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1328}
1329
1330#[repr(C)]
1331#[derive(Copy, Clone)]
1332#[derive(Debug)]
1333pub struct Screening {
1334    pub Flag: u32,
1335    pub nChannels: u32,
1336    pub Channels: [ScreeningChannel; 16],
1337}
1338impl Default for Screening {
1339    #[inline]
1340    fn default() -> Self { unsafe { MaybeUninit::zeroed().assume_init() } }
1341}
1342#[repr(C)]
1343pub struct NAMEDCOLORLIST { _opaque_type: [u8; 0] }
1344
1345#[repr(C)]
1346#[derive(Copy, Clone)]
1347#[derive(Debug)]
1348/// Profile sequence descriptor.
1349///
1350/// Some fields come from profile sequence descriptor tag, others
1351/// come from Profile Sequence Identifier Tag
1352pub struct PSEQDESC {
1353    pub deviceMfg: Signature,
1354    pub deviceModel: Signature,
1355    pub attributes: u64,
1356    pub technology: TechnologySignature,
1357    pub ProfileID: ProfileID,
1358    pub Manufacturer: *mut MLU,
1359    pub Model: *mut MLU,
1360    pub Description: *mut MLU,
1361}
1362
1363#[repr(C)]
1364#[derive(Copy, Clone)]
1365#[derive(Debug)]
1366pub struct SEQ {
1367    pub n: u32,
1368    pub ContextID: Context,
1369    pub seq: *mut PSEQDESC,
1370}
1371
1372pub const EmbeddedProfileFalse: u32 =    0x00000000;
1373pub const EmbeddedProfileTrue: u32 =     0x00000001;
1374pub const UseAnywhere: u32 =             0x00000000;
1375pub const UseWithEmbeddedDataOnly: u32 = 0x00000002;
1376
1377#[repr(C)]
1378#[derive(Copy, Clone)]
1379#[derive(Debug)]
1380pub struct DICTentry {
1381    pub Next: *mut DICTentry,
1382    pub DisplayName: *mut MLU,
1383    pub DisplayValue: *mut MLU,
1384    pub Name: *mut wchar_t,
1385    pub Value: *mut wchar_t,
1386}
1387
1388#[derive(Copy, Clone, PartialEq, Eq, Hash)]
1389#[repr(u32)]
1390#[derive(Debug)]
1391pub enum InfoType {
1392    Description = 0,
1393    Manufacturer = 1,
1394    Model = 2,
1395    Copyright = 3,
1396}
1397#[repr(C)]
1398pub struct IOHANDLER { _opaque_type: [u8; 0] }
1399
1400
1401#[derive(Copy, Clone, PartialEq, Eq, Hash)]
1402#[repr(u32)]
1403#[derive(Debug)]
1404#[non_exhaustive]
1405pub enum Intent {
1406    /// ICC Intents
1407    Perceptual = 0,
1408    RelativeColorimetric = 1,
1409    Saturation = 2,
1410    AbsoluteColorimetric = 3,
1411
1412    /// non-icc intents
1413    PreserveKOnlyPerceptual = 10,
1414    PreserveKOnlyRelativeColorimetric = 11,
1415    PreserveKOnlySaturation = 12,
1416    PreserveKPlanePerceptual = 13,
1417    PreserveKPlaneRelativeColorimetric = 14,
1418    PreserveKPlaneSaturation = 15,
1419}
1420
1421// Flags
1422
1423/// Inhibit 1-pixel cache
1424pub const FLAGS_NOCACHE: u32 =                  0x0040;
1425/// Inhibit optimizations
1426pub const FLAGS_NOOPTIMIZE: u32 =               0x0100;
1427/// Don't transform anyway
1428pub const FLAGS_NULLTRANSFORM: u32 =            0x0200;
1429
1430/// Proofing flags
1431/// Out of Gamut alarm
1432pub const FLAGS_GAMUTCHECK: u32 =               0x1000;
1433/// Do softproofing
1434pub const FLAGS_SOFTPROOFING: u32 =             0x4000;
1435
1436// Misc
1437pub const FLAGS_BLACKPOINTCOMPENSATION: u32 =   0x2000;
1438/// Don't fix scum dot
1439pub const FLAGS_NOWHITEONWHITEFIXUP: u32 =      0x0004;
1440/// Use more memory to give better accurancy
1441pub const FLAGS_HIGHRESPRECALC: u32 =           0x0400;
1442/// Use less memory to minimize resources
1443pub const FLAGS_LOWRESPRECALC: u32 =            0x0800;
1444
1445/// For devicelink creation
1446/// Create 8 bits devicelinks
1447pub const FLAGS_8BITS_DEVICELINK: u32 =         0x0008;
1448/// Guess device class (for transform2devicelink)
1449pub const FLAGS_GUESSDEVICECLASS: u32 =         0x0020;
1450/// Keep profile sequence for devicelink creation
1451pub const FLAGS_KEEP_SEQUENCE: u32 =            0x0080;
1452
1453/// Specific to a particular optimizations
1454/// Force CLUT optimization
1455pub const FLAGS_FORCE_CLUT: u32 =               0x0002;
1456/// create postlinearization tables if possible
1457pub const FLAGS_CLUT_POST_LINEARIZATION: u32 =  0x0001;
1458/// create prelinearization tables if possible
1459pub const FLAGS_CLUT_PRE_LINEARIZATION: u32 =   0x0010;
1460
1461/// Specific to unbounded mode
1462/// Prevent negative numbers in floating point transforms
1463pub const FLAGS_NONEGATIVES: u32 =              0x8000;
1464
1465/// Alpha channels are copied on `cmsDoTransform()`
1466pub const FLAGS_COPY_ALPHA: u32 =           0x04000000;
1467
1468// Fine-tune control over number of gridpoints
1469#[must_use]
1470#[inline]
1471pub fn FLAGS_GRIDPOINTS(n: u32) -> u32 { ((n) & 0xFF) << 16 }
1472
1473/// CRD special
1474pub const FLAGS_NODEFAULTRESOURCEDEF: u32 =     0x01000000;
1475
1476/// Use this flag to prevent changes being written to destination.
1477pub const SAMPLER_INSPECT: u32 = 0x01000000;
1478
1479#[derive(Copy, Clone, PartialEq, Eq)]
1480#[repr(u32)]
1481#[derive(Debug)]
1482pub enum PSResourceType {
1483    PS_RESOURCE_CSA = 0,
1484    PS_RESOURCE_CRD = 1,
1485}
1486
1487#[repr(C)]
1488#[derive(Debug, Copy, Clone)]
1489pub struct VideoSignalType {
1490    pub ColourPrimaries: u8,
1491    pub TransferCharacteristics: u8,
1492    pub MatrixCoefficients: u8,
1493    pub VideoFullRangeFlag: u8,
1494}
1495
1496#[repr(C)]
1497#[derive(Debug, Copy, Clone)]
1498pub struct MHC2Type {
1499    pub CurveEntries: u32,
1500    pub RedCurve: *mut f64,
1501    pub GreenCurve: *mut f64,
1502    pub BlueCurve: *mut f64,
1503    /// ST.2086 min luminance in nits
1504    pub MinLuminance: f64,
1505    /// ST.2086 peak luminance in nits
1506    pub PeakLuminance: f64,
1507    pub XYZ2XYZmatrix: [[f64; 4]; 3],
1508}
1509
1510/// back compat only
1511#[doc(hidden)]
1512#[deprecated(note = "use MHC2Type")]
1513pub type cmsMHC2Type = MHC2Type;
1514
1515extern "C" {
1516    pub fn cmsGetEncodedCMMversion() -> c_int;
1517    pub fn cmsstrcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
1518    pub fn cmsfilelength(f: *mut FILE) -> c_long;
1519    pub fn cmsCreateContext(Plugin: *mut c_void, UserData: *mut c_void) -> Context;
1520    pub fn cmsDeleteContext(ContexID: Context);
1521    pub fn cmsDupContext(ContextID: Context, NewUserData: *mut c_void) -> Context;
1522    pub fn cmsGetContextUserData(ContextID: Context) -> *mut c_void;
1523    pub fn cmsPlugin(Plugin: *mut c_void) -> Bool;
1524    pub fn cmsPluginTHR(ContextID: Context, Plugin: *mut c_void) -> Bool;
1525    pub fn cmsUnregisterPlugins();
1526    pub fn cmsUnregisterPluginsTHR(ContextID: Context);
1527    pub fn cmsSetLogErrorHandler(Fn: LogErrorHandlerFunction);
1528    pub fn cmsSetLogErrorHandlerTHR(ContextID: Context, Fn: LogErrorHandlerFunction);
1529    pub fn cmsD50_XYZ() -> &'static CIEXYZ;
1530    pub fn cmsD50_xyY() -> &'static CIExyY;
1531    pub fn cmsXYZ2xyY(Dest: *mut CIExyY, Source: *const CIEXYZ);
1532    pub fn cmsxyY2XYZ(Dest: *mut CIEXYZ, Source: *const CIExyY);
1533    pub fn cmsXYZ2Lab(WhitePoint: *const CIEXYZ, Lab: *mut CIELab, xyz: *const CIEXYZ);
1534    pub fn cmsLab2XYZ(WhitePoint: *const CIEXYZ, xyz: *mut CIEXYZ, Lab: *const CIELab);
1535    pub fn cmsLab2LCh(LCh: *mut CIELCh, Lab: *const CIELab);
1536    pub fn cmsLCh2Lab(Lab: *mut CIELab, LCh: *const CIELCh);
1537    pub fn cmsLabEncoded2Float(Lab: *mut CIELab, wLab: *const u16);
1538    pub fn cmsLabEncoded2FloatV2(Lab: *mut CIELab, wLab: *const u16);
1539    pub fn cmsFloat2LabEncoded(wLab: *mut u16, Lab: *const CIELab);
1540    pub fn cmsFloat2LabEncodedV2(wLab: *mut u16, Lab: *const CIELab);
1541    pub fn cmsXYZEncoded2Float(fxyz: *mut CIEXYZ, XYZ: *const u16);
1542    pub fn cmsFloat2XYZEncoded(XYZ: *mut u16, fXYZ: *const CIEXYZ);
1543    pub fn cmsDeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64;
1544    pub fn cmsCIE94DeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64;
1545    pub fn cmsBFDdeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64;
1546    pub fn cmsCMCdeltaE(Lab1: *const CIELab, Lab2: *const CIELab, l: f64, c: f64) -> f64;
1547    pub fn cmsCIE2000DeltaE(Lab1: *const CIELab, Lab2: *const CIELab, Kl: f64, Kc: f64, Kh: f64) -> f64;
1548    pub fn cmsWhitePointFromTemp(WhitePoint: *mut CIExyY, TempK: f64) -> Bool;
1549    pub fn cmsTempFromWhitePoint(TempK: *mut f64, WhitePoint: *const CIExyY) -> Bool;
1550    pub fn cmsAdaptToIlluminant(Result: *mut CIEXYZ, SourceWhitePt: *const CIEXYZ, Illuminant: *const CIEXYZ, Value: *const CIEXYZ) -> Bool;
1551    pub fn cmsCIECAM02Init(ContextID: Context, pVC: *const ViewingConditions) -> HANDLE;
1552    pub fn cmsCIECAM02Done(hModel: HANDLE);
1553    pub fn cmsCIECAM02Forward(hModel: HANDLE, pIn: *const CIEXYZ, pOut: *mut JCh);
1554    pub fn cmsCIECAM02Reverse(hModel: HANDLE, pIn: *const JCh, pOut: *mut CIEXYZ);
1555    pub fn cmsGetToneCurveSegment(n: u32, t: &ToneCurve) -> &CurveSegment;
1556    pub fn cmsGetStageContextID(mpe: *const Stage) -> Context;
1557    pub fn cmsBuildSegmentedToneCurve(ContextID: Context, nSegments: u32, Segments: *const CurveSegment) -> *mut ToneCurve;
1558    pub fn cmsBuildParametricToneCurve(ContextID: Context, Type: i32, Params: *const f64) -> *mut ToneCurve;
1559    pub fn cmsBuildGamma(ContextID: Context, Gamma: f64) -> *mut ToneCurve;
1560    pub fn cmsBuildTabulatedToneCurve16(ContextID: Context, nEntries: u32, values: *const u16) -> *mut ToneCurve;
1561    pub fn cmsBuildTabulatedToneCurveFloat(ContextID: Context, nEntries: u32, values: *const f32) -> *mut ToneCurve;
1562    pub fn cmsFreeToneCurve(Curve: *mut ToneCurve);
1563    pub fn cmsFreeToneCurveTriple(Curve: *mut *mut ToneCurve);
1564    pub fn cmsDupToneCurve(Src: *const ToneCurve) -> *mut ToneCurve;
1565    pub fn cmsReverseToneCurve(InGamma: *const ToneCurve) -> *mut ToneCurve;
1566    pub fn cmsReverseToneCurveEx(nResultSamples: u32, InGamma: *const ToneCurve) -> *mut ToneCurve;
1567    pub fn cmsJoinToneCurve(ContextID: Context, X: *const ToneCurve, Y: *const ToneCurve, nPoints: u32) -> *mut ToneCurve;
1568    pub fn cmsSmoothToneCurve(Tab: *mut ToneCurve, lambda: f64) -> Bool;
1569    pub fn cmsEvalToneCurveFloat(Curve: *const ToneCurve, v: f32) -> f32;
1570    pub fn cmsEvalToneCurve16(Curve: *const ToneCurve, v: u16) -> u16;
1571    pub fn cmsIsToneCurveMultisegment(InGamma: *const ToneCurve) -> Bool;
1572    pub fn cmsIsToneCurveLinear(Curve: *const ToneCurve) -> Bool;
1573    pub fn cmsIsToneCurveMonotonic(t: *const ToneCurve) -> Bool;
1574    pub fn cmsIsToneCurveDescending(t: *const ToneCurve) -> Bool;
1575    pub fn cmsGetToneCurveParametricType(t: *const ToneCurve) -> i32;
1576    pub fn cmsEstimateGamma(t: *const ToneCurve, Precision: f64) -> f64;
1577    pub fn cmsGetToneCurveEstimatedTableEntries(t: *const ToneCurve) -> u32;
1578    pub fn cmsGetToneCurveEstimatedTable(t: *const ToneCurve) -> *const u16;
1579    pub fn cmsPipelineAlloc(ContextID: Context, InputChannels: u32, OutputChannels: u32) -> *mut Pipeline;
1580    pub fn cmsPipelineFree(lut: *mut Pipeline);
1581    pub fn cmsPipelineDup(Orig: *const Pipeline) -> *mut Pipeline;
1582    pub fn cmsGetPipelineContextID(lut: *const Pipeline) -> Context;
1583    pub fn cmsPipelineInputChannels(lut: *const Pipeline) -> u32;
1584    pub fn cmsPipelineOutputChannels(lut: *const Pipeline) -> u32;
1585    pub fn cmsPipelineStageCount(lut: *const Pipeline) -> u32;
1586    pub fn cmsPipelineGetPtrToFirstStage(lut: *const Pipeline) -> *mut Stage;
1587    pub fn cmsPipelineGetPtrToLastStage(lut: *const Pipeline) -> *mut Stage;
1588    pub fn cmsPipelineEval16(In: *const u16, Out: *mut u16, lut: *const Pipeline);
1589    pub fn cmsPipelineEvalFloat(In: *const f32, Out: *mut f32, lut: *const Pipeline);
1590    pub fn cmsPipelineEvalReverseFloat(Target: *mut f32, Result: *mut f32, Hint: *mut f32, lut: *const Pipeline) -> Bool;
1591    pub fn cmsPipelineCat(l1: *mut Pipeline, l2: *const Pipeline) -> Bool;
1592    pub fn cmsPipelineSetSaveAs8bitsFlag(lut: *mut Pipeline, On: Bool) -> Bool;
1593    pub fn cmsPipelineInsertStage(lut: *mut Pipeline, loc: StageLoc, mpe: *mut Stage) -> Bool;
1594    pub fn cmsPipelineUnlinkStage(lut: *mut Pipeline, loc: StageLoc, mpe: *mut *mut Stage);
1595    /// This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements
1596    /// that conform the Pipeline.
1597    ///
1598    /// It should be called with the Pipeline, the number of expected elements and
1599    /// then a list of expected types followed with a list of double pointers to Stage elements. If
1600    /// the function founds a match with current pipeline, it fills the pointers and returns TRUE
1601    /// if not, returns FALSE without touching anything.
1602    pub fn cmsPipelineCheckAndRetreiveStages(Lut: *const Pipeline, n: u32, ...) -> Bool;
1603    pub fn cmsStageAllocIdentity(ContextID: Context, nChannels: u32) -> *mut Stage;
1604    pub fn cmsStageAllocToneCurves(ContextID: Context, nChannels: u32, Curves: *const *const ToneCurve) -> *mut Stage;
1605    pub fn cmsStageAllocMatrix(ContextID: Context, Rows: u32, Cols: u32, Matrix: *const f64, Offset: *const f64) -> *mut Stage;
1606    pub fn cmsStageAllocCLut16bit(ContextID: Context, nGridPoints: u32, inputChan: u32, outputChan: u32, Table: *const u16) -> *mut Stage;
1607    pub fn cmsStageAllocCLutFloat(ContextID: Context, nGridPoints: u32, inputChan: u32, outputChan: u32, Table: *const f32) -> *mut Stage;
1608    pub fn cmsStageAllocCLut16bitGranular(ContextID: Context, clutPoints: *const u32, inputChan: u32, outputChan: u32, Table: *const u16) -> *mut Stage;
1609    pub fn cmsStageAllocCLutFloatGranular(ContextID: Context, clutPoints: *const u32, inputChan: u32, outputChan: u32, Table: *const f32) -> *mut Stage;
1610    pub fn cmsStageDup(mpe: *mut Stage) -> *mut Stage;
1611    pub fn cmsStageFree(mpe: *mut Stage);
1612    pub fn cmsStageNext(mpe: *const Stage) -> *mut Stage;
1613    pub fn cmsStageInputChannels(mpe: *const Stage) -> u32;
1614    pub fn cmsStageOutputChannels(mpe: *const Stage) -> u32;
1615    pub fn cmsStageType(mpe: *const Stage) -> StageSignature;
1616    pub fn cmsStageData(mpe: *const Stage) -> *mut c_void;
1617    pub fn cmsStageSampleCLut16bit(mpe: *mut Stage, Sampler: SAMPLER16, Cargo: *mut c_void, dwFlags: u32) -> Bool;
1618    pub fn cmsStageSampleCLutFloat(mpe: *mut Stage, Sampler: SAMPLERFLOAT, Cargo: *mut c_void, dwFlags: u32) -> Bool;
1619    pub fn cmsSliceSpace16(nInputs: u32, clutPoints: *const u32, Sampler: SAMPLER16, Cargo: *mut c_void) -> Bool;
1620    pub fn cmsSliceSpaceFloat(nInputs: u32, clutPoints: *const u32, Sampler: SAMPLERFLOAT, Cargo: *mut c_void) -> Bool;
1621    pub fn cmsMLUalloc(ContextID: Context, nItems: u32) -> *mut MLU;
1622    pub fn cmsMLUfree(mlu: *mut MLU);
1623    pub fn cmsMLUdup(mlu: *const MLU) -> *mut MLU;
1624    pub fn cmsMLUsetASCII(mlu: *mut MLU, LanguageCode: *const c_char, CountryCode: *const c_char, ASCIIString: *const c_char) -> Bool;
1625    pub fn cmsMLUsetUTF8(mlu: *mut MLU, LanguageCode: *const c_char, CountryCode: *const c_char, UTF8String: *const c_char) -> Bool;
1626    pub fn cmsMLUsetWide(mlu: *mut MLU, LanguageCode: *const c_char, CountryCode: *const c_char, WideString: *const wchar_t) -> Bool;
1627    pub fn cmsMLUgetASCII(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32;
1628    pub fn cmsMLUgetUTF8(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32;
1629    pub fn cmsMLUgetWide(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut wchar_t, BufferSize: u32) -> u32;
1630    pub fn cmsMLUgetTranslation(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, ObtainedLanguage: *mut c_char, ObtainedCountry: *mut c_char) -> Bool;
1631    pub fn cmsMLUtranslationsCount(mlu: *const MLU) -> u32;
1632    pub fn cmsMLUtranslationsCodes(mlu: *const MLU, idx: u32, LanguageCode: *mut c_char, CountryCode: *mut c_char) -> Bool;
1633    pub fn cmsAllocNamedColorList(ContextID: Context, n: u32, ColorantCount: u32, Prefix: *const c_char, Suffix: *const c_char) -> *mut NAMEDCOLORLIST;
1634    pub fn cmsFreeNamedColorList(v: *mut NAMEDCOLORLIST);
1635    pub fn cmsDupNamedColorList(v: *const NAMEDCOLORLIST) -> *mut NAMEDCOLORLIST;
1636    pub fn cmsAppendNamedColor(v: *mut NAMEDCOLORLIST, Name: *const c_char, PCS: *mut u16, Colorant: *mut u16) -> Bool;
1637    pub fn cmsNamedColorCount(v: *const NAMEDCOLORLIST) -> u32;
1638    pub fn cmsNamedColorIndex(v: *const NAMEDCOLORLIST, Name: *const c_char) -> i32;
1639    pub fn cmsNamedColorInfo(NamedColorList: *const NAMEDCOLORLIST, nColor: u32, Name: *mut c_char, Prefix: *mut c_char, Suffix: *mut c_char, PCS: *mut u16, Colorant: *mut u16) -> Bool;
1640    pub fn cmsGetNamedColorList(xform: HTRANSFORM) -> *mut NAMEDCOLORLIST;
1641    pub fn cmsAllocProfileSequenceDescription(ContextID: Context, n: u32) -> *mut SEQ;
1642    pub fn cmsDupProfileSequenceDescription(pseq: *const SEQ) -> *mut SEQ;
1643    pub fn cmsFreeProfileSequenceDescription(pseq: *mut SEQ);
1644    pub fn cmsDictAlloc(ContextID: Context) -> HANDLE;
1645    pub fn cmsDictFree(hDict: HANDLE);
1646    pub fn cmsDictDup(hDict: HANDLE) -> HANDLE;
1647    pub fn cmsDictAddEntry(hDict: HANDLE, Name: *const wchar_t, Value: *const wchar_t, DisplayName: *const MLU, DisplayValue: *const MLU) -> Bool;
1648    pub fn cmsDictGetEntryList(hDict: HANDLE) -> *const DICTentry;
1649    pub fn cmsDictNextEntry(e: *const DICTentry) -> *const DICTentry;
1650    pub fn cmsCreateProfilePlaceholder(ContextID: Context) -> HPROFILE;
1651    pub fn cmsGetProfileContextID(hProfile: HPROFILE) -> Context;
1652    pub fn cmsGetTagCount(hProfile: HPROFILE) -> i32;
1653    pub fn cmsGetTagSignature(hProfile: HPROFILE, n: u32) -> TagSignature;
1654    pub fn cmsIsTag(hProfile: HPROFILE, sig: TagSignature) -> Bool;
1655    pub fn cmsReadTag(hProfile: HPROFILE, sig: TagSignature) -> *mut c_void;
1656    pub fn cmsWriteTag(hProfile: HPROFILE, sig: TagSignature, data: *const c_void) -> Bool;
1657    pub fn cmsLinkTag(hProfile: HPROFILE, sig: TagSignature, dest: TagSignature) -> Bool;
1658    pub fn cmsTagLinkedTo(hProfile: HPROFILE, sig: TagSignature) -> TagSignature;
1659    pub fn cmsReadRawTag(hProfile: HPROFILE, sig: TagSignature, Buffer: *mut c_void, BufferSize: u32) -> u32;
1660    pub fn cmsWriteRawTag(hProfile: HPROFILE, sig: TagSignature, data: *const c_void, Size: u32) -> Bool;
1661    pub fn cmsGetHeaderFlags(hProfile: HPROFILE) -> u32;
1662    pub fn cmsGetHeaderAttributes(hProfile: HPROFILE, Flags: *mut u64);
1663    pub fn cmsGetHeaderProfileID(hProfile: HPROFILE, ProfileID: *mut u8);
1664    pub fn cmsGetHeaderCreationDateTime(hProfile: HPROFILE, Dest: *mut tm) -> Bool;
1665    pub fn cmsGetHeaderRenderingIntent(hProfile: HPROFILE) -> Intent;
1666    pub fn cmsSetHeaderFlags(hProfile: HPROFILE, Flags: u32);
1667    pub fn cmsGetHeaderManufacturer(hProfile: HPROFILE) -> u32;
1668    pub fn cmsSetHeaderManufacturer(hProfile: HPROFILE, manufacturer: u32);
1669    pub fn cmsGetHeaderCreator(hProfile: HPROFILE) -> u32;
1670    pub fn cmsGetHeaderModel(hProfile: HPROFILE) -> u32;
1671    pub fn cmsSetHeaderModel(hProfile: HPROFILE, model: u32);
1672    pub fn cmsSetHeaderAttributes(hProfile: HPROFILE, Flags: u64);
1673    pub fn cmsSetHeaderProfileID(hProfile: HPROFILE, ProfileID: *mut u8);
1674    pub fn cmsSetHeaderRenderingIntent(hProfile: HPROFILE, RenderingIntent: Intent);
1675    pub fn cmsGetPCS(hProfile: HPROFILE) -> ColorSpaceSignature;
1676    pub fn cmsSetPCS(hProfile: HPROFILE, pcs: ColorSpaceSignature);
1677    pub fn cmsGetColorSpace(hProfile: HPROFILE) -> ColorSpaceSignature;
1678    pub fn cmsSetColorSpace(hProfile: HPROFILE, sig: ColorSpaceSignature);
1679    pub fn cmsGetDeviceClass(hProfile: HPROFILE) -> ProfileClassSignature;
1680    pub fn cmsSetDeviceClass(hProfile: HPROFILE, sig: ProfileClassSignature);
1681    pub fn cmsCreateDeviceLinkFromCubeFile(cFileName: *const c_char) -> HPROFILE;
1682    pub fn cmsCreateDeviceLinkFromCubeFileTHR(ContextID: Context, cFileName: *const c_char) -> HPROFILE;
1683    pub fn cmsSetProfileVersion(hProfile: HPROFILE, Version: f64);
1684    pub fn cmsGetProfileVersion(hProfile: HPROFILE) -> f64;
1685    pub fn cmsGetEncodedICCversion(hProfile: HPROFILE) -> u32;
1686    pub fn cmsSetEncodedICCversion(hProfile: HPROFILE, Version: u32);
1687    pub fn cmsIsIntentSupported(hProfile: HPROFILE, Intent: Intent, UsedDirection: u32) -> Bool;
1688    pub fn cmsIsMatrixShaper(hProfile: HPROFILE) -> Bool;
1689    pub fn cmsIsCLUT(hProfile: HPROFILE, Intent: Intent, UsedDirection: u32) -> Bool;
1690    pub fn _cmsICCcolorSpace(OurNotation: c_int) -> ColorSpaceSignature;
1691    pub fn _cmsLCMScolorSpace(ProfileSpace: ColorSpaceSignature) -> c_int;
1692    pub fn cmsChannelsOf(ColorSpace: ColorSpaceSignature) -> u32;
1693    pub fn cmsChannelsOfColorSpace(ColorSpace: ColorSpaceSignature) -> i32;
1694    pub fn cmsFormatterForColorspaceOfProfile(hProfile: HPROFILE, nBytes: u32, lIsFloat: Bool) -> u32;
1695    pub fn cmsFormatterForPCSOfProfile(hProfile: HPROFILE, nBytes: u32, lIsFloat: Bool) -> u32;
1696    pub fn cmsGetProfileInfo(hProfile: HPROFILE, Info: InfoType, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut wchar_t, BufferSize: u32) -> u32;
1697    pub fn cmsGetProfileInfoASCII(hProfile: HPROFILE, Info: InfoType, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32;
1698    pub fn cmsGetProfileInfoUTF8(hProfile: HPROFILE, Info: InfoType, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32;
1699    pub fn cmsOpenIOhandlerFromFile(ContextID: Context, FileName: *const c_char, AccessMode: *const c_char) -> *mut IOHANDLER;
1700    pub fn cmsOpenIOhandlerFromStream(ContextID: Context, Stream: *mut FILE) -> *mut IOHANDLER;
1701    pub fn cmsOpenIOhandlerFromMem(ContextID: Context, Buffer: *mut c_void, size: u32, AccessMode: *const c_char) -> *mut IOHANDLER;
1702    pub fn cmsOpenIOhandlerFromNULL(ContextID: Context) -> *mut IOHANDLER;
1703    pub fn cmsGetProfileIOhandler(hProfile: HPROFILE) -> *mut IOHANDLER;
1704    pub fn cmsCloseIOhandler(io: *mut IOHANDLER) -> Bool;
1705    pub fn cmsMD5computeID(hProfile: HPROFILE) -> Bool;
1706    pub fn cmsOpenProfileFromFile(ICCProfile: *const c_char, sAccess: *const c_char) -> HPROFILE;
1707    pub fn cmsOpenProfileFromFileTHR(ContextID: Context, ICCProfile: *const c_char, sAccess: *const c_char) -> HPROFILE;
1708    pub fn cmsOpenProfileFromStream(ICCProfile: *mut FILE, sAccess: *const c_char) -> HPROFILE;
1709    pub fn cmsOpenProfileFromStreamTHR(ContextID: Context, ICCProfile: *mut FILE, sAccess: *const c_char) -> HPROFILE;
1710    pub fn cmsOpenProfileFromMem(MemPtr: *const c_void, dwSize: u32) -> HPROFILE;
1711    pub fn cmsOpenProfileFromMemTHR(ContextID: Context, MemPtr: *const c_void, dwSize: u32) -> HPROFILE;
1712    pub fn cmsOpenProfileFromIOhandlerTHR(ContextID: Context, io: *mut IOHANDLER) -> HPROFILE;
1713    pub fn cmsOpenProfileFromIOhandler2THR(ContextID: Context, io: *mut IOHANDLER, write: Bool) -> HPROFILE;
1714    pub fn cmsCloseProfile(hProfile: HPROFILE) -> Bool;
1715    pub fn cmsSaveProfileToFile(hProfile: HPROFILE, FileName: *const c_char) -> Bool;
1716    pub fn cmsSaveProfileToStream(hProfile: HPROFILE, Stream: *mut FILE) -> Bool;
1717    pub fn cmsSaveProfileToMem(hProfile: HPROFILE, MemPtr: *mut c_void, BytesNeeded: *mut u32) -> Bool;
1718    pub fn cmsSaveProfileToIOhandler(hProfile: HPROFILE, io: *mut IOHANDLER) -> u32;
1719    pub fn cmsCreateRGBProfileTHR(ContextID: Context, WhitePoint: *const CIExyY, Primaries: *const CIExyYTRIPLE, TransferFunction: *const *const ToneCurve) -> HPROFILE;
1720    pub fn cmsCreateRGBProfile(WhitePoint: *const CIExyY, Primaries: *const CIExyYTRIPLE, TransferFunction: *const *const ToneCurve) -> HPROFILE;
1721    pub fn cmsCreateGrayProfileTHR(ContextID: Context, WhitePoint: *const CIExyY, TransferFunction: *const ToneCurve) -> HPROFILE;
1722    pub fn cmsCreateGrayProfile(WhitePoint: *const CIExyY, TransferFunction: *const ToneCurve) -> HPROFILE;
1723    pub fn cmsCreateLinearizationDeviceLinkTHR(ContextID: Context, ColorSpace: ColorSpaceSignature, TransferFunctions: *const *const ToneCurve) -> HPROFILE;
1724    pub fn cmsCreateLinearizationDeviceLink(ColorSpace: ColorSpaceSignature, TransferFunctions: *const *const ToneCurve) -> HPROFILE;
1725    pub fn cmsCreateInkLimitingDeviceLinkTHR(ContextID: Context, ColorSpace: ColorSpaceSignature, Limit: f64) -> HPROFILE;
1726    pub fn cmsCreateInkLimitingDeviceLink(ColorSpace: ColorSpaceSignature, Limit: f64) -> HPROFILE;
1727    pub fn cmsCreateLab2ProfileTHR(ContextID: Context, WhitePoint: *const CIExyY) -> HPROFILE;
1728    pub fn cmsCreateLab2Profile(WhitePoint: *const CIExyY) -> HPROFILE;
1729    pub fn cmsCreateLab4ProfileTHR(ContextID: Context, WhitePoint: *const CIExyY) -> HPROFILE;
1730    pub fn cmsCreateLab4Profile(WhitePoint: *const CIExyY) -> HPROFILE;
1731    pub fn cmsCreateXYZProfileTHR(ContextID: Context) -> HPROFILE;
1732    pub fn cmsCreateXYZProfile() -> HPROFILE;
1733    pub fn cmsCreate_sRGBProfileTHR(ContextID: Context) -> HPROFILE;
1734    pub fn cmsCreate_sRGBProfile() -> HPROFILE;
1735    pub fn cmsCreate_OkLabProfile(ContextID: Context) -> HPROFILE;
1736    pub fn cmsCreateBCHSWabstractProfileTHR(ContextID: Context, nLUTPoints: u32, Bright: f64, Contrast: f64, Hue: f64, Saturation: f64, TempSrc: u32, TempDest: u32) -> HPROFILE;
1737    pub fn cmsCreateBCHSWabstractProfile(nLUTPoints: u32, Bright: f64, Contrast: f64, Hue: f64, Saturation: f64, TempSrc: u32, TempDest: u32) -> HPROFILE;
1738    pub fn cmsCreateNULLProfileTHR(ContextID: Context) -> HPROFILE;
1739    pub fn cmsCreateNULLProfile() -> HPROFILE;
1740    pub fn cmsTransform2DeviceLink(hTransform: HTRANSFORM, Version: f64, dwFlags: u32) -> HPROFILE;
1741    pub fn cmsGetSupportedIntents(nMax: u32, Codes: *mut u32, Descriptions: *mut *mut c_char) -> u32;
1742    pub fn cmsGetSupportedIntentsTHR(ContextID: Context, nMax: u32, Codes: *mut u32, Descriptions: *mut *mut c_char) -> u32;
1743    pub fn cmsCreateTransformTHR(ContextID: Context, Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM;
1744    pub fn cmsCreateTransform(Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM;
1745    pub fn cmsCreateProofingTransformTHR(ContextID: Context,
1746                                         Input: HPROFILE,
1747                                         InputFormat: PixelFormat,
1748                                         Output: HPROFILE,
1749                                         OutputFormat: PixelFormat,
1750                                         Proofing: HPROFILE,
1751                                         Intent: Intent,
1752                                         ProofingIntent: Intent,
1753                                         dwFlags: u32)
1754                                         -> HTRANSFORM;
1755    pub fn cmsCreateProofingTransform(Input: HPROFILE,
1756                                      InputFormat: PixelFormat,
1757                                      Output: HPROFILE,
1758                                      OutputFormat: PixelFormat,
1759                                      Proofing: HPROFILE,
1760                                      Intent: Intent,
1761                                      ProofingIntent: Intent,
1762                                      dwFlags: u32)
1763                                      -> HTRANSFORM;
1764    pub fn cmsCreateMultiprofileTransformTHR(ContextID: Context,
1765                                             hProfiles: *mut HPROFILE,
1766                                             nProfiles: u32,
1767                                             InputFormat: PixelFormat,
1768                                             OutputFormat: PixelFormat,
1769                                             Intent: Intent,
1770                                             dwFlags: u32)
1771                                             -> HTRANSFORM;
1772    pub fn cmsCreateMultiprofileTransform(hProfiles: *mut HPROFILE, nProfiles: u32, InputFormat: PixelFormat, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM;
1773    pub fn cmsCreateExtendedTransform(ContextID: Context,
1774                                      nProfiles: u32,
1775                                      hProfiles: *mut HPROFILE,
1776                                      BPC: *mut Bool,
1777                                      Intents: *mut u32,
1778                                      AdaptationStates: *mut f64,
1779                                      hGamutProfile: HPROFILE,
1780                                      nGamutPCSposition: u32,
1781                                      InputFormat: PixelFormat,
1782                                      OutputFormat: PixelFormat,
1783                                      dwFlags: u32)
1784                                      -> HTRANSFORM;
1785    pub fn cmsDeleteTransform(hTransform: HTRANSFORM);
1786    pub fn cmsDoTransform(Transform: HTRANSFORM, InputBuffer: *const c_void, OutputBuffer: *mut c_void, Size: u32);
1787    /// Deprecated
1788    pub fn cmsDoTransformStride(Transform: HTRANSFORM, InputBuffer: *const c_void, OutputBuffer: *mut c_void, Size: u32, Stride: u32);
1789    pub fn cmsDoTransformLineStride(Transform: HTRANSFORM,
1790                                    InputBuffer: *const c_void,
1791                                    OutputBuffer: *mut c_void,
1792                                    PixelsPerLine: u32,
1793                                    LineCount: u32,
1794                                    BytesPerLineIn: u32,
1795                                    BytesPerLineOut: u32,
1796                                    BytesPerPlaneIn: u32,
1797                                    BytesPerPlaneOut: u32);
1798    pub fn cmsSetAlarmCodes(NewAlarm: *const u16);
1799    pub fn cmsGetAlarmCodes(NewAlarm: *mut u16);
1800    pub fn cmsSetAlarmCodesTHR(ContextID: Context, AlarmCodes: *const u16);
1801    pub fn cmsGetAlarmCodesTHR(ContextID: Context, AlarmCodes: *mut u16);
1802    pub fn cmsSetAdaptationState(d: f64) -> f64;
1803    pub fn cmsSetAdaptationStateTHR(ContextID: Context, d: f64) -> f64;
1804    pub fn cmsGetTransformContextID(hTransform: HTRANSFORM) -> Context;
1805    pub fn cmsGetTransformInputFormat(hTransform: HTRANSFORM) -> PixelFormat;
1806    pub fn cmsGetTransformOutputFormat(hTransform: HTRANSFORM) -> PixelFormat;
1807    pub fn cmsChangeBuffersFormat(hTransform: HTRANSFORM, InputFormat: PixelFormat, OutputFormat: PixelFormat) -> Bool;
1808    pub fn cmsGetPostScriptColorResource(ContextID: Context, Type: PSResourceType, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, io: *mut IOHANDLER) -> u32;
1809    pub fn cmsGetPostScriptCSA(ContextID: Context, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, Buffer: *mut c_void, dwBufferLen: u32) -> u32;
1810    pub fn cmsGetPostScriptCRD(ContextID: Context, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, Buffer: *mut c_void, dwBufferLen: u32) -> u32;
1811    pub fn cmsIT8Alloc(ContextID: Context) -> HANDLE;
1812    pub fn cmsIT8Free(hIT8: HANDLE);
1813    pub fn cmsIT8TableCount(hIT8: HANDLE) -> u32;
1814    pub fn cmsIT8SetTable(hIT8: HANDLE, nTable: u32) -> i32;
1815    pub fn cmsIT8LoadFromFile(ContextID: Context, cFileName: *const c_char) -> HANDLE;
1816    pub fn cmsIT8LoadFromMem(ContextID: Context, Ptr: *const c_void, len: u32) -> HANDLE;
1817    pub fn cmsIT8SaveToFile(hIT8: HANDLE, cFileName: *const c_char) -> Bool;
1818    pub fn cmsIT8SaveToMem(hIT8: HANDLE, MemPtr: *mut c_void, BytesNeeded: *mut u32) -> Bool;
1819    pub fn cmsIT8GetSheetType(hIT8: HANDLE) -> *const c_char;
1820    pub fn cmsIT8SetSheetType(hIT8: HANDLE, Type: *const c_char) -> Bool;
1821    pub fn cmsIT8SetComment(hIT8: HANDLE, cComment: *const c_char) -> Bool;
1822    pub fn cmsIT8SetPropertyStr(hIT8: HANDLE, cProp: *const c_char, Str: *const c_char) -> Bool;
1823    pub fn cmsIT8SetPropertyDbl(hIT8: HANDLE, cProp: *const c_char, Val: f64) -> Bool;
1824    pub fn cmsIT8SetPropertyHex(hIT8: HANDLE, cProp: *const c_char, Val: u32) -> Bool;
1825    pub fn cmsIT8SetPropertyMulti(hIT8: HANDLE, Key: *const c_char, SubKey: *const c_char, Buffer: *const c_char) -> Bool;
1826    pub fn cmsIT8SetPropertyUncooked(hIT8: HANDLE, Key: *const c_char, Buffer: *const c_char) -> Bool;
1827    pub fn cmsIT8GetProperty(hIT8: HANDLE, cProp: *const c_char) -> *const c_char;
1828    pub fn cmsIT8GetPropertyDbl(hIT8: HANDLE, cProp: *const c_char) -> f64;
1829    pub fn cmsIT8GetPropertyMulti(hIT8: HANDLE, Key: *const c_char, SubKey: *const c_char) -> *const c_char;
1830    pub fn cmsIT8EnumProperties(hIT8: HANDLE, PropertyNames: *mut *mut *mut c_char) -> u32;
1831    pub fn cmsIT8EnumPropertyMulti(hIT8: HANDLE, cProp: *const c_char, SubpropertyNames: *mut *mut *const c_char) -> u32;
1832    pub fn cmsIT8GetDataRowCol(hIT8: HANDLE, row: c_int, col: c_int) -> *const c_char;
1833    pub fn cmsIT8GetDataRowColDbl(hIT8: HANDLE, row: c_int, col: c_int) -> f64;
1834    pub fn cmsIT8SetDataRowCol(hIT8: HANDLE, row: c_int, col: c_int, Val: *const c_char) -> Bool;
1835    pub fn cmsIT8SetDataRowColDbl(hIT8: HANDLE, row: c_int, col: c_int, Val: f64) -> Bool;
1836    pub fn cmsIT8GetData(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char) -> *const c_char;
1837    pub fn cmsIT8GetDataDbl(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char) -> f64;
1838    pub fn cmsIT8SetData(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char, Val: *const c_char) -> Bool;
1839    pub fn cmsIT8SetDataDbl(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char, Val: f64) -> Bool;
1840    pub fn cmsIT8FindDataFormat(hIT8: HANDLE, cSample: *const c_char) -> c_int;
1841    pub fn cmsIT8SetDataFormat(hIT8: HANDLE, n: c_int, Sample: *const c_char) -> Bool;
1842    pub fn cmsIT8EnumDataFormat(hIT8: HANDLE, SampleNames: *mut *mut *mut c_char) -> c_int;
1843    pub fn cmsIT8GetPatchName(hIT8: HANDLE, nPatch: c_int, buffer: *mut c_char) -> *const c_char;
1844    pub fn cmsIT8GetPatchByName(hIT8: HANDLE, cPatch: *const c_char) -> c_int;
1845    pub fn cmsIT8SetTableByLabel(hIT8: HANDLE, cSet: *const c_char, cField: *const c_char, ExpectedType: *const c_char) -> c_int;
1846    pub fn cmsIT8SetIndexColumn(hIT8: HANDLE, cSample: *const c_char) -> Bool;
1847    pub fn cmsIT8DefineDblFormat(hIT8: HANDLE, Formatter: *const c_char);
1848    pub fn cmsGBDAlloc(ContextID: Context) -> HANDLE;
1849    pub fn cmsGBDFree(hGBD: HANDLE);
1850    pub fn cmsGDBAddPoint(hGBD: HANDLE, Lab: *const CIELab) -> Bool;
1851    pub fn cmsGDBCompute(hGDB: HANDLE, dwFlags: u32) -> Bool;
1852    pub fn cmsGDBCheckPoint(hGBD: HANDLE, Lab: *const CIELab) -> Bool;
1853    pub fn cmsDetectBlackPoint(BlackPoint: *mut CIEXYZ, hProfile: HPROFILE, Intent: Intent, dwFlags: u32) -> Bool;
1854    pub fn cmsDetectDestinationBlackPoint(BlackPoint: *mut CIEXYZ, hProfile: HPROFILE, Intent: Intent, dwFlags: u32) -> Bool;
1855    // Estimate total area coverage
1856    pub fn cmsDetectTAC(hProfile: HPROFILE) -> f64;
1857    pub fn cmsDesaturateLab(Lab: *mut CIELab, amax: f64, amin: f64, bmax: f64, bmin: f64) -> Bool;
1858    pub fn cmsDetectRGBProfileGamma(hProfile: HPROFILE, threshold: f64) -> f64;
1859}