Color

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_colormap(). 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.

Constructors

this
this(GdkColor* gdkColor)

Sets our main struct and passes it to the parent class

this
this()

Creates a new Color

this
this(ubyte red, ubyte green, ubyte blue)
this
this(guint16 red, guint16 green, guint16 blue)

Creates a new Color with RGB values

this
this(uint rgb)
this
this(int rgb)

Members

Functions

copy
Color copy()

Makes a copy of a color structure. The result must be freed using gdk_color_free().

equal
int equal(Color colorb)

Compares two colors.

free
void free()

Frees a color structure created with gdk_color_copy().

getColorStruct
GdkColor* getColorStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getPixelValue
uint getPixelValue()
getStruct
void* getStruct()

the main Gtk struct as a void*

getValue
ulong getValue()
getValue24
int getValue24()
hash
uint hash()

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

set
void set(guint16 red, guint16 green, guint16 blue)

Sets the Color with RGB values

set8
void set8(ubyte red, ubyte green, ubyte blue)
toString
string toString()

Returns a textual specification of color in the hexadecimal form #rrrrggggbbbb, where r, g and b are hex digits representing the red, green and blue components respectively. Since 2.12

Static functions

alloc
int alloc(Colormap colormap, GdkColor color)

Warning gdk_color_alloc has been deprecated since version 2.2 and should not be used in newly-written code. Use gdk_colormap_alloc_color() instead. Allocates a single color from a colormap.

black
Color black()
black
int black(Colormap colormap, GdkColor color)

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 been allocated.

change
int change(Colormap colormap, Color color)

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.

parse
int parse(string spec, GdkColor color)

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 string can either one of a large set of standard names. (Taken from the X11 rgb.txt 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')

white
Color white()
white
int white(Colormap colormap, GdkColor color)

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.

Static variables

_black
Color _black;
Undocumented in source.
_white
Color _white;
Undocumented in source.

Variables

gdkColor
GdkColor* gdkColor;

the main Gtk struct

Meta