![]() |
![]() |
It contains the following data: pixel: For allocated colors, the value used to draw this color on the screen. red: The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy. green: The green component of the color. blue: The blue component of the color.
Public Member Functions | |
Color (const Glib::ustring& value) | |
Instantiate a new Gdk::Color. | |
Color () | |
Instantiate a new Gdk::Color. | |
Color (const Color& other) | |
Color (GdkColor* gobject, bool make_a_copy=true) | |
gushort | get_blue () const |
Get the blue component of the color. | |
double | get_blue_p () const |
Get the blue component of the color, as a percentage. | |
gushort | get_green () const |
Get the green component of the color. | |
double | get_green_p () const |
Get the green component of the color, as a percentage. | |
guint | get_pixel () const |
Get the pixel value, for allocated colors. | |
gushort | get_red () const |
Get the red component of the color. | |
double | get_red_p () const |
Get the red component of the color, as a percentage. | |
const GdkColor* | gobj () const |
Provides access to the underlying C instance. | |
GdkColor* | gobj () |
Provides access to the underlying C instance. | |
GdkColor* | 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& | operator= (const Color& other) |
bool | parse (const Glib::ustring& spec) |
void | rgb_find_color (const Glib::RefPtr<Gdk::Colormap>& map) |
This will fill in the pixel field with the best matching pixel from a color cube. | |
bool | set (const Glib::ustring& value) |
Parses a textual specification of a color and fills in the red, green, and blue values. | |
void | set_blue (gushort value) |
Set the blue component of the color. | |
void | set_green (gushort value) |
Set the green component of the color. | |
void | set_grey (gushort value) |
Set a grey color, by using the same value for all color components. | |
void | set_grey_p (double g) |
void | set_hsl (double h, double s, double l) |
void | set_hsv (double h, double s, double v) |
void | set_red (gushort value) |
Set the red component of the color. | |
void | set_rgb (gushort red_, gushort green_, gushort blue_) |
Set the color, by specifying red, green, and blue color component values. | |
void | set_rgb_p (double red_, double green_, double blue_) |
Set the color, by specifying red, green, and blue color component values, as percentages. | |
void | swap (Color& other) |
~Color () | |
Protected Attributes | |
GdkColor* | gobject_ |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator!= (const Color& lhs, const Color& rhs) |
bool | operator== (const Color& lhs, const Color& rhs) |
void | swap (Color& lhs, Color& rhs) |
Gdk::Color | wrap (GdkColor* object, bool take_copy=false) |
|
|
|
|
|
|
|
Instantiate a new Gdk::Color. You should then use the set methods and call Gdk::Colormap::alloc_color(). |
|
Instantiate a new Gdk::Color. The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, such as DarkSlateGray, or a hex specification such as 305050.
|
|
Get the blue component of the color.
|
|
Get the blue component of the color, as a percentage.
|
|
Get the green component of the color.
|
|
Get the green component of the color, as a percentage.
|
|
Get the pixel value, for allocated colors.
|
|
Get the red component of the color.
|
|
Get the red component of the color, as a percentage.
|
|
Provides access to the underlying C instance.
|
|
Provides access to the underlying C instance.
|
|
Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
|
|
|
|
|
|
This will fill in the pixel field with the best matching pixel from a color cube. The color is then ready to be used for drawing, e.g. you can call Gdk::GC::set_foreground() which expects pixel to be initialized. Call this after setting the red, green, and blue fields. In many cases, you can avoid this whole issue by calling Gdk::GC::set_rgb_fg_color() or Gdk::GC::set_rgb_bg_color(), which do not expect pixels to be initialized in advance. If you use those methods, there's no need for this method().
|
|
Parses a textual specification of a color and fills in the red, green, and blue values. The color is not allocated - you must call Gdk::Colormap::alloc_color() yourself. The text string can be in any of the forms accepted by XParseColor; these include names for a color from rgb.txt, such as DarkSlateGray, or a hex specification such as 305050.
|
|
Set the blue component of the color.
|
|
Set the green component of the color.
|
|
Set a grey color, by using the same value for all color components.
|
|
|
|
|
|
|
|
Set the red component of the color.
|
|
Set the color, by specifying red, green, and blue color component values.
|
|
Set the color, by specifying red, green, and blue color component values, as percentages.
|
|
|
|
|
|
|
|
|
|
|
|
|