gdk.Color.Color Class Reference

List of all members.

Detailed Description

Description These functions are used to modify colormaps.

A colormap is an object that contains the mapping between the color values stored in memory and the RGB values that are used to display color values. In general, colormaps only contain significant information for pseudo-color visuals, but even for other visual types, a colormap object is required in some circumstances. There are a couple of special colormaps that can be retrieved. The system colormap (retrieved with gdk_colormap_get_system()) is the default colormap of the system. If you are using GdkRGB, there is another colormap that is important - the colormap in which GdkRGB works, retrieved with gdk_rgb_get_cmap(). However, when using GdkRGB, it is not generally necessary to allocate colors directly. In previous revisions of this interface, a number of functions that take a GdkColormap parameter were replaced with functions whose names began with "gdk_colormap_". This process will probably be extended somewhat in the future - gdk_color_white(), gdk_color_black(), and gdk_color_change() will probably become aliases.


Public Member Functions

GdkColorgetColorStruct ()
 this (GdkColor *gdkColor)
 Sets our main struct and passes it to the parent class.
 this ()
 Creates a new Color.
 this (ubyte red, ubyte green, ubyte blue)
 this (guint16 red, guint16 green, guint16 blue)
 Creates a new Color with RGB values.
 this (uint rgb)
 this (int rgb)
void set (guint16 red, guint16 green, guint16 blue)
 Sets the Color with RGB values.
void set8 (ubyte red, ubyte green, ubyte blue)
uint getValue ()
int getValue24 ()
uint getPixelValue ()
Color copy ()
 Makes a copy of a color structure.
void free ()
 Frees a color structure created with gdk_color_copy().
int equal (Color colorb)
 Compares two colors.
uint hash ()
 A hash function suitable for using for a hash table that stores GdkColor's.

Static Public Member Functions

static Color black ()
static Color white ()
static int white (Colormap colormap, Color color)
 Warning gdk_color_white is deprecated and should not be used in newly-written code.
static int black (Colormap colormap, Color color)
 Warning gdk_color_black is deprecated and should not be used in newly-written code.
static int parse (char[] spec, Color color)
 Parses a textual specification of a color and fill in the red, green, and blue fields of a GdkColor structure.
static int alloc (Colormap colormap, Color color)
 Warning gdk_color_alloc is deprecated and should not be used in newly-written code.
static int change (Colormap colormap, Color color)
 Warning gdk_color_change is deprecated and should not be used in newly-written code.

Static Public Attributes

static Color _black
static Color _white

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GdkColorgdkColor
 the main Gtk struct


Constructor & Destructor Documentation

gdk.Color.Color.this ( GdkColor gdkColor  ) 

Sets our main struct and passes it to the parent class.

gdk.Color.Color.this (  ) 

Creates a new Color.

gdk.Color.Color.this ( ubyte  red,
ubyte  green,
ubyte  blue 
)

gdk.Color.Color.this ( guint16  red,
guint16  green,
guint16  blue 
)

Creates a new Color with RGB values.

Parameters:
red 
green 
blue 

gdk.Color.Color.this ( uint  rgb  ) 

gdk.Color.Color.this ( int  rgb  ) 


Member Function Documentation

static int gdk.Color.Color.alloc ( Colormap  colormap,
Color  color 
) [static]

Warning gdk_color_alloc is deprecated and should not be used in newly-written code.

Use gdk_colormap_alloc_color() instead. Allocates a single color from a colormap. colormap: a GdkColormap. color: The color to allocate. On return, the pixel field will be filled in. Returns: TRUE if the allocation succeeded.

static int gdk.Color.Color.black ( Colormap  colormap,
Color  color 
) [static]

Warning gdk_color_black is deprecated and should not be used in newly-written code.

Returns the black color for a given colormap. The resulting value has already benn allocated. colormap: a GdkColormap. color: the location to store the color. Returns: TRUE if the allocation succeeded.

static Color gdk.Color.Color.black (  )  [static]

static int gdk.Color.Color.change ( Colormap  colormap,
Color  color 
) [static]

Warning gdk_color_change is deprecated and should not be used in newly-written code.

Changes the value of a color that has already been allocated. If colormap is not a private colormap, then the color must have been allocated using gdk_colormap_alloc_colors() with the writeable set to TRUE. colormap: a GdkColormap. color: a GdkColor, with the color to change in the pixel field, and the new value in the remaining fields. Returns: TRUE if the color was successfully changed.

Color gdk.Color.Color.copy (  ) 

Makes a copy of a color structure.

The result must be freed using gdk_color_free(). color: a GdkColor. Returns: a copy of color.

int gdk.Color.Color.equal ( Color  colorb  ) 

Compares two colors.

colora: a GdkColor. colorb: another GdkColor. Returns: TRUE if the two colors compare equal

void gdk.Color.Color.free (  ) 

Frees a color structure created with gdk_color_copy().

color: a GdkColor.

GdkColor* gdk.Color.Color.getColorStruct (  ) 

uint gdk.Color.Color.getPixelValue (  ) 

void* gdk.Color.Color.getStruct (  )  [protected]

the main Gtk struct as a void*

uint gdk.Color.Color.getValue (  ) 

int gdk.Color.Color.getValue24 (  ) 

uint gdk.Color.Color.hash (  ) 

A hash function suitable for using for a hash table that stores GdkColor's.

colora: a GdkColor. Returns: The hash function appled to colora

static int gdk.Color.Color.parse ( char[]  spec,
Color  color 
) [static]

Parses a textual specification of a color and fill in the red, green, and blue fields of a GdkColor structure.

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 name for a color from rgb.txt, such as DarkSlateGray, or a hex specification such as #3050b2 or #35b. spec: the string specifying the color. color: the GdkColor to fill in Returns: TRUE if the parsing succeeded.

void gdk.Color.Color.set ( guint16  red,
guint16  green,
guint16  blue 
)

Sets the Color with RGB values.

Parameters:
red 
green 
blue 

void gdk.Color.Color.set8 ( ubyte  red,
ubyte  green,
ubyte  blue 
)

static int gdk.Color.Color.white ( Colormap  colormap,
Color  color 
) [static]

Warning gdk_color_white is deprecated and should not be used in newly-written code.

Returns the white color for a given colormap. The resulting value has already allocated been allocated. colormap: a GdkColormap. color: the location to store the color. Returns: TRUE if the allocation succeeded.

static Color gdk.Color.Color.white (  )  [static]


Member Data Documentation

Color gdk.Color.Color._black [static]

Color gdk.Color.Color._white [static]

GdkColor* gdk.Color.Color.gdkColor [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo