pangomm: Pango::Color Class Reference

pangomm 2.54.0

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Pango::Color Class Reference

A Pango::Color is used to represent a color in an uncalibrated RGB colorspace. More...

`#include <pangomm/color.h>`

## Public Member Functions
| Color (const Color & other) noexcept
Color & | operator= (const Color & other) noexcept
| Color (Color && other) noexcept
Color & | operator= (Color && other) noexcept
| Color ()
| Color (const PangoColor * gobject)
PangoColor * | gobj ()
| Provides access to the underlying C instance.
const PangoColor * | gobj () const
| Provides access to the underlying C instance.
| operator bool () const
| Tests whether the Color is valid.
guint16 | get_red () const
| Gets the red component of the color.
guint16 | get_green () const
| Gets the green component of the color.
guint16 | get_blue () const
| Gets the blue component of the color.
void | set_red (const guint16 & value)
| Sets the red component of the color.
void | set_green (const guint16 & value)
| Sets the green component of the color.
void | set_blue (const guint16 & value)
| Sets the blue component of the color.
bool | parse (const Glib::ustring & spec)
| Fill in the fields of a color from a string specification.
std::pair< bool, guint16 > | parse_with_alpha (const Glib::ustring & spec)
| Fill in the fields of a color from a string specification.
Glib::ustring | to_string () const
| Returns a textual specification of color.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
PangoColor | gobject_

## Related Symbols
(Note that these are not member symbols.)
Pango::Color & | wrap (PangoColor * object)
const Pango::Color & | wrap (const PangoColor * object)

## Detailed Description

A Pango::Color is used to represent a color in an uncalibrated RGB colorspace.

## Constructor & Destructor Documentation

## ◆ Color() [1/4]

Pango::Color::Color | ( | const Color & | other | ) |
| noexcept

## ◆ Color() [2/4]

Pango::Color::Color | ( | Color && | other | ) |
| noexcept

## ◆ Color() [3/4]

Pango::Color::Color | ( |  | ) |

## ◆ Color() [4/4]

Pango::Color::Color | ( | const PangoColor * | gobject | ) |
| explicit

## Member Function Documentation

## ◆ get_blue()

guint16 Pango::Color::get_blue | ( |  | ) | const

Gets the blue component of the color.

Returns
  The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ get_green()

guint16 Pango::Color::get_green | ( |  | ) | const

Gets the green component of the color.

Returns
  The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ get_red()

guint16 Pango::Color::get_red | ( |  | ) | const

Gets the red component of the color.

Returns
  The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ get_type()

static GType Pango::Color::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

PangoColor * Pango::Color::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const PangoColor * Pango::Color::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ operator bool()

Pango::Color::operator bool | ( |  | ) | const
| explicit

Tests whether the Color is valid.

## ◆ operator=() [1/2]

Color & Pango::Color::operator= | ( | Color && | other | ) |
| noexcept

## ◆ operator=() [2/2]

Color & Pango::Color::operator= | ( | const Color & | other | ) |
| noexcept

## ◆ parse()

bool Pango::Color::parse | ( | const Glib::ustring & | spec | ) |

Fill in the fields of a color from a string specification.

The string can either one of a large set of standard names. (Taken from the X11 <filename>rgb.txt</filename> file), or it can be a hex value in the form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff')

Parameters

  spec | A string specifying the new color.

Returns
  `true` if parsing of the specifier succeeded, otherwise `false`.

## ◆ parse_with_alpha()

std::pair< bool, guint16 > Pango::Color::parse_with_alpha | ( | const Glib::ustring & | spec | ) |

Fill in the fields of a color from a string specification.

The string can either one of a large set of standard names. (Taken from the CSS Color specification, or it can be a hexadecimal value in the form `#rgb`, `#rrggbb`, `#rrrgggbbb` or `#rrrrggggbbbb` where `r`, `g` and `b` are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is `#fff`, `#ffffff`, `#fffffffff` and `#ffffffffffff`.)

Additionally, parse strings of the form `#rgba`, `#rrggbbaa`, `#rrrrggggbbbbaaaa`, and set alpha to the value specified by the hex digits for `a`. If no alpha component is found in spec, alpha is set to 0xffff (for a solid color).

Since pangomm 2.54

Parameters

  spec | A string specifying the new color.

Returns
  {success, alpha} `true` if parsing of the specifier succeeded, otherwise `false`; alpha value.

## ◆ set_blue()

void Pango::Color::set_blue | ( | const guint16 & | value | ) |

Sets the blue component of the color.

Parameters

  value | The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ set_green()

void Pango::Color::set_green | ( | const guint16 & | value | ) |

Sets the green component of the color.

Parameters

  value | The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ set_red()

void Pango::Color::set_red | ( | const guint16 & | value | ) |

Sets the red component of the color.

Parameters

  value | The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.

## ◆ to_string()

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

Returns a textual specification of color.

The string is in the hexadecimal form `#rrrrggggbbbb`, where `r`, `g` and `b` are hex digits representing the red, green, and blue components respectively.

Since pangomm 1.16

Returns
  A newly-allocated text string that must be freed with Glib::free().

## Friends And Related Symbol Documentation

## ◆ wrap() [1/2]

const Pango::Color & wrap | ( | const PangoColor * | object | ) |
| related

Parameters

  object | The C instance

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

## ◆ wrap() [2/2]

Pango::Color & wrap | ( | PangoColor * | object | ) |
| related

Parameters

  object | The C instance

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

## Member Data Documentation

## ◆ gobject_

PangoColor Pango::Color::gobject_
| protected