OLD | NEW |
(Empty) | |
| 1 /* vim: set ts=8 sw=8 noexpandtab: */ |
| 2 // qcms |
| 3 // Copyright (C) 2009 Mozilla Foundation |
| 4 // |
| 5 // Permission is hereby granted, free of charge, to any person obtaining |
| 6 // a copy of this software and associated documentation files (the "Software"), |
| 7 // to deal in the Software without restriction, including without limitation |
| 8 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
| 10 // is furnished to do so, subject to the following conditions: |
| 11 // |
| 12 // The above copyright notice and this permission notice shall be included in |
| 13 // all copies or substantial portions of the Software. |
| 14 // |
| 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
| 17 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 |
| 23 #ifndef QCMS_H |
| 24 #define QCMS_H |
| 25 |
| 26 #ifdef __cplusplus |
| 27 extern "C" { |
| 28 #endif |
| 29 |
| 30 #include <stdio.h> |
| 31 |
| 32 struct _qcms_profile; |
| 33 typedef struct _qcms_profile qcms_profile; |
| 34 |
| 35 struct _qcms_transform; |
| 36 typedef struct _qcms_transform qcms_transform; |
| 37 |
| 38 typedef int qcms_bool; |
| 39 |
| 40 /* ICC Section 6.1.5 Color Space Signatures (abridged) */ |
| 41 typedef enum { |
| 42 XYZData /* ‘XYZ ’ */ = 0x58595A20, |
| 43 labData /* ‘Lab ’ */ = 0x4C616220, |
| 44 luvData /* ‘Luv ’ */ = 0x4C757620, |
| 45 YCbCrData /* ‘YCbr' */ = 0x59436272, |
| 46 YxyData /* ‘Yxy ’ */ = 0x59787920, |
| 47 rgbData /* ‘RGB ’ */ = 0x52474220, |
| 48 grayData /* ‘GRAY’ */ = 0x47524159, |
| 49 hsvData /* ‘HSV ’ */ = 0x48535620, |
| 50 hlsData /* ‘HLS ’ */ = 0x484C5320, |
| 51 cmykData /* ‘CMYK’ */ = 0x434D594B, |
| 52 cmyData /* ‘CMY ’ */ = 0x434D5920, |
| 53 } qcms_color_space; |
| 54 |
| 55 /* ICC Section 6.1.11 Rendering Intents */ |
| 56 typedef enum { |
| 57 QCMS_INTENT_DEFAULT = 0, |
| 58 QCMS_INTENT_PERCEPTUAL = 0, |
| 59 QCMS_INTENT_RELATIVE_COLORIMETRIC = 1, |
| 60 QCMS_INTENT_SATURATION = 2, |
| 61 QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3 |
| 62 } qcms_intent; |
| 63 |
| 64 /* Input data formats */ |
| 65 typedef enum { |
| 66 QCMS_DATA_RGB_8, |
| 67 QCMS_DATA_RGBA_8, |
| 68 QCMS_DATA_GRAY_8, |
| 69 QCMS_DATA_GRAYA_8 |
| 70 } qcms_data_type; |
| 71 |
| 72 /* Output data format for qcms_transform_data_type() */ |
| 73 typedef enum { |
| 74 QCMS_OUTPUT_RGBX, |
| 75 QCMS_OUTPUT_BGRX |
| 76 } qcms_output_type; |
| 77 |
| 78 /* Output data format for qcms_transform_get_input|output_trc_rgba() */ |
| 79 typedef enum { |
| 80 QCMS_TRC_PARAMETRIC, // Not implemented. |
| 81 QCMS_TRC_FLOAT, // Not implemented. |
| 82 QCMS_TRC_HALF_FLOAT, // IEE754: binary16. |
| 83 QCMS_TRC_USHORT, // 0.16 fixed point. |
| 84 } qcms_trc_type; |
| 85 |
| 86 typedef struct { |
| 87 double x; |
| 88 double y; |
| 89 double Y; |
| 90 } qcms_CIE_xyY; |
| 91 |
| 92 typedef struct { |
| 93 qcms_CIE_xyY red; |
| 94 qcms_CIE_xyY green; |
| 95 qcms_CIE_xyY blue; |
| 96 } qcms_CIE_xyYTRIPLE; |
| 97 |
| 98 typedef struct { |
| 99 float X; |
| 100 float Y; |
| 101 float Z; |
| 102 } qcms_xyz_float; |
| 103 |
| 104 qcms_profile* qcms_profile_create_rgb_with_gamma( |
| 105 qcms_CIE_xyY white_point, |
| 106 qcms_CIE_xyYTRIPLE primaries, |
| 107 float gamma); |
| 108 |
| 109 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size); |
| 110 |
| 111 qcms_profile* qcms_profile_from_file(FILE *file); |
| 112 qcms_profile* qcms_profile_from_path(const char *path); |
| 113 #ifdef _WIN32 |
| 114 qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path); |
| 115 #endif |
| 116 qcms_profile* qcms_profile_sRGB(void); |
| 117 void qcms_profile_release(qcms_profile *profile); |
| 118 |
| 119 qcms_bool qcms_profile_is_bogus(qcms_profile *profile); |
| 120 qcms_bool qcms_profile_has_white_point(qcms_profile *profile); |
| 121 qcms_xyz_float qcms_profile_get_white_point(qcms_profile *profile); |
| 122 qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile); |
| 123 qcms_color_space qcms_profile_get_color_space(qcms_profile *profile); |
| 124 unsigned qcms_profile_get_version(qcms_profile *profile); |
| 125 qcms_bool qcms_profile_white_transform(qcms_profile *profile, float XYZ[3]); |
| 126 |
| 127 qcms_bool qcms_profile_match(qcms_profile *p1, qcms_profile *p2); |
| 128 const char* qcms_profile_get_description(qcms_profile *profile); |
| 129 |
| 130 void qcms_profile_precache_output_transform(qcms_profile *profile); |
| 131 |
| 132 size_t qcms_profile_get_vcgt_channel_length(qcms_profile *profile); |
| 133 qcms_bool qcms_profile_get_vcgt_rgb_channels(qcms_profile *profile, unsigned sho
rt *data); |
| 134 |
| 135 float qcms_profile_ntsc_relative_gamut_size(qcms_profile *profile); |
| 136 |
| 137 qcms_transform* qcms_transform_create( |
| 138 qcms_profile *in, qcms_data_type in_type, |
| 139 qcms_profile *out, qcms_data_type out_type, |
| 140 qcms_intent intent); |
| 141 |
| 142 size_t qcms_transform_get_input_trc_rgba( |
| 143 qcms_transform *transform, qcms_profile *in, qcms_trc_type type,
unsigned short *data); |
| 144 size_t qcms_transform_get_output_trc_rgba( |
| 145 qcms_transform *transform, qcms_profile *out, qcms_trc_type type
, unsigned short *data); |
| 146 |
| 147 qcms_bool qcms_transform_is_matrix(qcms_transform *transform); |
| 148 float qcms_transform_get_matrix(qcms_transform *transform, unsigned i, unsigned
j); |
| 149 |
| 150 qcms_bool qcms_transform_create_LUT_zyx_bgra( |
| 151 qcms_profile *in, qcms_profile *out, qcms_intent intent, |
| 152 int samples, unsigned char* lut); |
| 153 |
| 154 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length); |
| 155 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type); |
| 156 |
| 157 void qcms_transform_release(qcms_transform *); |
| 158 |
| 159 void qcms_enable_iccv4(); |
| 160 |
| 161 #ifdef __cplusplus |
| 162 } |
| 163 #endif |
| 164 |
| 165 /* |
| 166 * In general, QCMS is not threadsafe. However, it should be safe to create |
| 167 * profile and transformation objects on different threads, so long as you |
| 168 * don't use the same objects on different threads at the same time. |
| 169 */ |
| 170 |
| 171 #endif |
OLD | NEW |