Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gdk::Color Class Reference

A GdkColor C++ wrapper class. More...

#include <xfc/gdk/color.hh>

Inheritance diagram for Xfc::Gdk::Color:

Xfc::G::Boxed Xfc::Object Xfc::Trackable List of all members.

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A GdkColor C++ wrapper class.

The Color object is used to describe an allocated or unallocated color.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Constructor & Destructor Documentation

Xfc::Gdk::Color::Color const char *  spec  )  [explicit]
 

Constructs a color object by parsing the textual specification of a color and filling in the red, green, and blue fields.

Parameters:
spec The string specifying the color.
The color is not allocated, you must call allocate() or Gdk::Colormap::alloc_color() yourself. The text string can be in any of the forms accepted by XParseColor; these include the name for a color from rgb.txt, such as DarkSlateGray, or a hex specification such as 305050. Color is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Color::Color unsigned short  value  )  [explicit]
 

Constructs a greyscale color by setting red, green and blue to value.

Parameters:
value A value between 0 and 65535.
Color is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Color::Color unsigned short  r,
unsigned short  g,
unsigned short  b
 

Construct a color with the specified values.

Parameters:
r The red component of the color, a value between 0 and 65535.
g The green component of the color.
b The blue component of the color.
Color is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Color::Color GdkColor *  color  )  [explicit]
 

Construct a new color from an existing GdkColor.

Parameters:
color A pointer to a GdkColor.
The color can be a newly created GdkColor or an existing GdkColor. The Color object created is a temporary object. It doesn't take over the ownership of GdkColor and GdkColor is not freed by the destructor. Color is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Color::Color GdkColor *  color,
bool  copy
 

Construct a new color from an existing GdkColor.

Parameters:
color A pointer to a GdkColor.
copy Whether the Color object should make a copy of GdkColor or not.
The color can be a newly created GdkColor or an existing GdkColor. If copy is true Color will make a copy of GdkColor. If copy is false Color wont make a copy but instead takes over the ownership of GdkColor. Either way, the destructor will free GdkColor when the Color object is destroyed. This constructor is used by G::Boxed::wrap() to wrap GdkColor objects in a C++ wrapper. Color is created with a reference count of 1 that the caller owns.

Xfc::Gdk::Color::Color const Color src  ) 
 

Copy constructor.

Parameters:
src The source color.


Member Function Documentation

bool Xfc::Gdk::Color::allocate const Screen screen = 0  ) 
 

Allocates the color as read-only and best match, using the default system colormap for screen.

Parameters:
screen The Screen to use, or null for the default screen.

void Xfc::Gdk::Color::blue double  b  ) 
 

Sets the blue component of the color.

Parameters:
b The blue component, a value between 0 and 1.

double Xfc::Gdk::Color::blue  )  const
 

Returns the blue component of the color.

This is a value between 0 and 1, with 1 indicating full intensitiy.

bool Xfc::Gdk::Color::equal const Color other  )  const
 

Compares this color with other.

Parameters:
other The color to compare.
Returns:
true if the two colors compare equal.

void Xfc::Gdk::Color::free const Screen screen = 0  ) 
 

Frees a color previously allocated by allocate(), using the default system colormap for screen.

Parameters:
screen The Screen to use, or null for the default screen.

void Xfc::Gdk::Color::get unsigned short &  r,
unsigned short &  g,
unsigned short &  b
const
 

Returns the red, green and blue component values.

Parameters:
r The location to store the red component, a value between 0 and 65535.
g The location to store the green component.
b The location to store the blue component.

unsigned short Xfc::Gdk::Color::get_blue  )  const
 

Returns the blue component of the color.

This is a value between 0 and 65535, with 65535 indicating full intensitiy.

unsigned short Xfc::Gdk::Color::get_green  )  const
 

Returns the green component of the color.

This is a value between 0 and 65535, with 65535 indicating full intensitiy.

unsigned short Xfc::Gdk::Color::get_red  )  const
 

Returns the red component of the color.

This is a value between 0 and 65535, with 65535 indicating full intensitiy.

void Xfc::Gdk::Color::green double  g  ) 
 

Sets the green component of the color.

Parameters:
g The green component, a value between 0 and 1.

double Xfc::Gdk::Color::green  )  const
 

Returns the green component of the color.

This is a value between 0 and 1, with 1 indicating full intensitiy.

unsigned int Xfc::Gdk::Color::hash  )  const
 

A hash function suitable for using for a hash table that stores Gdk::Color's.

Returns:
The hash function applied to this color.

bool Xfc::Gdk::Color::operator!= const Color other  ) 
 

Inequality operator; compares this color with other.

Parameters:
other The color to compare.
Returns:
true if the two colors compare unequal.

Color& Xfc::Gdk::Color::operator= const Color src  ) 
 

Assignment operator.

Parameters:
src The source color.

bool Xfc::Gdk::Color::operator== const Color other  ) 
 

Equality operator; compares this color with other.

Parameters:
other The color to compare.
Returns:
true if the two colors compare equal.

bool Xfc::Gdk::Color::parse const char *  spec  ) 
 

Parses a textual specification of a color and fills in the red, green, and blue fields.

Parameters:
spec The string specifying the color.
Returns:
true if the parsing succeeded.
The color is not allocated, you must call allocate() or Gdk::Colormap::alloc_color() yourself. The text string can be in any of the forms accepted by XParseColor; these include the name for a color from rgb.txt, such as DarkSlateGray, or a hex specification such as 305050.

void Xfc::Gdk::Color::red double  r  ) 
 

Sets the red component of the color.

Parameters:
r The red component, a value between 0 and 1.

double Xfc::Gdk::Color::red  )  const
 

Returns the red component of the color.

This is a value between 0 and 1, with 1 indicating full intensitiy.

void Xfc::Gdk::Color::set unsigned short  r,
unsigned short  g,
unsigned short  b
 

Sets the red, green and blue components to the specified values.

Parameters:
r The red component of the color, a value between 0 and 65535.
g The green component of the color.
b The blue component of the color.

void Xfc::Gdk::Color::set_blue unsigned short  b  ) 
 

Sets the blue component of the color.

Parameters:
b The blue component, a value between 0 and 65535.

void Xfc::Gdk::Color::set_green unsigned short  g  ) 
 

Sets the green component of the color.

Parameters:
g The green component, a value between 0 and 65535.

void Xfc::Gdk::Color::set_grey unsigned short  value  ) 
 

Sets a greyscale color by setting the red, green and blue components to value.

Parameters:
value A value between 0 and 65535.

void Xfc::Gdk::Color::set_pixel unsigned long  p  ) 
 

Sets the pixel value.

Parameters:
p The pixel value.

void Xfc::Gdk::Color::set_red unsigned short  r  ) 
 

Sets the red component of the color.

Parameters:
r The red component, a value between 0 and 65535.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3