1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2010-2014 Richard Hughes <richard@hughsie.com>
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__COLORD_H_INSIDE__) && !defined (CD_COMPILATION)
#error "Only <colord.h> can be included directly."
#endif
#ifndef __CD_COLOR_H__
#define __CD_COLOR_H__
#include <glib-object.h>
G_BEGIN_DECLS
typedef struct {
guint8 R;
guint8 G;
guint8 B;
} CdColorRGB8;
typedef struct {
gdouble L;
gdouble a;
gdouble b;
} CdColorLab;
typedef struct {
gdouble Y;
gdouble x;
gdouble y;
} CdColorYxy;
typedef struct {
gdouble X;
gdouble Y;
gdouble Z;
} CdColorXYZ;
typedef struct {
gdouble R;
gdouble G;
gdouble B;
} CdColorRGB;
typedef struct {
gdouble U;
gdouble V;
gdouble W;
} CdColorUVW;
/**
* CdColorBlackbodyFlags:
* @CD_COLOR_BLACKBODY_FLAG_NONE: No flags set.
* @CD_COLOR_BLACKBODY_FLAG_USE_PLANCKIAN: Use Planckian below 5000K
*
* Flags used when returning an RGB color from a temperature.
*
* Since: 1.3.5
**/
typedef enum {
CD_COLOR_BLACKBODY_FLAG_NONE, /* Since: 1.3.5 */
CD_COLOR_BLACKBODY_FLAG_USE_PLANCKIAN, /* Since: 1.3.5 */
/*< private >*/
CD_COLOR_BLACKBODY_FLAG_LAST
} CdColorBlackbodyFlags;
typedef struct _CdColorSwatch CdColorSwatch;
#define CD_TYPE_COLOR_RGB (cd_color_rgb_get_type ())
#define CD_TYPE_COLOR_XYZ (cd_color_xyz_get_type ())
#define CD_TYPE_COLOR_LAB (cd_color_lab_get_type ())
#define CD_TYPE_COLOR_YXY (cd_color_yxy_get_type ())
#define CD_TYPE_COLOR_UVW (cd_color_uvw_get_type ())
#define CD_TYPE_COLOR_SWATCH (cd_color_swatch_get_type ())
/* types */
GType cd_color_xyz_get_type (void);
GType cd_color_lab_get_type (void);
GType cd_color_rgb_get_type (void);
GType cd_color_yxy_get_type (void);
GType cd_color_uvw_get_type (void);
GType cd_color_swatch_get_type (void);
const gchar *cd_color_swatch_get_name (const CdColorSwatch *swatch);
const CdColorLab*cd_color_swatch_get_value (const CdColorSwatch *swatch);
CdColorXYZ *cd_color_xyz_new (void);
CdColorLab *cd_color_lab_new (void);
CdColorRGB *cd_color_rgb_new (void);
CdColorYxy *cd_color_yxy_new (void);
CdColorUVW *cd_color_uvw_new (void);
CdColorSwatch *cd_color_swatch_new (void);
void cd_color_xyz_free (CdColorXYZ *src);
void cd_color_rgb_free (CdColorRGB *src);
void cd_color_lab_free (CdColorLab *src);
void cd_color_yxy_free (CdColorYxy *src);
void cd_color_uvw_free (CdColorUVW *src);
void cd_color_swatch_free (CdColorSwatch *src);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorXYZ, cd_color_xyz_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorRGB, cd_color_rgb_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorLab, cd_color_lab_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorYxy, cd_color_yxy_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorUVW, cd_color_uvw_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CdColorSwatch, cd_color_swatch_free)
CdColorXYZ *cd_color_xyz_dup (const CdColorXYZ *src);
CdColorLab *cd_color_lab_dup (const CdColorLab *src);
CdColorRGB *cd_color_rgb_dup (const CdColorRGB *src);
CdColorYxy *cd_color_yxy_dup (const CdColorYxy *src);
CdColorUVW *cd_color_uvw_dup (const CdColorUVW *src);
CdColorSwatch *cd_color_swatch_dup (const CdColorSwatch *src);
void cd_color_xyz_set (CdColorXYZ *dest,
gdouble X,
gdouble Y,
gdouble Z);
void cd_color_rgb_set (CdColorRGB *dest,
gdouble R,
gdouble G,
gdouble B);
void cd_color_lab_set (CdColorLab *dest,
gdouble L,
gdouble a,
gdouble b);
void cd_color_yxy_set (CdColorYxy *dest,
gdouble Y,
gdouble x,
gdouble y);
void cd_color_uvw_set (CdColorUVW *dest,
gdouble U,
gdouble V,
gdouble W);
void cd_color_swatch_set_name (CdColorSwatch *dest,
const gchar *name);
void cd_color_swatch_set_value (CdColorSwatch *dest,
const CdColorLab *value);
void cd_color_xyz_copy (const CdColorXYZ *src,
CdColorXYZ *dest);
void cd_color_yxy_copy (const CdColorYxy *src,
CdColorYxy *dest);
void cd_color_uvw_copy (const CdColorUVW *src,
CdColorUVW *dest);
void cd_color_lab_copy (const CdColorLab *src,
CdColorLab *dest);
gdouble cd_color_lab_delta_e76 (const CdColorLab *p1,
const CdColorLab *p2);
void cd_color_xyz_clear (CdColorXYZ *dest);
void cd_color_rgb_copy (const CdColorRGB *src,
CdColorRGB *dest);
void cd_color_rgb8_to_rgb (const CdColorRGB8 *src,
CdColorRGB *dest);
void cd_color_rgb_to_rgb8 (const CdColorRGB *src,
CdColorRGB8 *dest);
void cd_color_yxy_to_xyz (const CdColorYxy *src,
CdColorXYZ *dest);
void cd_color_xyz_to_yxy (const CdColorXYZ *src,
CdColorYxy *dest);
void cd_color_xyz_to_uvw (const CdColorXYZ *src,
const CdColorXYZ *whitepoint,
CdColorUVW *dest);
void cd_color_yxy_to_uvw (const CdColorYxy *src,
CdColorUVW *dest);
void cd_color_uvw_set_planckian_locus (CdColorUVW *dest,
gdouble temp);
gdouble cd_color_uvw_get_chroma_difference (const CdColorUVW *p1,
const CdColorUVW *p2);
gboolean cd_color_get_blackbody_rgb (guint temp,
CdColorRGB *result);
gboolean cd_color_get_blackbody_rgb_full (gdouble temp,
CdColorRGB *result,
CdColorBlackbodyFlags flags);
void cd_color_rgb_interpolate (const CdColorRGB *p1,
const CdColorRGB *p2,
gdouble index,
CdColorRGB *result);
void cd_color_rgb_from_wavelength (CdColorRGB *dest,
gdouble wavelength);
gdouble cd_color_xyz_to_cct (const CdColorXYZ *src);
void cd_color_xyz_normalize (const CdColorXYZ *src,
gdouble max,
CdColorXYZ *dest);
GPtrArray *cd_color_rgb_array_new (void);
gboolean cd_color_rgb_array_is_monotonic (const GPtrArray *array);
GPtrArray *cd_color_rgb_array_interpolate (const GPtrArray *array,
guint new_length)
G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
#endif /* __CD_COLOR_H__ */
|