# Clutter::Color Class Reference

List of all members.

## Public Member Functions

| Color (ClutterColor* gobject, bool make_a_copy=true)
| Color (const Color& other)
Color& | operator= (const Color& other)
| ~Color ()
void | swap (Color& other)
ClutterColor* | gobj ()
| Provides access to the underlying C instance.
const ClutterColor* | gobj () const
| Provides access to the underlying C instance.
ClutterColor* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| Color ()
| Color (guint8 red, guint8 green, guint8 blue, guint8 alpha=255)
| Create a new Color object by specifying its value in RGB(A).
| Color (guint32 pixel)
| Create a new Color object by specifying its pixel value.
| Color (const Glib::ustring& color)
void | set_from_rgb (guint8 red, guint8 blue, guint8 green)
void | set_from_string (const Glib::ustring& color)
Glib::ustring | to_string () const
| Returns a textual specification of color in the hexadecimal form <literal>rrggbbaa</literal>, where <literal>r</literal>, <literal>g</literal>, <literal>b</literal> and <literal>a</literal> are hex digits representing the red, green, blue and alpha components respectively.
void | set_from_hls (float hue, float luminance, float saturation)
| Converts a color expressed in HLS (hue, luminance and saturation) values into a Clutter::Color.
void | to_hls (float& hue, float& luminance, float& saturation) const
| Converts color to the HLS format.
void | set_from_pixel (guint32 pixel)
| Converts pixel from the packed representation of a four 8 bit channel color to a Clutter::Color.
guint32 | to_pixel () const
| Converts color into a packed 32 bit integer, containing all the four 8 bit channels used by Clutter::Color.
Color | add (const Color& color) const
| Adds a to b and saves the resulting color inside result.
Color | subtract (const Color& color) const
| Subtracts b from a and saves the resulting color inside result.
void | darken ()
| Darkens color by a fixed amount, and saves the changed color in result.
void | lighten ()
| Lightens color by a fixed amount, and saves the changed color in result.
void | shade (double shade)
| Shades color by factor and saves the modified color into result.
guint8 | get_red () const
void | set_red (const guint8&value)
guint8 | get_green () const
void | set_green (const guint8&value)
guint8 | get_blue () const
void | set_blue (const guint8&value)
guint8 | get_alpha () const
void | set_alpha (const guint8&value)

## Protected Attributes

ClutterColor* | gobject_

## Related Functions

(Note that these are not member functions.)
Color | operator+ (const Color& color1, const Color& color2)
Color | operator- (const Color& color1, const Color& color2)
bool | operator== (const Color& lhs, const Color& rhs)
bool | operator!= (const Color& lhs, const Color& rhs)
void | swap (Color& lhs, Color& rhs)
Clutter::Color | wrap (ClutterColor* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

Clutter::Color::Color | ( | ClutterColor * | gobject,
|  | bool | make_a_copy = `true` |
| ) |  |  | `[explicit]`

Clutter::Color::Color | ( | const Color& | other | ) |

Clutter::Color::~Color | ( |  | ) |

Clutter::Color::Color | ( |  | ) |

Clutter::Color::Color | ( | guint8 | red,
|  | guint8 | green,
|  | guint8 | blue,
|  | guint8 | alpha = `255` |
| ) |  |  |

Create a new Color object by specifying its value in RGB(A).

Clutter::Color::Color | ( | guint32 | pixel | ) | `[explicit]`

Create a new Color object by specifying its pixel value.

Clutter::Color::Color | ( | const Glib::ustring & | color | ) | `[explicit]`

## Member Function Documentation

Color Clutter::Color::add | ( | const Color& | color | ) | const

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.

Parameters:

  | b | A Clutter::Color.
  | result | Return location for the result.

void Clutter::Color::darken | ( |  | ) |

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

Parameters:

  | result | Return location for the darker color.

guint8 Clutter::Color::get_alpha | ( |  | ) | const

guint8 Clutter::Color::get_blue | ( |  | ) | const

guint8 Clutter::Color::get_green | ( |  | ) | const

guint8 Clutter::Color::get_red | ( |  | ) | const

const ClutterColor* Clutter::Color::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C instance.

ClutterColor* Clutter::Color::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C instance.

ClutterColor* Clutter::Color::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

void Clutter::Color::lighten | ( |  | ) |

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

Parameters:

  | result | Return location for the lighter color.

Color& Clutter::Color::operator= | ( | const Color& | other | ) |

void Clutter::Color::set_alpha | ( | const guint8 & | value | ) |

void Clutter::Color::set_blue | ( | const guint8 & | value | ) |

void Clutter::Color::set_from_hls | ( | float | hue,
|  | float | luminance,
|  | float | saturation |
| ) |  |  |

Converts a color expressed in HLS (hue, luminance and saturation) values into a Clutter::Color.

Parameters:

  | hue | Hue value, in the 0 .. 360 range.
  | luminance | Luminance value, in the 0 .. 1 range.
  | saturation | Saturation value, in the 0 .. 1 range.

void Clutter::Color::set_from_pixel | ( | guint32 | pixel | ) |

Converts pixel from the packed representation of a four 8 bit channel color to a Clutter::Color.

Parameters:

  | pixel | A 32 bit packed integer containing a color.

void Clutter::Color::set_from_rgb | ( | guint8 | red,
|  | guint8 | blue,
|  | guint8 | green |
| ) |  |  |

void Clutter::Color::set_from_string | ( | const Glib::ustring & | color | ) |

void Clutter::Color::set_green | ( | const guint8 & | value | ) |

void Clutter::Color::set_red | ( | const guint8 & | value | ) |

void Clutter::Color::shade | ( | double | shade | ) |

Shades color by factor and saves the modified color into result.

Parameters:

  | factor | The shade factor to apply.
  | result | Return location for the shaded color.

Color Clutter::Color::subtract | ( | const Color& | color | ) | const

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.

Parameters:

  | b | A Clutter::Color.
  | result | Return location for the result.

void Clutter::Color::swap | ( | Color& | other | ) |

void Clutter::Color::to_hls | ( | float & | hue,
|  | float & | luminance,
|  | float & | saturation |
| ) |  |  | const

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.

Parameters:

  | hue | Return location for the hue value or `0`.
  | luminance | Return location for the luminance value or `0`.
  | saturation | Return location for the saturation value or `0`.

guint32 Clutter::Color::to_pixel | ( |  | ) | const

Converts color into a packed 32 bit integer, containing all the four 8 bit channels used by Clutter::Color.

Returns:
  A packed color.

Glib::ustring Clutter::Color::to_string | ( |  | ) | const

Returns a textual specification of color in the hexadecimal form <literal>rrggbbaa</literal>, where <literal>r</literal>, <literal>g</literal>, <literal>b</literal> and <literal>a</literal> are hex digits representing the red, green, blue and alpha components respectively.

Since cluttermm 0.2:

Returns:
  A newly-allocated text string.

## Friends And Related Function Documentation

bool operator!= | ( | const Color& | lhs,
|  | const Color& | rhs |
| ) |  |  | `[related]`

Parameters:

  | lhs | The left-hand side
  | rhs | The right-hand side

Returns:
  The result

Color operator+ | ( | const Color& | color1,
|  | const Color& | color2 |
| ) |  |  | `[related]`

Returns:
  the sum of color1 and color2

Color operator- | ( | const Color& | color1,
|  | const Color& | color2 |
| ) |  |  | `[related]`

Returns:
  the color resulting from subtracting color2 from color1

bool operator== | ( | const Color& | lhs,
|  | const Color& | rhs |
| ) |  |  | `[related]`

Parameters:

  | lhs | The left-hand side
  | rhs | The right-hand side

Returns:
  The result

void swap | ( | Color& | lhs,
|  | Color& | rhs |
| ) |  |  | `[related]`

Parameters:

  | lhs | The left-hand side
  | rhs | The right-hand side

Clutter::Color wrap | ( | ClutterColor * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

## Member Data Documentation

ClutterColor* Clutter::Color::gobject_`[protected]`

The documentation for this class was generated from the following file:

- cluttermm/color.h