![]() |
![]() |
![]() |
Clutter Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
ClutterColor; ClutterColor * clutter_color_new (guint8 red, guint8 green, guint8 blue, guint8 alpha); ClutterColor * clutter_color_copy (const ClutterColor *color); void clutter_color_free (ClutterColor *color); gboolean clutter_color_equal (gconstpointer v1, gconstpointer v2); guint clutter_color_hash (gconstpointer v); gboolean clutter_color_from_string (ClutterColor *color, const gchar *str); gchar * clutter_color_to_string (const ClutterColor *color); void clutter_color_from_hls (ClutterColor *color, gfloat hue, gfloat luminance, gfloat saturation); void clutter_color_to_hls (const ClutterColor *color, gfloat *hue, gfloat *luminance, gfloat *saturation); void clutter_color_from_pixel (ClutterColor *color, guint32 pixel); guint32 clutter_color_to_pixel (const ClutterColor *color); void clutter_color_add (const ClutterColor *a, const ClutterColor *b, ClutterColor *result); void clutter_color_subtract (const ClutterColor *a, const ClutterColor *b, ClutterColor *result); void clutter_color_lighten (const ClutterColor *color, ClutterColor *result); void clutter_color_darken (const ClutterColor *color, ClutterColor *result); void clutter_color_shade (const ClutterColor *color, gdouble factor, ClutterColor *result); ClutterParamSpecColor; GParamSpec * clutter_param_spec_color (const gchar *name, const gchar *nick, const gchar *blurb, const ClutterColor *default_value, GParamFlags flags); #define CLUTTER_VALUE_HOLDS_COLOR (x) void clutter_value_set_color (GValue *value, const ClutterColor *color); const ClutterColor * clutter_value_get_color (const GValue *value);
ClutterColor is a simple type for representing colors in Clutter.
A ClutterColor is expressed as a 4-tuple of values ranging from zero to 255, one for each color channel plus one for the alpha.
typedef struct { guint8 red; guint8 green; guint8 blue; guint8 alpha; } ClutterColor;
Color representation.
guint8 |
red component, between 0 and 255 |
guint8 |
green component, between 0 and 255 |
guint8 |
blue component, between 0 and 255 |
guint8 |
alpha component, between 0 and 255 |
ClutterColor * clutter_color_new (guint8 red, guint8 green, guint8 blue, guint8 alpha);
Creates a new ClutterColor with the given values.
|
red component of the color, between 0 and 255 |
|
green component of the color, between 0 and 255 |
|
blue component of the color, between 0 and 255 |
|
alpha component of the color, between 0 and 255 |
Returns : |
the newly allocated color. Use clutter_color_free()
when done
|
Since 0.8.4
ClutterColor * clutter_color_copy (const ClutterColor *color);
Makes a copy of the color structure. The result must be
freed using clutter_color_free()
.
|
a ClutterColor |
Returns : |
an allocated copy of color .
|
Since 0.2
void clutter_color_free (ClutterColor *color);
Frees a color structure created with clutter_color_copy()
.
|
a ClutterColor |
Since 0.2
gboolean clutter_color_equal (gconstpointer v1, gconstpointer v2);
Compares two ClutterColors and checks if they are the same.
This function can be passed to g_hash_table_new()
as the key_equal_func
parameter, when using ClutterColors as keys in a GHashTable.
|
a ClutterColor |
|
a ClutterColor |
Returns : |
TRUE if the two colors are the same.
|
Since 0.2
guint clutter_color_hash (gconstpointer v);
Converts a ClutterColor to a hash value.
This function can be passed to g_hash_table_new()
as the hash_func
parameter, when using ClutterColors as keys in a GHashTable.
|
a ClutterColor |
Returns : |
a hash value corresponding to the color |
Since 1.0
gboolean clutter_color_from_string (ClutterColor *color, const gchar *str);
Parses a string definition of a color, filling the
red
, green
,
blue
and alpha
channels of color
. If alpha is not specified it will be set full opaque.
The color
is not allocated.
The color may be defined by any of the formats understood by
pango_color_from_string()
; these include literal color names, like
Red
or DarkSlateGray
, or
hexadecimal specifications like #3050b2
or
#333
.
|
return location for a ClutterColor. out. |
|
a string specifiying a color (named color or RRGGBBAA) |
Returns : |
TRUE if parsing succeeded.
|
Since 1.0
gchar * clutter_color_to_string (const ClutterColor *color);
Returns a textual specification of color
in the hexadecimal form
#rrggbbaa
, where r
,
g
, b
and a
are
hex digits representing the red, green, blue and alpha components
respectively.
|
a ClutterColor |
Returns : |
a newly-allocated text string |
Since 0.2
void clutter_color_from_hls (ClutterColor *color, gfloat hue, gfloat luminance, gfloat saturation);
Converts a color expressed in HLS (hue, luminance and saturation) values into a ClutterColor.
|
return location for a ClutterColor. out. |
|
hue value, in the 0 .. 360 range |
|
luminance value, in the 0 .. 1 range |
|
saturation value, in the 0 .. 1 range |
void clutter_color_to_hls (const ClutterColor *color, gfloat *hue, gfloat *luminance, gfloat *saturation);
Converts color
to the HLS format.
The hue
value is in the 0 .. 360 range. The luminance
and
saturation
values are in the 0 .. 1 range.
|
a ClutterColor |
|
return location for the hue value or NULL
|
|
return location for the luminance value or NULL
|
|
return location for the saturation value or NULL
|
void clutter_color_from_pixel (ClutterColor *color, guint32 pixel);
Converts pixel
from the packed representation of a four 8 bit channel
color to a ClutterColor.
|
return location for a ClutterColor. out. |
|
a 32 bit packed integer containing a color |
guint32 clutter_color_to_pixel (const ClutterColor *color);
Converts color
into a packed 32 bit integer, containing
all the four 8 bit channels used by ClutterColor.
|
a ClutterColor |
Returns : |
a packed color |
void clutter_color_add (const ClutterColor *a, const ClutterColor *b, ClutterColor *result);
Adds a
to b
and saves the resulting color inside result
.
The alpha channel of result
is set as as the maximum value
between the alpha channels of a
and b
.
|
a ClutterColor |
|
a ClutterColor |
|
return location for the result. out. |
void clutter_color_subtract (const ClutterColor *a, const ClutterColor *b, ClutterColor *result);
Subtracts b
from a
and saves the resulting color inside result
.
This function assumes that the components of a
are greater than the
components of b
; the result is, otherwise, undefined.
The alpha channel of result
is set as the minimum value
between the alpha channels of a
and b
.
|
a ClutterColor |
|
a ClutterColor |
|
return location for the result. out. |
void clutter_color_lighten (const ClutterColor *color, ClutterColor *result);
Lightens color
by a fixed amount, and saves the changed color
in result
.
|
a ClutterColor |
|
return location for the lighter color. out. |
void clutter_color_darken (const ClutterColor *color, ClutterColor *result);
Darkens color
by a fixed amount, and saves the changed color
in result
.
|
a ClutterColor |
|
return location for the darker color. out. |
void clutter_color_shade (const ClutterColor *color, gdouble factor, ClutterColor *result);
Shades color
by factor
and saves the modified color into result
.
|
a ClutterColor |
|
the shade factor to apply |
|
return location for the shaded color. out. |
typedef struct { ClutterColor *default_value; } ClutterParamSpecColor;
A GParamSpec subclass for defining properties holding a ClutterColor.
ClutterColor * |
default color value |
Since 1.0
GParamSpec * clutter_param_spec_color (const gchar *name, const gchar *nick, const gchar *blurb, const ClutterColor *default_value, GParamFlags flags);
Creates a GParamSpec for properties using ClutterColor.
|
name of the property |
|
short name |
|
description (can be translatable) |
|
default value |
|
flags for the param spec |
Returns : |
the newly created GParamSpec |
Since 0.8.4
#define CLUTTER_VALUE_HOLDS_COLOR(x) (G_VALUE_HOLDS ((x), CLUTTER_TYPE_COLOR))
Evaluates to TRUE
if x
holds a ClutterColor.
|
a GValue |
Since 1.0
void clutter_value_set_color (GValue *value, const ClutterColor *color);
Sets value
to color
.
|
a GValue initialized to CLUTTER_TYPE_COLOR |
|
the color to set |
Since 0.8.4
const ClutterColor * clutter_value_get_color (const GValue *value);
Gets the ClutterColor contained in value
.
|
a GValue initialized to CLUTTER_TYPE_COLOR |
Returns : |
the colors inside the passed GValue |
Since 0.8.4