71#include <jasper/jas_config.h>
88#define JAS_ICC_MAGIC 0x61637370
90#define JAS_ICC_HDRLEN 128
93#define JAS_ICC_CLAS_IN 0x73636e72
94#define JAS_ICC_CLAS_DPY 0x6d6e7472
95#define JAS_ICC_CLAS_OUT 0x70727472
96#define JAS_ICC_CLAS_LNK 0x6c696e6b
97#define JAS_ICC_CLAS_CNV 0x73706163
98#define JAS_ICC_CLAS_ABS 0x61627374
99#define JAS_ICC_CLAS_NAM 0x6e6d636c
102#define JAS_ICC_COLORSPC_XYZ 0x58595a20
103#define JAS_ICC_COLORSPC_LAB 0x4c616220
104#define JAS_ICC_COLORSPC_LUV 0x4c757620
105#define JAS_ICC_COLORSPC_YCBCR 0x59436272
106#define JAS_ICC_COLORSPC_YXY 0x59787920
107#define JAS_ICC_COLORSPC_RGB 0x52474220
108#define JAS_ICC_COLORSPC_GRAY 0x47524159
109#define JAS_ICC_COLORSPC_HSV 0x48535620
110#define JAS_ICC_COLORSPC_HLS 0x484c5320
111#define JAS_ICC_COLORSPC_CMYK 0x434d594b
112#define JAS_ICC_COLORSPC_CMY 0x434d5920
113#define JAS_ICC_COLORSPC_2 0x32434c52
114#define JAS_ICC_COLORSPC_3 0x33434c52
115#define JAS_ICC_COLORSPC_4 0x34434c52
116#define JAS_ICC_COLORSPC_5 0x35434c52
117#define JAS_ICC_COLORSPC_6 0x36434c52
118#define JAS_ICC_COLORSPC_7 0x37434c52
119#define JAS_ICC_COLORSPC_8 0x38434c52
120#define JAS_ICC_COLORSPC_9 0x39434c52
121#define JAS_ICC_COLORSPC_10 0x41434c52
122#define JAS_ICC_COLORSPC_11 0x42434c52
123#define JAS_ICC_COLORSPC_12 0x43434c52
124#define JAS_ICC_COLORSPC_13 0x44434c52
125#define JAS_ICC_COLORSPC_14 0x45434c52
126#define JAS_ICC_COLORSPC_15 0x46434c52
129#define JAS_ICC_REFCOLORSPC_XYZ 0x58595a20
130#define JAS_ICC_REFCOLORSPC_LAB 0x4c616220
133#define JAS_ICC_PLATFORM_APPL 0x4150504c
134#define JAS_ICC_PLATFORM_MSFT 0x4d534654
135#define JAS_ICC_PLATFORM_SGI 0x53474920
136#define JAS_ICC_PLATFORM_SUNW 0x53554e57
137#define JAS_ICC_PLATFORM_TGNT 0x54474e54
140#define JAS_ICC_FLAGS_EMBED 0x01
141#define JAS_ICC_FLAGS_NOSEP 0x02
144#define JAS_ICC_ATTR_TRANS 0x01
145#define JAS_ICC_ATTR_MATTE 0x02
148#define JAS_ICC_INTENT_PER 0
149#define JAS_ICC_INTENT_REL 1
150#define JAS_ICC_INTENT_SAT 2
151#define JAS_ICC_INTENT_ABS 3
154#define JAS_ICC_TAG_ATOB0 0x41324230
155#define JAS_ICC_TAG_ATOB1 0x41324231
156#define JAS_ICC_TAG_ATOB2 0x41324232
157#define JAS_ICC_TAG_BLUMATCOL 0x6258595a
158#define JAS_ICC_TAG_BLUTRC 0x62545243
159#define JAS_ICC_TAG_BTOA0 0x42324130
160#define JAS_ICC_TAG_BTOA1 0x42324131
161#define JAS_ICC_TAG_BTOA2 0x42324132
162#define JAS_ICC_TAG_CALTIME 0x63616c74
163#define JAS_ICC_TAG_CHARTARGET 0x74617267
164#define JAS_ICC_TAG_CPYRT 0x63707274
165#define JAS_ICC_TAG_CRDINFO 0x63726469
166#define JAS_ICC_TAG_DEVMAKERDESC 0x646d6e64
167#define JAS_ICC_TAG_DEVMODELDESC 0x646d6464
168#define JAS_ICC_TAG_DEVSET 0x64657673
169#define JAS_ICC_TAG_GAMUT 0x67616d74
170#define JAS_ICC_TAG_GRYTRC 0x6b545243
171#define JAS_ICC_TAG_GRNMATCOL 0x6758595a
172#define JAS_ICC_TAG_GRNTRC 0x67545243
173#define JAS_ICC_TAG_LUM 0x6c756d69
174#define JAS_ICC_TAG_MEASURE 0x6d656173
175#define JAS_ICC_TAG_MEDIABLKPT 0x626b7074
176#define JAS_ICC_TAG_MEDIAWHIPT 0x77747074
177#define JAS_ICC_TAG_NAMCOLR 0x6e636f6c
178#define JAS_ICC_TAG_NAMCOLR2 0x6e636c32
179#define JAS_ICC_TAG_OUTRESP 0x72657370
180#define JAS_ICC_TAG_PREVIEW0 0x70726530
181#define JAS_ICC_TAG_PREVIEW1 0x70726531
182#define JAS_ICC_TAG_PREVIEW2 0x70726532
183#define JAS_ICC_TAG_PROFDESC 0x64657363
184#define JAS_ICC_TAG_PROFSEQDESC 0x70736571
185#define JAS_ICC_TAG_PSDCRD0 0x70736430
186#define JAS_ICC_TAG_PSCRDD1 0x70736431
187#define JAS_ICC_TAG_PSCRDD2 0x70736432
188#define JAS_ICC_TAG_PSCRDD3 0x70736433
189#define JAS_ICC_TAG_PS2CSA 0x70733273
190#define JAS_ICC_TAG_PS2RENINTENT 0x70733269
191#define JAS_ICC_TAG_REDMATCOL 0x7258595a
192#define JAS_ICC_TAG_REDTRC 0x72545243
193#define JAS_ICC_TAG_SCRNGDES 0x73637264
194#define JAS_ICC_TAG_SCRNG 0x7363726e
195#define JAS_ICC_TAG_TECH 0x74656368
196#define JAS_ICC_TAG_UCRBG 0x62666420
197#define JAS_ICC_TAG_VIEWCONDDESC 0x76756564
198#define JAS_ICC_TAG_VIEWCOND 0x76696577
201#define JAS_ICC_TYPE_CRDINFO 0x63726469
202#define JAS_ICC_TYPE_CURV 0x63757276
203#define JAS_ICC_TYPE_DATA 0x64617461
204#define JAS_ICC_TYPE_TIME 0x6474696d
205#define JAS_ICC_TYPE_DEVSET 0x64657673
206#define JAS_ICC_TYPE_LUT16 0x6d667432
207#define JAS_ICC_TYPE_LUT8 0x6d667431
208#define JAS_ICC_TYPE_MEASURE 0x6d656173
209#define JAS_ICC_TYPE_NAMCOLR 0x6e636f6c
210#define JAS_ICC_TYPE_NAMCOLR2 0x6e636c32
211#define JAS_ICC_TYPE_PROFSEQDESC 0x70736571
212#define JAS_ICC_TYPE_RESPCURVSET16 0x72637332
213#define JAS_ICC_TYPE_SF32 0x73663332
214#define JAS_ICC_TYPE_SCRNG 0x7363726e
215#define JAS_ICC_TYPE_SIG 0x73696720
216#define JAS_ICC_TYPE_TXTDESC 0x64657363
217#define JAS_ICC_TYPE_TXT 0x74657874
218#define JAS_ICC_TYPE_UF32 0x75663332
219#define JAS_ICC_TYPE_UCRBG 0x62666420
220#define JAS_ICC_TYPE_UI16 0x75693136
221#define JAS_ICC_TYPE_UI32 0x75693332
222#define JAS_ICC_TYPE_UI8 0x75693038
223#define JAS_ICC_TYPE_UI64 0x75693634
224#define JAS_ICC_TYPE_VIEWCOND 0x76696577
225#define JAS_ICC_TYPE_XYZ 0x58595a20
227typedef uint_fast8_t jas_iccuint8_t;
228typedef uint_fast16_t jas_iccuint16_t;
229typedef uint_fast32_t jas_iccuint32_t;
230typedef int_fast32_t jas_iccsint32_t;
231typedef int_fast32_t jas_iccs15fixed16_t;
232typedef uint_fast32_t jas_iccu16fixed16_t;
233typedef uint_fast64_t jas_iccuint64_t;
234typedef uint_fast32_t jas_iccsig_t;
236typedef jas_iccsig_t jas_icctagsig_t;
237typedef jas_iccsig_t jas_icctagtype_t;
238typedef jas_iccsig_t jas_iccattrname_t;
242 jas_iccuint16_t year;
243 jas_iccuint16_t month;
245 jas_iccuint16_t hour;
252 jas_iccs15fixed16_t x;
253 jas_iccs15fixed16_t y;
254 jas_iccs15fixed16_t z;
259 jas_iccuint32_t numents;
260 jas_iccuint16_t *ents;
265 jas_iccuint32_t asclen;
267 jas_iccuint32_t uclangcode;
268 jas_iccuint32_t uclen;
270 jas_iccuint16_t sccode;
271 jas_iccuint8_t maclen;
272 jas_uchar macdata[69];
281 jas_iccuint8_t numinchans;
282 jas_iccuint8_t numoutchans;
283 jas_iccsint32_t e[3][3];
284 jas_iccuint8_t clutlen;
285 jas_iccuint8_t *clut;
286 jas_iccuint16_t numintabents;
287 jas_iccuint8_t **intabs;
288 jas_iccuint8_t *intabsbuf;
289 jas_iccuint16_t numouttabents;
290 jas_iccuint8_t **outtabs;
291 jas_iccuint8_t *outtabsbuf;
295 jas_iccuint8_t numinchans;
296 jas_iccuint8_t numoutchans;
297 jas_iccsint32_t e[3][3];
298 jas_iccuint8_t clutlen;
299 jas_iccuint16_t *clut;
300 jas_iccuint16_t numintabents;
301 jas_iccuint16_t **intabs;
302 jas_iccuint16_t *intabsbuf;
303 jas_iccuint16_t numouttabents;
304 jas_iccuint16_t **outtabs;
305 jas_iccuint16_t *outtabsbuf;
308struct jas_iccattrval_s;
311 void (*destroy)(
struct jas_iccattrval_s *);
312 int (*copy)(
struct jas_iccattrval_s *,
const struct jas_iccattrval_s *);
313 int (*input)(
struct jas_iccattrval_s *,
jas_stream_t *, unsigned);
315 int (*output)(
struct jas_iccattrval_s *,
jas_stream_t *);
317 unsigned (*getsize)(
const struct jas_iccattrval_s *);
318 void (*dump)(
const struct jas_iccattrval_s *, FILE *);
319} jas_iccattrvalops_t;
322typedef struct jas_iccattrval_s {
325 const jas_iccattrvalops_t *ops;
329 jas_icctxtdesc_t txtdesc;
332 jas_icclut16_t lut16;
338 jas_iccuint32_t size;
339 jas_iccsig_t cmmtype;
340 jas_iccuint32_t version;
342 jas_iccsig_t colorspc;
343 jas_iccsig_t refcolorspc;
346 jas_iccsig_t platform;
347 jas_iccuint32_t flags;
350 jas_iccuint64_t attr;
353 jas_iccsig_t creator;
358 jas_iccattrval_t *val;
364 jas_iccattr_t *attrs;
367typedef struct jas_icctagtabent_s {
372 struct jas_icctagtabent_s *first;
376 jas_iccuint32_t numents;
377 jas_icctagtabent_t *ents;
383 jas_icctagtab_t tagtab;
384 jas_iccattrtab_t *attrtab;
388 jas_iccuint32_t type;
389 jas_iccattrvalops_t ops;
390} jas_iccattrvalinfo_t;
420 jas_iccattrname_t name);
428 jas_iccattrval_t *val);
470void jas_iccattrval_dump(
const jas_iccattrval_t *attrval, FILE *out);
517extern const jas_uchar jas_iccprofdata_srgb[];
520extern const unsigned jas_iccprofdata_srgblen;
523extern const jas_uchar jas_iccprofdata_sgray[];
526extern const unsigned jas_iccprofdata_sgraylen;
JAS_EXPORT int jas_iccprof_save(jas_iccprof_t *prof, jas_stream_t *out)
Write an ICC profile to a stream.
Definition jas_icc.c:428
JAS_EXPORT jas_iccprof_t * jas_iccprof_load(jas_stream_t *in)
Read an ICC profile from a stream.
Definition jas_icc.c:330
JAS_EXPORT void jas_iccprof_destroy(jas_iccprof_t *prof)
Destroy an ICC profile.
Definition jas_icc.c:314
JAS_ATTRIBUTE_PURE JAS_EXPORT jas_iccattrval_t * jas_iccprof_getattr(const jas_iccprof_t *prof, jas_iccattrname_t name)
Get an attribute of an ICC profile.
Definition jas_icc.c:623
JAS_EXPORT jas_iccattrval_t * jas_iccattrval_create(jas_iccuint32_t type)
Create an ICC profile attribute.
Definition jas_icc.c:936
JAS_EXPORT void jas_iccattrval_destroy(jas_iccattrval_t *attrval)
Destroy an ICC profile attribute.
Definition jas_icc.c:962
JAS_EXPORT int jas_iccprof_sethdr(jas_iccprof_t *prof, const jas_icchdr_t *hdr)
Set the header for an ICC profile.
Definition jas_icc.c:671
JAS_EXPORT void jas_iccattrtab_dump(const jas_iccattrtab_t *attrtab, FILE *out)
Dump an ICC profile attribute to a stream in human-readable format for debugging purposes.
Definition jas_icc.c:808
JAS_EXPORT int jas_iccprof_setattr(jas_iccprof_t *prof, jas_iccattrname_t name, jas_iccattrval_t *val)
Set an attribute of an ICC profile.
Definition jas_icc.c:639
JAS_EXPORT int jas_iccattrval_allowmodify(jas_iccattrval_t **attrval)
TODO/FIXME.
Definition jas_icc.c:986
JAS_EXPORT jas_iccprof_t * jas_iccprof_copy(const jas_iccprof_t *prof)
Create a copy of an ICC profile.
Definition jas_icc.c:291
JAS_EXPORT jas_iccattrval_t * jas_iccattrval_clone(jas_iccattrval_t *attrval)
Create a copy of an ICC profile attribute.
Definition jas_icc.c:956
JAS_EXPORT void jas_iccprof_dump(const jas_iccprof_t *prof, FILE *out)
Dump an ICC profile to a stream in human-readable format for debugging purposes.
Definition jas_icc.c:325
JAS_EXPORT int jas_iccprof_gethdr(const jas_iccprof_t *prof, jas_icchdr_t *hdr)
Get the header for an ICC profile.
Definition jas_icc.c:665
JAS_EXPORT jas_iccprof_t * jas_iccprof_createfromclrspc(unsigned clrspc)
Create an ICC profile from a color space.
Definition jas_icc.c:1892
JAS_EXPORT jas_iccprof_t * jas_iccprof_createfrombuf(const jas_uchar *buf, unsigned len)
Create an ICC profile from a buffer in memory.
Definition jas_icc.c:1871
I/O stream object.
Definition jas_stream.h:206