|
1 #ifndef QCMS_H |
|
2 #define QCMS_H |
|
3 |
|
4 #ifdef __cplusplus |
|
5 extern "C" { |
|
6 #endif |
|
7 |
|
8 /* if we've already got an ICC_H header we can ignore the following */ |
|
9 #ifndef ICC_H |
|
10 /* icc34 defines */ |
|
11 |
|
12 /***************************************************************** |
|
13 Copyright (c) 1994-1996 SunSoft, Inc. |
|
14 |
|
15 Rights Reserved |
|
16 |
|
17 Permission is hereby granted, free of charge, to any person |
|
18 obtaining a copy of this software and associated documentation |
|
19 files (the "Software"), to deal in the Software without restrict- |
|
20 ion, including without limitation the rights to use, copy, modify, |
|
21 merge, publish distribute, sublicense, and/or sell copies of the |
|
22 Software, and to permit persons to whom the Software is furnished |
|
23 to do so, subject to the following conditions: |
|
24 |
|
25 The above copyright notice and this permission notice shall be |
|
26 included in all copies or substantial portions of the Software. |
|
27 |
|
28 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
29 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
30 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- |
|
31 INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT |
|
32 COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
33 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
34 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
35 OTHER DEALINGS IN THE SOFTWARE. |
|
36 |
|
37 Except as contained in this notice, the name of SunSoft, Inc. |
|
38 shall not be used in advertising or otherwise to promote the |
|
39 sale, use or other dealings in this Software without written |
|
40 authorization from SunSoft Inc. |
|
41 ******************************************************************/ |
|
42 |
|
43 /* |
|
44 * QCMS, in general, is not threadsafe. However, it should be safe to create |
|
45 * profile and transformation objects on different threads, so long as you |
|
46 * don't use the same objects on different threads at the same time. |
|
47 */ |
|
48 |
|
49 /* |
|
50 * Color Space Signatures |
|
51 * Note that only icSigXYZData and icSigLabData are valid |
|
52 * Profile Connection Spaces (PCSs) |
|
53 */ |
|
54 typedef enum { |
|
55 icSigXYZData = 0x58595A20L, /* 'XYZ ' */ |
|
56 icSigLabData = 0x4C616220L, /* 'Lab ' */ |
|
57 icSigLuvData = 0x4C757620L, /* 'Luv ' */ |
|
58 icSigYCbCrData = 0x59436272L, /* 'YCbr' */ |
|
59 icSigYxyData = 0x59787920L, /* 'Yxy ' */ |
|
60 icSigRgbData = 0x52474220L, /* 'RGB ' */ |
|
61 icSigGrayData = 0x47524159L, /* 'GRAY' */ |
|
62 icSigHsvData = 0x48535620L, /* 'HSV ' */ |
|
63 icSigHlsData = 0x484C5320L, /* 'HLS ' */ |
|
64 icSigCmykData = 0x434D594BL, /* 'CMYK' */ |
|
65 icSigCmyData = 0x434D5920L, /* 'CMY ' */ |
|
66 icSig2colorData = 0x32434C52L, /* '2CLR' */ |
|
67 icSig3colorData = 0x33434C52L, /* '3CLR' */ |
|
68 icSig4colorData = 0x34434C52L, /* '4CLR' */ |
|
69 icSig5colorData = 0x35434C52L, /* '5CLR' */ |
|
70 icSig6colorData = 0x36434C52L, /* '6CLR' */ |
|
71 icSig7colorData = 0x37434C52L, /* '7CLR' */ |
|
72 icSig8colorData = 0x38434C52L, /* '8CLR' */ |
|
73 icSig9colorData = 0x39434C52L, /* '9CLR' */ |
|
74 icSig10colorData = 0x41434C52L, /* 'ACLR' */ |
|
75 icSig11colorData = 0x42434C52L, /* 'BCLR' */ |
|
76 icSig12colorData = 0x43434C52L, /* 'CCLR' */ |
|
77 icSig13colorData = 0x44434C52L, /* 'DCLR' */ |
|
78 icSig14colorData = 0x45434C52L, /* 'ECLR' */ |
|
79 icSig15colorData = 0x46434C52L, /* 'FCLR' */ |
|
80 icMaxEnumData = 0xFFFFFFFFL |
|
81 } icColorSpaceSignature; |
|
82 #endif |
|
83 |
|
84 #include <stdio.h> |
|
85 |
|
86 typedef int qcms_bool; |
|
87 |
|
88 struct _qcms_transform; |
|
89 typedef struct _qcms_transform qcms_transform; |
|
90 |
|
91 struct _qcms_profile; |
|
92 typedef struct _qcms_profile qcms_profile; |
|
93 |
|
94 /* these values match the Rendering Intent values from the ICC spec */ |
|
95 typedef enum { |
|
96 QCMS_INTENT_MIN = 0, |
|
97 QCMS_INTENT_PERCEPTUAL = 0, |
|
98 QCMS_INTENT_RELATIVE_COLORIMETRIC = 1, |
|
99 QCMS_INTENT_SATURATION = 2, |
|
100 QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3, |
|
101 QCMS_INTENT_MAX = 3, |
|
102 |
|
103 /* Chris Murphy (CM consultant) suggests this as a default in the event that we |
|
104 * cannot reproduce relative + Black Point Compensation. BPC brings an |
|
105 * unacceptable performance overhead, so we go with perceptual. */ |
|
106 QCMS_INTENT_DEFAULT = QCMS_INTENT_PERCEPTUAL, |
|
107 } qcms_intent; |
|
108 |
|
109 //XXX: I don't really like the _DATA_ prefix |
|
110 typedef enum { |
|
111 QCMS_DATA_RGB_8, |
|
112 QCMS_DATA_RGBA_8, |
|
113 QCMS_DATA_GRAY_8, |
|
114 QCMS_DATA_GRAYA_8 |
|
115 } qcms_data_type; |
|
116 |
|
117 /* the names for the following two types are sort of ugly */ |
|
118 typedef struct |
|
119 { |
|
120 double x; |
|
121 double y; |
|
122 double Y; |
|
123 } qcms_CIE_xyY; |
|
124 |
|
125 typedef struct |
|
126 { |
|
127 qcms_CIE_xyY red; |
|
128 qcms_CIE_xyY green; |
|
129 qcms_CIE_xyY blue; |
|
130 } qcms_CIE_xyYTRIPLE; |
|
131 |
|
132 qcms_profile* qcms_profile_create_rgb_with_gamma( |
|
133 qcms_CIE_xyY white_point, |
|
134 qcms_CIE_xyYTRIPLE primaries, |
|
135 float gamma); |
|
136 |
|
137 void qcms_data_create_rgb_with_gamma( |
|
138 qcms_CIE_xyY white_point, |
|
139 qcms_CIE_xyYTRIPLE primaries, |
|
140 float gamma, |
|
141 void **mem, |
|
142 size_t *size); |
|
143 |
|
144 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size); |
|
145 |
|
146 qcms_profile* qcms_profile_from_file(FILE *file); |
|
147 qcms_profile* qcms_profile_from_path(const char *path); |
|
148 |
|
149 void qcms_data_from_path(const char *path, void **mem, size_t *size); |
|
150 |
|
151 #ifdef _WIN32 |
|
152 qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path); |
|
153 void qcms_data_from_unicode_path(const wchar_t *path, void **mem, size_t *size); |
|
154 #endif |
|
155 qcms_profile* qcms_profile_sRGB(void); |
|
156 void qcms_profile_release(qcms_profile *profile); |
|
157 |
|
158 qcms_bool qcms_profile_is_bogus(qcms_profile *profile); |
|
159 qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile); |
|
160 icColorSpaceSignature qcms_profile_get_color_space(qcms_profile *profile); |
|
161 |
|
162 void qcms_profile_precache_output_transform(qcms_profile *profile); |
|
163 |
|
164 qcms_transform* qcms_transform_create( |
|
165 qcms_profile *in, qcms_data_type in_type, |
|
166 qcms_profile* out, qcms_data_type out_type, |
|
167 qcms_intent intent); |
|
168 |
|
169 void qcms_transform_release(qcms_transform *); |
|
170 |
|
171 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length); |
|
172 |
|
173 void qcms_enable_iccv4(); |
|
174 |
|
175 #ifdef __cplusplus |
|
176 } |
|
177 #endif |
|
178 |
|
179 #endif |