Color management and manipulation.
<clutter-color>
is a simple type for representing colors in
Clutter.
A <clutter-color>
is expressed as a 4-tuple of values ranging
from zero to 255, one for each color channel plus one for the alpha.
The alpha channel is fully opaque at 255 and fully transparent at 0.
unsigned-int8
) (green unsigned-int8
) (blue unsigned-int8
) (alpha unsigned-int8
) ⇒ (ret <clutter-color>
)Creates a new
<clutter-color>
with the given values.
- red
- red component of the color, between 0 and 255
- green
- green component of the color, between 0 and 255
- blue
- blue component of the color, between 0 and 255
- alpha
- alpha component of the color, between 0 and 255
- ret
- the newly allocated color. Use
clutter-color-free
when done.Since 0.8.4
<clutter-static-color>
) ⇒ (ret <clutter-color>
)Retrieves a static color for the given color name
Static colors are created by Clutter and are guaranteed to always be available and valid
- color
- the named global color
- ret
- a pointer to a static color; the returned pointer is owned by Clutter and it should never be modified or freed
Since 1.6
mchars
) ⇒ (ret scm
)Parses a string definition of a color, filling the "red") , (structfield "alpha") channels of color.
The color is not allocated.
The format of str can be either one of:
a standard name (as taken from the X11 rgb.txt file)
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
andrgba
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
andhlsa
formats, the 'h' value (hue) it's an angle between 0 and 360.0 degrees; the 'l' and 's' values (luminance and saturation) are a floating point value between 0.0 and 1.0. 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.
- color
- return location for a
<clutter-color>
.- str
- a string specifiying a color
- ret
- ‘
#t
’ if parsing succeeded, and ‘#f
’ otherwiseSince 1.0
<clutter-color>
) ⇒ (ret mchars
)Returns a textual specification of color in the hexadecimal form ‘#rrggbbaa’, where ‘r’, ‘g’, ‘b’ and ‘a’ are hexadecimal digits representing the red, green, blue and alpha components respectively.
- color
- a
<clutter-color>
- ret
- a newly-allocated text string.
Since 0.2
<clutter-color>
) (hue float
) (luminance float
) (saturation float
)Converts a color expressed in HLS (hue, luminance and saturation) values into a
<clutter-color>
.
- color
- return location for a
<clutter-color>
.- hue
- hue value, in the 0 .. 360 range
- luminance
- luminance value, in the 0 .. 1 range
- saturation
- saturation value, in the 0 .. 1 range
<clutter-color>
) ⇒ (hue float
) (luminance float
) (saturation float
)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.
- color
- a
<clutter-color>
- hue
- return location for the hue value or ‘
#f
’.- luminance
- return location for the luminance value or ‘
#f
’.- saturation
- return location for the saturation value or ‘
#f
’.
<clutter-color>
) (pixel unsigned-int32
)Converts pixel from the packed representation of a four 8 bit channel color to a
<clutter-color>
.
- color
- return location for a
<clutter-color>
.- pixel
- a 32 bit packed integer containing a color
<clutter-color>
) ⇒ (ret unsigned-int32
)Converts color into a packed 32 bit integer, containing all the four 8 bit channels used by
<clutter-color>
.
- color
- a
<clutter-color>
- ret
- a packed color
<clutter-color>
) (b <clutter-color>
) (result <clutter-color>
)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
- a
<clutter-color>
- b
- a
<clutter-color>
- result
- return location for the result.
<clutter-color>
) (b <clutter-color>
) (result <clutter-color>
)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
- a
<clutter-color>
- b
- a
<clutter-color>
- result
- return location for the result.
<clutter-color>
) (result <clutter-color>
)Lightens color by a fixed amount, and saves the changed color in result.
- color
- a
<clutter-color>
- result
- return location for the lighter color.
<clutter-color>
) (result <clutter-color>
)Darkens color by a fixed amount, and saves the changed color in result.
- color
- a
<clutter-color>
- result
- return location for the darker color.
<clutter-color>
) (factor double
) (result <clutter-color>
)Shades color by factor and saves the modified color into result.
- color
- a
<clutter-color>
- factor
- the shade factor to apply
- result
- return location for the shaded color.
<clutter-color>
) (final <clutter-color>
) (progress double
) (result <clutter-color>
)Interpolates between initial and final
<clutter-color>
s using progress
- initial
- the initial
<clutter-color>
- final
- the final
<clutter-color>
- progress
- the interpolation progress
- result
- return location for the interpolation.
Since 1.6