4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2008,2009 Intel Corporation.
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.
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.
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.
24
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25
#error "Only <cogl/cogl.h> can be included directly."
28
#ifndef __COGL_COLOR_H__
29
#define __COGL_COLOR_H__
31
#include <cogl/cogl-types.h>
35
CoglColor *cogl_color_new (void);
36
CoglColor *cogl_color_copy (const CoglColor *color);
37
void cogl_color_free (CoglColor *color);
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
47
* Sets the values of the passed channels into a #CoglColor.
51
void cogl_color_set_from_4ub (CoglColor *dest,
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
65
* Sets the values of the passed channels into a #CoglColor
69
void cogl_color_set_from_4f (CoglColor *dest,
76
* cogl_color_get_red_byte:
77
* @color: a #CoglColor
79
* Retrieves the red channel of @color as a byte value
82
* Return value: the red channel of the passed color
86
unsigned char cogl_color_get_red_byte (const CoglColor *color);
89
* cogl_color_get_green_byte:
90
* @color: a #CoglColor
92
* Retrieves the green channel of @color as a byte value
95
* Return value: the green channel of the passed color
99
unsigned char cogl_color_get_green_byte (const CoglColor *color);
102
* cogl_color_get_blue_byte:
103
* @color: a #CoglColor
105
* Retrieves the blue channel of @color as a byte value
108
* Return value: the blue channel of the passed color
112
unsigned char cogl_color_get_blue_byte (const CoglColor *color);
115
* cogl_color_get_alpha_byte:
116
* @color: a #CoglColor
118
* Retrieves the alpha channel of @color as a byte value
121
* Return value: the alpha channel of the passed color
125
unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
128
* cogl_color_get_red_float:
129
* @color: a #CoglColor
131
* Retrieves the red channel of @color as a floating point
132
* value between 0.0 and 1.0
134
* Return value: the red channel of the passed color
138
float cogl_color_get_red_float (const CoglColor *color);
141
* cogl_color_get_green_float:
142
* @color: a #CoglColor
144
* Retrieves the green channel of @color as a floating point
145
* value between 0.0 and 1.0
147
* Return value: the green channel of the passed color
151
float cogl_color_get_green_float (const CoglColor *color);
154
* cogl_color_get_blue_float:
155
* @color: a #CoglColor
157
* Retrieves the blue channel of @color as a floating point
158
* value between 0.0 and 1.0
160
* Return value: the blue channel of the passed color
164
float cogl_color_get_blue_float (const CoglColor *color);
167
* cogl_color_get_alpha_float:
168
* @color: a #CoglColor
170
* Retrieves the alpha channel of @color as a floating point
171
* value between 0.0 and 1.0
173
* Return value: the alpha channel of the passed color
177
float cogl_color_get_alpha_float (const CoglColor *color);
180
* cogl_color_get_red:
181
* @color: a #CoglColor
183
* Retrieves the red channel of @color as a fixed point
184
* value between 0 and %1.0.
186
* Return value: the red channel of the passed color
190
float cogl_color_get_red (const CoglColor *color);
193
* cogl_color_get_green:
194
* @color: a #CoglColor
196
* Retrieves the green channel of @color as a fixed point
197
* value between 0 and %1.0.
199
* Return value: the green channel of the passed color
203
float cogl_color_get_green (const CoglColor *color);
206
* cogl_color_get_blue:
207
* @color: a #CoglColor
209
* Retrieves the blue channel of @color as a fixed point
210
* value between 0 and %1.0.
212
* Return value: the blue channel of the passed color
216
float cogl_color_get_blue (const CoglColor *color);
219
* cogl_color_get_alpha:
220
* @color: a #CoglColor
222
* Retrieves the alpha channel of @color as a fixed point
223
* value between 0 and %1.0.
225
* Return value: the alpha channel of the passed color
229
float cogl_color_get_alpha (const CoglColor *color);
232
* cogl_color_premultiply:
233
* @color: the color to premultiply
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.
241
void cogl_color_premultiply (CoglColor *color);
248
* Compares two #CoglColor<!-- -->s and checks if they are the same.
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.
253
* Return value: %TRUE if the two colors are the same.
257
gboolean cogl_color_equal (gconstpointer v1, gconstpointer v2);
261
#endif /* __COGL_COLOR_H__ */