Next: , Previous: ClutterCloneTexture, Up: Top


15 Colors

Color management and manipulation.

15.1 Overview

<clutter-color> is a simple type for representing colors.

15.2 Usage

— Class: <clutter-color>

Derives from <gboxed>.

This class defines no direct slots.

— Function: clutter-color-parse (name mchars)   (ret scm)

Parses a string definition of a color, filling the (structfield "green") , channels of dest. If alpha is not specified it will be set full opaque. The color in dest is not allocated.

The color may be defined by any of the formats understood by pango-color-parse; these include literal color names, like ‘Red’ or ‘DarkSlateGray’, or hexadecimal specifications like ‘&#x0023;3050b2’ or ‘&#x0023;333’.

color
a string specifiying a color (named color or <rrggbbaa>)
dest
return location for a <clutter-color>
ret
#t’ if parsing succeeded.

Since 0.2

— Function: clutter-color-from-hls (self <clutter-color>) (hue unsigned-int8) (luminance unsigned-int8) (saturation unsigned-int8)

Converts a color expressed in HLS (hue, luminance and saturation) values into a <clutter-color>.

dest
return location for a <clutter-color>
hue
hue value (0 .. 255)
luminance
luminance value (0 .. 255)
saturation
saturation value (0 .. 255)
— Function: clutter-color-from-pixel (self <clutter-color>) (pixel unsigned-int32)

Converts pixel from the packed representation of a four 8 bit channel color to a <clutter-color>.

dest
return location for a <clutter-color>
pixel
a 32 bit packed integer containing a color
— Function: clutter-color-add (self <clutter-color>) (src2 <clutter-color>) (dest <clutter-color>)

Adds src2 to src1 and saves the resulting color inside dest.

The alpha channel of dest is as the maximum value between the alpha channels of src1 and src2.

src1
a <clutter-color>
src2
a <clutter-color>
dest
return location for the result
— Function: clutter-color-subtract (self <clutter-color>) (src2 <clutter-color>) (dest <clutter-color>)

Subtracts src2 from src1 and saves the resulting color inside dest. This function assumes that the components of src1 are greater than the components of src2; the result is, otherwise, undefined.

The alpha channel of dest is set as the minimum value between the alpha channels of src1 and src2.

src1
a <clutter-color>
src2
a <clutter-color>
dest
return location for the result
— Function: clutter-color-equal (self <clutter-color>) (<clutter-color>)   (ret bool)

Compares two <clutter-color>s and checks if they are the same.

a
a <clutter-color>
b
a <clutter-color>
ret
#t’ if the two colors are the same.

Since 0.2

— Function: clutter-color-lighten (self <clutter-color>) (dest <clutter-color>)

Lightens src by a fixed amount, and saves the changed color in dest.

src
a <clutter-color>
dest
return location for the lighter color
— Function: clutter-color-darken (self <clutter-color>) (dest <clutter-color>)

Darkens src by a fixed amount, and saves the changed color in dest.

src
a <clutter-color>
dest
return location for the darker color
— Function: clutter-color-shade (self <clutter-color>) (dest <clutter-color>) (shade double)

Shades src by the factor of shade and saves the modified color into dest.

src
a <clutter-color>
dest
return location for the shaded color
shade
the shade factor to apply
— Function: clutter-color-to-hls (self <clutter-color>)   (hue unsigned-int8) (luminance unsigned-int8) (saturation unsigned-int8)

Converts src to the HLS format. Returned HLS values are from interval 0 .. 255.

src
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
— Function: clutter-color-to-pixel (self <clutter-color>)   (ret unsigned-int32)

Converts src into a packed 32 bit integer, containing all the four 8 bit channels used by <clutter-color>.

src
a <clutter-color>
ret
a packed color
— Function: clutter-color-to-string (self <clutter-color>)   (ret mchars)

Returns a textual specification of color in the hexadecimal form ‘&#x0023;rrggbbaa’, where ‘r’, ‘g’, ‘b’ and ‘a’ are hex digits representing the red, green, blue and alpha components respectively.

color
a <clutter-color>
ret
a newly-allocated text string

Since 0.2