4 * An OpenGL based 'interactive canvas' library.
6 * Authored By: Matthew Allum <mallum@openedhand.com>
7 * Emmanuele Bassi <ebassi@linux.intel.com>
9 * Copyright (C) 2006, 2007, 2008 OpenedHand
10 * Copyright (C) 2009 Intel Corp.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
26 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
27 #error "Only <clutter/clutter.h> can be included directly."
30 #ifndef __CLUTTER_COLOR_H__
31 #define __CLUTTER_COLOR_H__
33 #include <clutter/clutter-types.h>
37 #define CLUTTER_TYPE_COLOR (clutter_color_get_type ())
41 * @red: red component, between 0 and 255
42 * @green: green component, between 0 and 255
43 * @blue: blue component, between 0 and 255
44 * @alpha: alpha component, between 0 and 255
46 * Color representation.
60 * @r: value for the red channel, between 0 and 255
61 * @g: value for the green channel, between 0 and 255
62 * @b: value for the blue channel, between 0 and 255
63 * @a: value for the alpha channel, between 0 and 255
65 * A macro that initializes a #ClutterColor, to be used when declaring it.
69 #define CLUTTER_COLOR_INIT(r,g,b,a) { (r), (g), (b), (a) }
71 GType clutter_color_get_type (void) G_GNUC_CONST;
73 ClutterColor *clutter_color_new (guint8 red,
77 ClutterColor *clutter_color_alloc (void);
78 ClutterColor *clutter_color_init (ClutterColor *color,
83 ClutterColor *clutter_color_copy (const ClutterColor *color);
84 void clutter_color_free (ClutterColor *color);
86 void clutter_color_add (const ClutterColor *a,
87 const ClutterColor *b,
88 ClutterColor *result);
89 void clutter_color_subtract (const ClutterColor *a,
90 const ClutterColor *b,
91 ClutterColor *result);
92 void clutter_color_lighten (const ClutterColor *color,
93 ClutterColor *result);
94 void clutter_color_darken (const ClutterColor *color,
95 ClutterColor *result);
96 void clutter_color_shade (const ClutterColor *color,
98 ClutterColor *result);
100 gchar * clutter_color_to_string (const ClutterColor *color);
101 gboolean clutter_color_from_string (ClutterColor *color,
104 void clutter_color_to_hls (const ClutterColor *color,
108 void clutter_color_from_hls (ClutterColor *color,
113 guint32 clutter_color_to_pixel (const ClutterColor *color);
114 void clutter_color_from_pixel (ClutterColor *color,
117 guint clutter_color_hash (gconstpointer v);
118 gboolean clutter_color_equal (gconstpointer v1,
121 void clutter_color_interpolate (const ClutterColor *initial,
122 const ClutterColor *final,
124 ClutterColor *result);
126 #define CLUTTER_TYPE_PARAM_COLOR (clutter_param_color_get_type ())
127 #define CLUTTER_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), CLUTTER_TYPE_PARAM_COLOR, ClutterParamSpecColor))
128 #define CLUTTER_IS_PARAM_SPEC_COLOR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), CLUTTER_TYPE_PARAM_COLOR))
131 * CLUTTER_VALUE_HOLDS_COLOR:
134 * Evaluates to %TRUE if @x holds a #ClutterColor<!-- -->.
138 #define CLUTTER_VALUE_HOLDS_COLOR(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_COLOR))
140 typedef struct _ClutterParamSpecColor ClutterParamSpecColor;
143 * ClutterParamSpecColor: (skip)
144 * @default_value: default color value
146 * A #GParamSpec subclass for defining properties holding
151 struct _ClutterParamSpecColor
154 GParamSpec parent_instance;
157 ClutterColor *default_value;
160 void clutter_value_set_color (GValue *value,
161 const ClutterColor *color);
162 const ClutterColor * clutter_value_get_color (const GValue *value);
164 GType clutter_param_color_get_type (void) G_GNUC_CONST;
165 GParamSpec *clutter_param_spec_color (const gchar *name,
168 const ClutterColor *default_value,
171 const ClutterColor *clutter_color_get_static (ClutterStaticColor color);
175 #endif /* __CLUTTER_COLOR_H__ */