~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to clutter/cogl/cogl-color.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Cogl
3
 
 *
4
 
 * An object oriented GL/GLES Abstraction/Utility Layer
5
 
 *
6
 
 * Copyright (C) 2008,2009 Intel Corporation.
7
 
 *
8
 
 * This library is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Lesser General Public
10
 
 * License as published by the Free Software Foundation; either
11
 
 * version 2 of the License, or (at your option) any later version.
12
 
 *
13
 
 * This library is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * Lesser General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU Lesser General Public
19
 
 * License along with this library; if not, write to the
20
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
 * Boston, MA 02111-1307, USA.
22
 
 */
23
 
 
24
 
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25
 
#error "Only <cogl/cogl.h> can be included directly."
26
 
#endif
27
 
 
28
 
#ifndef __COGL_COLOR_H__
29
 
#define __COGL_COLOR_H__
30
 
 
31
 
#include <cogl/cogl-types.h>
32
 
 
33
 
G_BEGIN_DECLS
34
 
 
35
 
CoglColor *cogl_color_new  (void);
36
 
CoglColor *cogl_color_copy (const CoglColor *color);
37
 
void       cogl_color_free (CoglColor       *color);
38
 
 
39
 
/**
40
 
 * cogl_color_set_from_4ub:
41
 
 * @dest: return location for a #CoglColor
42
 
 * @red: value of the red channel, between 0 and 255
43
 
 * @green: value of the green channel, between 0 and 255
44
 
 * @blue: value of the blue channel, between 0 and 255
45
 
 * @alpha: value of the alpha channel, between 0 and 255
46
 
 *
47
 
 * Sets the values of the passed channels into a #CoglColor.
48
 
 *
49
 
 * Since: 1.0
50
 
 */
51
 
void cogl_color_set_from_4ub (CoglColor *dest,
52
 
                              guint8 red,
53
 
                              guint8 green,
54
 
                              guint8 blue,
55
 
                              guint8 alpha);
56
 
 
57
 
/**
58
 
 * cogl_color_set_from_4f:
59
 
 * @dest: return location for a #CoglColor
60
 
 * @red: value of the red channel, between 0 and %1.0
61
 
 * @green: value of the green channel, between 0 and %1.0
62
 
 * @blue: value of the blue channel, between 0 and %1.0
63
 
 * @alpha: value of the alpha channel, between 0 and %1.0
64
 
 *
65
 
 * Sets the values of the passed channels into a #CoglColor
66
 
 *
67
 
 * Since: 1.0
68
 
 */
69
 
void cogl_color_set_from_4f (CoglColor *dest,
70
 
                             float  red,
71
 
                             float  green,
72
 
                             float  blue,
73
 
                             float  alpha);
74
 
 
75
 
/**
76
 
 * cogl_color_get_red_byte:
77
 
 * @color: a #CoglColor
78
 
 *
79
 
 * Retrieves the red channel of @color as a byte value
80
 
 * between 0 and 255
81
 
 *
82
 
 * Return value: the red channel of the passed color
83
 
 *
84
 
 * Since: 1.0
85
 
 */
86
 
unsigned char cogl_color_get_red_byte    (const CoglColor *color);
87
 
 
88
 
/**
89
 
 * cogl_color_get_green_byte:
90
 
 * @color: a #CoglColor
91
 
 *
92
 
 * Retrieves the green channel of @color as a byte value
93
 
 * between 0 and 255
94
 
 *
95
 
 * Return value: the green channel of the passed color
96
 
 *
97
 
 * Since: 1.0
98
 
 */
99
 
unsigned char cogl_color_get_green_byte   (const CoglColor *color);
100
 
 
101
 
/**
102
 
 * cogl_color_get_blue_byte:
103
 
 * @color: a #CoglColor
104
 
 *
105
 
 * Retrieves the blue channel of @color as a byte value
106
 
 * between 0 and 255
107
 
 *
108
 
 * Return value: the blue channel of the passed color
109
 
 *
110
 
 * Since: 1.0
111
 
 */
112
 
unsigned char cogl_color_get_blue_byte   (const CoglColor *color);
113
 
 
114
 
/**
115
 
 * cogl_color_get_alpha_byte:
116
 
 * @color: a #CoglColor
117
 
 *
118
 
 * Retrieves the alpha channel of @color as a byte value
119
 
 * between 0 and 255
120
 
 *
121
 
 * Return value: the alpha channel of the passed color
122
 
 *
123
 
 * Since: 1.0
124
 
 */
125
 
unsigned char cogl_color_get_alpha_byte  (const CoglColor *color);
126
 
 
127
 
