RGBA

The GdkRGBA struct is a convenient way to pass rgba colors around. It's based on cairo's way to deal with colors and mirrors its behavior. All values are in the range from 0.0 to 1.0 inclusive. So the color (0.0, 0.0, 0.0, 0.0) represents transparent black and (1.0, 1.0, 1.0, 1.0) is opaque white. Other values will be clamped to this range when drawing.

Constructors

this
this(GdkRGBA* gdkRGBA)

Sets our main struct and passes it to the parent class

this
this()
this(double red, double green, double blue, double alpha)

Creates a new RGBA Color

Destructor

~this
~this()
Undocumented in source.

Members

Functions

alpha
double alpha()
void alpha(double value)
blue
double blue()
void blue(double value)

The color values. All values are in the range from 0.0 to 1.0 inclusive.

copy
RGBA copy()

Makes a copy of a GdkRGBA structure. The result must be freed through gdk_rgba_free().

free
void free()

Frees a GdkRGBA struct created with gdk_rgba_copy()

getRGBAStruct
GdkRGBA* getRGBAStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

green
double green()
void green(double value)

The color values. All values are in the range from 0.0 to 1.0 inclusive.

parse
int parse(string spec)

Parses a textual representation of a color, filling in the red, green, blue and alpha fields of the rgba struct.

red
double red()
void red(double value)

The color values. All values are in the range from 0.0 to 1.0 inclusive.

toString
string toString()

Returns a textual specification of rgba in the form rgb (r, g, b) or rgba (r, g, b, a), where 'r', 'g', 'b' and 'a' represent the red, green, blue and alpha values respectively. r, g, and b are represented as integers in the range 0 to 255, and a is represented as floating point value in the range 0 to 1. These string forms are string forms those supported by the CSS3 colors module, and can be parsed by gdk_rgba_parse(). Note that this string representation may lose some precision, since r, g and b are represented as 8-bit integers. If this is a concern, you should use a different representation.

Static functions

equal
int equal(void* p1, void* p2)

Compares two RGBA colors.

hash
uint hash(void* p)

A hash function suitable for using for a hash table that stores GdkRGBAs.

Variables

gdkRGBA
GdkRGBA* gdkRGBA;

the main Gtk struct

Meta