Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / third_party / qcms / src / qcms.h
blobe89a315ce9584dd82a83e5db7ab8933e0fc7f140
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 Software
10 // is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
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.
23 #ifndef QCMS_H
24 #define QCMS_H
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 #include <stdio.h>
32 struct _qcms_profile;
33 typedef struct _qcms_profile qcms_profile;
35 struct _qcms_transform;
36 typedef struct _qcms_transform qcms_transform;
38 typedef int qcms_bool;
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;
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;
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;
72 /* Output data format for qcms_transform_data_type() */
73 typedef enum {
74 QCMS_OUTPUT_RGBX,
75 QCMS_OUTPUT_BGRX
76 } qcms_output_type;
78 /* Output data format for qcms_transform_get_input|output_trc_rgba() */
79 typedef enum {
80 QCMS_TRC_PARAMETRIC,
81 QCMS_TRC_FLOAT,
82 QCMS_TRC_HALF_FLOAT, // XXX: only type implemented.
83 QCMS_TRC_USHORT,
84 } qcms_trc_type;
86 typedef struct {
87 double x;
88 double y;
89 double Y;
90 } qcms_CIE_xyY;
92 typedef struct {
93 qcms_CIE_xyY red;
94 qcms_CIE_xyY green;
95 qcms_CIE_xyY blue;
96 } qcms_CIE_xyYTRIPLE;
98 qcms_profile* qcms_profile_create_rgb_with_gamma(
99 qcms_CIE_xyY white_point,
100 qcms_CIE_xyYTRIPLE primaries,
101 float gamma);
103 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size);
105 qcms_profile* qcms_profile_from_file(FILE *file);
106 qcms_profile* qcms_profile_from_path(const char *path);
107 #ifdef _WIN32
108 qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path);
109 #endif
110 qcms_profile* qcms_profile_sRGB(void);
111 void qcms_profile_release(qcms_profile *profile);
113 qcms_bool qcms_profile_is_bogus(qcms_profile *profile);
114 qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile);
115 qcms_color_space qcms_profile_get_color_space(qcms_profile *profile);
117 qcms_bool qcms_profile_match(qcms_profile *p1, qcms_profile *p2);
118 const char* qcms_profile_get_description(qcms_profile *profile);
120 void qcms_profile_precache_output_transform(qcms_profile *profile);
122 size_t qcms_profile_get_vcgt_channel_length(qcms_profile *profile);
123 qcms_bool qcms_profile_get_vcgt_rgb_channels(qcms_profile *profile, unsigned short *data);
125 qcms_transform* qcms_transform_create(
126 qcms_profile *in, qcms_data_type in_type,
127 qcms_profile *out, qcms_data_type out_type,
128 qcms_intent intent);
130 size_t qcms_transform_get_input_trc_rgba(
131 qcms_transform *transform, qcms_profile *in, qcms_trc_type type, unsigned short *data);
132 size_t qcms_transform_get_output_trc_rgba(
133 qcms_transform *transform, qcms_profile *out, qcms_trc_type type, unsigned short *data);
135 qcms_bool qcms_transform_is_matrix(qcms_transform *transform);
136 float qcms_transform_get_matrix(qcms_transform *transform, unsigned i, unsigned j);
138 qcms_bool qcms_transform_create_LUT_zyx_bgra(
139 qcms_profile *in, qcms_profile *out, qcms_intent intent,
140 int samples, unsigned char* lut);
142 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length);
143 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, size_t length, qcms_output_type type);
145 void qcms_transform_release(qcms_transform *);
147 void qcms_enable_iccv4();
149 #ifdef __cplusplus
151 #endif
154 * In general, QCMS is not threadsafe. However, it should be safe to create
155 * profile and transformation objects on different threads, so long as you
156 * don't use the same objects on different threads at the same time.
159 #endif