Function
CoglColorfrom_string
Declaration [src]
gboolean
cogl_color_from_string (
CoglColor* color,
const gchar* str
)
Description [src]
Parses a string definition of a color, filling the CoglColor
.red,
CoglColor
.green, CoglColor
.blue and CoglColor
.alpha fields
of color
.
The color
is not allocated.
The format of str
can be either one of:
- an hexadecimal value in the form:
#rgb
,#rrggbb
,#rgba
, or#rrggbbaa
- a RGB color in the form:
rgb(r, g, b)
- a RGB color in the form:
rgba(r, g, b, a)
- a HSL color in the form:
hsl(h, s, l)
-a HSL color in the form:hsla(h, s, l, a)
where ‘r’, ‘g’, ‘b’ and ‘a’ are (respectively) the red, green, blue color intensities and the opacity. The ‘h’, ‘s’ and ‘l’ are (respectively) the hue, saturation and luminance values.
In the rgb()
and rgba()
formats, the ‘r’, ‘g’, and ‘b’ values are either
integers between 0 and 255, or percentage values in the range between 0%
and 100%; the percentages require the ‘%’ character. The ‘a’ value, if
specified, can only be a floating point value between 0.0 and 1.0.
In the hls()
and hlsa()
formats, the ‘h’ value (hue) is an angle between
0 and 360.0 degrees; the ‘l’ and ‘s’ values (luminance and saturation) are
percentage values in the range between 0% and 100%. The ‘a’ value, if specified,
can only be a floating point value between 0.0 and 1.0.
Whitespace inside the definitions is ignored; no leading whitespace is allowed.
If the alpha component is not specified then it is assumed to be set to be fully opaque.
Parameters
color
-
Type:
CoglColor
Return location for a
CoglColor
.The argument will be set by the function. The returned data is owned by the function. str
-
Type:
const gchar*
A string specifying a color.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string.