1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/qcms/qcms.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,179 @@ 1.4 +#ifndef QCMS_H 1.5 +#define QCMS_H 1.6 + 1.7 +#ifdef __cplusplus 1.8 +extern "C" { 1.9 +#endif 1.10 + 1.11 +/* if we've already got an ICC_H header we can ignore the following */ 1.12 +#ifndef ICC_H 1.13 +/* icc34 defines */ 1.14 + 1.15 +/***************************************************************** 1.16 + Copyright (c) 1994-1996 SunSoft, Inc. 1.17 + 1.18 + Rights Reserved 1.19 + 1.20 +Permission is hereby granted, free of charge, to any person 1.21 +obtaining a copy of this software and associated documentation 1.22 +files (the "Software"), to deal in the Software without restrict- 1.23 +ion, including without limitation the rights to use, copy, modify, 1.24 +merge, publish distribute, sublicense, and/or sell copies of the 1.25 +Software, and to permit persons to whom the Software is furnished 1.26 +to do so, subject to the following conditions: 1.27 + 1.28 +The above copyright notice and this permission notice shall be 1.29 +included in all copies or substantial portions of the Software. 1.30 + 1.31 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 1.32 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 1.33 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- 1.34 +INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT 1.35 +COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 1.36 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1.37 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 1.38 +OTHER DEALINGS IN THE SOFTWARE. 1.39 + 1.40 +Except as contained in this notice, the name of SunSoft, Inc. 1.41 +shall not be used in advertising or otherwise to promote the 1.42 +sale, use or other dealings in this Software without written 1.43 +authorization from SunSoft Inc. 1.44 +******************************************************************/ 1.45 + 1.46 +/* 1.47 + * QCMS, in general, is not threadsafe. However, it should be safe to create 1.48 + * profile and transformation objects on different threads, so long as you 1.49 + * don't use the same objects on different threads at the same time. 1.50 + */ 1.51 + 1.52 +/* 1.53 + * Color Space Signatures 1.54 + * Note that only icSigXYZData and icSigLabData are valid 1.55 + * Profile Connection Spaces (PCSs) 1.56 + */ 1.57 +typedef enum { 1.58 + icSigXYZData = 0x58595A20L, /* 'XYZ ' */ 1.59 + icSigLabData = 0x4C616220L, /* 'Lab ' */ 1.60 + icSigLuvData = 0x4C757620L, /* 'Luv ' */ 1.61 + icSigYCbCrData = 0x59436272L, /* 'YCbr' */ 1.62 + icSigYxyData = 0x59787920L, /* 'Yxy ' */ 1.63 + icSigRgbData = 0x52474220L, /* 'RGB ' */ 1.64 + icSigGrayData = 0x47524159L, /* 'GRAY' */ 1.65 + icSigHsvData = 0x48535620L, /* 'HSV ' */ 1.66 + icSigHlsData = 0x484C5320L, /* 'HLS ' */ 1.67 + icSigCmykData = 0x434D594BL, /* 'CMYK' */ 1.68 + icSigCmyData = 0x434D5920L, /* 'CMY ' */ 1.69 + icSig2colorData = 0x32434C52L, /* '2CLR' */ 1.70 + icSig3colorData = 0x33434C52L, /* '3CLR' */ 1.71 + icSig4colorData = 0x34434C52L, /* '4CLR' */ 1.72 + icSig5colorData = 0x35434C52L, /* '5CLR' */ 1.73 + icSig6colorData = 0x36434C52L, /* '6CLR' */ 1.74 + icSig7colorData = 0x37434C52L, /* '7CLR' */ 1.75 + icSig8colorData = 0x38434C52L, /* '8CLR' */ 1.76 + icSig9colorData = 0x39434C52L, /* '9CLR' */ 1.77 + icSig10colorData = 0x41434C52L, /* 'ACLR' */ 1.78 + icSig11colorData = 0x42434C52L, /* 'BCLR' */ 1.79 + icSig12colorData = 0x43434C52L, /* 'CCLR' */ 1.80 + icSig13colorData = 0x44434C52L, /* 'DCLR' */ 1.81 + icSig14colorData = 0x45434C52L, /* 'ECLR' */ 1.82 + icSig15colorData = 0x46434C52L, /* 'FCLR' */ 1.83 + icMaxEnumData = 0xFFFFFFFFL 1.84 +} icColorSpaceSignature; 1.85 +#endif 1.86 + 1.87 +#include <stdio.h> 1.88 + 1.89 +typedef int qcms_bool; 1.90 + 1.91 +struct _qcms_transform; 1.92 +typedef struct _qcms_transform qcms_transform; 1.93 + 1.94 +struct _qcms_profile; 1.95 +typedef struct _qcms_profile qcms_profile; 1.96 + 1.97 +/* these values match the Rendering Intent values from the ICC spec */ 1.98 +typedef enum { 1.99 + QCMS_INTENT_MIN = 0, 1.100 + QCMS_INTENT_PERCEPTUAL = 0, 1.101 + QCMS_INTENT_RELATIVE_COLORIMETRIC = 1, 1.102 + QCMS_INTENT_SATURATION = 2, 1.103 + QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3, 1.104 + QCMS_INTENT_MAX = 3, 1.105 + 1.106 + /* Chris Murphy (CM consultant) suggests this as a default in the event that we 1.107 + * cannot reproduce relative + Black Point Compensation. BPC brings an 1.108 + * unacceptable performance overhead, so we go with perceptual. */ 1.109 + QCMS_INTENT_DEFAULT = QCMS_INTENT_PERCEPTUAL, 1.110 +} qcms_intent; 1.111 + 1.112 +//XXX: I don't really like the _DATA_ prefix 1.113 +typedef enum { 1.114 + QCMS_DATA_RGB_8, 1.115 + QCMS_DATA_RGBA_8, 1.116 + QCMS_DATA_GRAY_8, 1.117 + QCMS_DATA_GRAYA_8 1.118 +} qcms_data_type; 1.119 + 1.120 +/* the names for the following two types are sort of ugly */ 1.121 +typedef struct 1.122 +{ 1.123 + double x; 1.124 + double y; 1.125 + double Y; 1.126 +} qcms_CIE_xyY; 1.127 + 1.128 +typedef struct 1.129 +{ 1.130 + qcms_CIE_xyY red; 1.131 + qcms_CIE_xyY green; 1.132 + qcms_CIE_xyY blue; 1.133 +} qcms_CIE_xyYTRIPLE; 1.134 + 1.135 +qcms_profile* qcms_profile_create_rgb_with_gamma( 1.136 + qcms_CIE_xyY white_point, 1.137 + qcms_CIE_xyYTRIPLE primaries, 1.138 + float gamma); 1.139 + 1.140 +void qcms_data_create_rgb_with_gamma( 1.141 + qcms_CIE_xyY white_point, 1.142 + qcms_CIE_xyYTRIPLE primaries, 1.143 + float gamma, 1.144 + void **mem, 1.145 + size_t *size); 1.146 + 1.147 +qcms_profile* qcms_profile_from_memory(const void *mem, size_t size); 1.148 + 1.149 +qcms_profile* qcms_profile_from_file(FILE *file); 1.150 +qcms_profile* qcms_profile_from_path(const char *path); 1.151 + 1.152 +void qcms_data_from_path(const char *path, void **mem, size_t *size); 1.153 + 1.154 +#ifdef _WIN32 1.155 +qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path); 1.156 +void qcms_data_from_unicode_path(const wchar_t *path, void **mem, size_t *size); 1.157 +#endif 1.158 +qcms_profile* qcms_profile_sRGB(void); 1.159 +void qcms_profile_release(qcms_profile *profile); 1.160 + 1.161 +qcms_bool qcms_profile_is_bogus(qcms_profile *profile); 1.162 +qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile); 1.163 +icColorSpaceSignature qcms_profile_get_color_space(qcms_profile *profile); 1.164 + 1.165 +void qcms_profile_precache_output_transform(qcms_profile *profile); 1.166 + 1.167 +qcms_transform* qcms_transform_create( 1.168 + qcms_profile *in, qcms_data_type in_type, 1.169 + qcms_profile* out, qcms_data_type out_type, 1.170 + qcms_intent intent); 1.171 + 1.172 +void qcms_transform_release(qcms_transform *); 1.173 + 1.174 +void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length); 1.175 + 1.176 +void qcms_enable_iccv4(); 1.177 + 1.178 +#ifdef __cplusplus 1.179 +} 1.180 +#endif 1.181 + 1.182 +#endif