/**
128
 
 * cogl_color_get_red_float:
129
 
 * @color: a #CoglColor
130
 
 *
131
 
 * Retrieves the red channel of @color as a floating point
132
 
 * value between 0.0 and 1.0
133
 
 *
134
 
 * Return value: the red channel of the passed color
135
 
 *
136
 
 * Since: 1.0
137
 
 */
138
 
float         cogl_color_get_red_float   (const CoglColor *color);
139
 
 
140
 
/**
141
 
 * cogl_color_get_green_float:
142
 
 * @color: a #CoglColor
143
 
 *
144
 
 * Retrieves the green channel of @color as a floating point
145
 
 * value between 0.0 and 1.0
146
 
 *
147
 
 * Return value: the green channel of the passed color
148
 
 *
149
 
 * Since: 1.0
150
 
 */
151
 
float         cogl_color_get_green_float (const CoglColor *color);
152
 
 
153
 
/**
154
 
 * cogl_color_get_blue_float:
155
 
 * @color: a #CoglColor
156
 
 *
157
 
 * Retrieves the blue channel of @color as a floating point
158
 
 * value between 0.0 and 1.0
159
 
 *
160
 
 * Return value: the blue channel of the passed color
161
 
 *
162
 
 * Since: 1.0
163
 
 */
164
 
float         cogl_color_get_blue_float  (const CoglColor *color);
165
 
 
166
 
/**
167
 
 * cogl_color_get_alpha_float:
168
 
 * @color: a #CoglColor
169
 
 *
170
 
 * Retrieves the alpha channel of @color as a floating point
171
 
 * value between 0.0 and 1.0
172
 
 *
173
 
 * Return value: the alpha channel of the passed color
174
 
 *
175
 
 * Since: 1.0
176
 
 */
177
 
float         cogl_color_get_alpha_float (const CoglColor *color);
178
 
 
179
 
/**
180
 
 * cogl_color_get_red:
181
 
 * @color: a #CoglColor
182
 
 *
183
 
 * Retrieves the red channel of @color as a fixed point
184
 
 * value between 0 and %1.0.
185
 
 *
186
 
 * Return value: the red channel of the passed color
187
 
 *
188
 
 * Since: 1.0
189
 
 */
190
 
float     cogl_color_get_red         (const CoglColor *color);
191
 
 
192
 
/**
193
 
 * cogl_color_get_green:
194
 
 * @color: a #CoglColor
195
 
 *
196
 
 * Retrieves the green channel of @color as a fixed point
197
 
 * value between 0 and %1.0.
198
 
 *
199
 
 * Return value: the green channel of the passed color
200
 
 *
201
 
 * Since: 1.0
202
 
 */
203
 
float     cogl_color_get_green       (const CoglColor *color);
204
 
 
205
 
/**
206
 
 * cogl_color_get_blue:
207
 
 * @color: a #CoglColor
208
 
 *
209
 
 * Retrieves the blue channel of @color as a fixed point
210
 
 * value between 0 and %1.0.
211
 
 *
212
 
 * Return value: the blue channel of the passed color
213
 
 *
214
 
 * Since: 1.0
215
 
 */
216
 
float     cogl_color_get_blue        (const CoglColor *color);
217
 
 
218
 
/**
219
 
 * cogl_color_get_alpha:
220
 
 * @color: a #CoglColor
221
 
 *
222
 
 * Retrieves the alpha channel of @color as a fixed point
223
 
 * value between 0 and %1.0.
224
 
 *
225
 
 * Return value: the alpha channel of the passed color
226
 
 *
227
 
 * Since: 1.0
228
 
 */
229
 
float     cogl_color_get_alpha       (const CoglColor *color);
230
 
 
231
 
/**
232
 
 * cogl_color_premultiply:
233
 
 * @color: the color to premultiply
234
 
 *
235
 
 * Converts a non-premultiplied color to a pre-multiplied color. For
236
 
 * example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied
237
 
 * and (0.5, 0, 0, 0.5) when premultiplied.
238
 
 *
239
 
 * Since: 1.0
240
 
 */
241
 
void cogl_color_premultiply (CoglColor *color);
242
 
 
243
 
/**
244
 
 * cogl_color_equal:
245
 
 * @v1: a #CoglColor
246
 
 * @v2: a #CoglColor
247
 
 *
248
 
 * Compares two #CoglColor<!-- -->s and checks if they are the same.
249
 
 *
250
 
 * This function can be passed to g_hash_table_new() as the @key_equal_func
251
 
 * parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
252
 
 *
253
 
 * Return value: %TRUE if the two colors are the same.
254
 
 *
255
 
 * Since: 1.0
256
 
 */
257
 
gboolean  cogl_color_equal (gconstpointer v1, gconstpointer v2);
258
 
 
259
 
G_END_DECLS
260
 
 
261
 
#endif /* __COGL_COLOR_H__ */