Gdk.Color

Entities

Exceptions

Simple Types

Array Types

Constants

Subprograms

Description

This package provides an interface to the color handling facilities in gtk+. It is able to handle any kind of visual (monochrome, greyscale, color with different depths, ...), but provides a common and easy interface for all of them.

Getting the Red/Green/Blue components can be done through Parse, and is actually recommended, since the exact color generally depends on the visual your application is running on.

<c_version>1.3.6</c_version> <group>Gdk, the low-level API</group>

"="

function "=" (Colora, Colorb : Gdk_Color) return Boolean

True if the Red, Green and Blue components of both colors are equal.

Parameters
Colora
Colorb
Return Value

Blue

function Blue (Color : Gdk_Color) return Guint16

Return the Blue field of Color.

Parameters
Color
Return Value

Copy

procedure Copy (Source : Gdk_Color; Destination : out Gdk_Color)

Copy the Source color to Destination.

Parameters
Source
Destination

Equal

function Equal (Colora, Colorb : Gdk_Color) return Boolean

True if the Red, Green and Blue components of both colors are equal.

Parameters
Colora
Colorb
Return Value

Gdk_Color

type Gdk_Color is private;

A color to be displayed on the screen. Currently, GtkAda only supports the RGB standard, ie each color is set by its red, green and blue components. An extra field (Pixel) is the internal representation of the color, which is set once the color has been allocated.

Gdk_Color_Array

type Gdk_Color_Array is array (Natural range <>) of Gdk_Color;

An array of colors.

Gdk_Color_Or_Null

function Gdk_Color_Or_Null (Val : System.Address) return System.Address

Used for the GtkAda binding itself. Return either a Null_Address or a pointer to Val, depending on whether Val is the null value for the type. In all cases, Val is supposed to be an access to the type mentioned in the name of the subprogram. In Ada2012, these could be replaced with expression functions instead. </doc_ignore>

Parameters
Val
Return Value

Gdk_Color_Type

function Gdk_Color_Type return Glib.GType

Return the internal gtk+ types associated with a color

Return Value

Gdk_Color_Unconstrained_Array

type Gdk_Color_Unconstrained_Array is array (Natural) of Gdk_Color;

An array of colors as returned by C. This is only useful in a few low-level subprograms that also pass the size as argument

Get_Property

function Get_Property
  (Object : access Glib.Object.GObject_Record'Class;
   Name   : Property_Gdk_Color) return Gdk_Color
Parameters
Object
Name
Return Value

Get_Value

function  Get_Value (Value : Glib.Values.GValue) return Gdk_Color

Store or retrieve a color from a value

Parameters
Value
Return Value

Green

function Green (Color : Gdk_Color) return Guint16

Return the Green field of Color.

Parameters
Color
Return Value

Null_Color

Null_Color : constant Gdk_Color;

No color. For most functions, this will select the default color in the context, although this exact specification depends on the function you want to use.

Parse

function Parse (Spec : String) return Gdk_Color

Parse the string Spec, and get its Red/Green/Blue components. The color is not allocated, and you need to call Alloc_Color. If the string could not be parsed to an existing color, Wrong_Color is raised. The string can be one of :

Parameters
Spec
Return Value

Pixel

function Pixel (Color : Gdk_Color) return Guint32

Return the Pixel field of Color.

Parameters
Color
Return Value

Property_Gdk_Color

type Property_Gdk_Color is new Glib.Property;

Red

function Red (Color : Gdk_Color) return Guint16

Return the Red field of Color.

Parameters
Color
Return Value

Set_Pixel

procedure Set_Pixel (Color : in out Gdk_Color; Pixel : Guint32)

This function should almost never be used.

Parameters
Color
Pixel

Set_Property

procedure Set_Property
  (Object : access Glib.Object.GObject_Record'Class;
   Name   : Property_Gdk_Color;
   Value  : Gdk_Color)
Parameters
Object
Name
Value

Set_Rgb

procedure Set_Rgb (Color : out Gdk_Color; Red, Green, Blue : Guint16)

Modify the fields of the color. You then have to allocate the color with one of the Alloc* functions above.

Parameters
Color
Red
Green
Blue

Set_Value

procedure Set_Value (Value : in out Glib.Values.GValue; Val : Gdk_Color)

Store or retrieve a color from a value

Parameters
Value
Val

To_Array

function To_Array
   (Colors   : Gdk_Color_Unconstrained_Array;
    N_Colors : Gint) return Gdk_Color_Array

Return a version of Colors easier to use in Ada.

Parameters
Colors
N_Colors
Return Value

To_String

function To_String (Color : Gdk_Color) return String

Return the RGB values of Color under the form "#RRGGBB". Directly usable by Parse, see above.

Parameters
Color
Return Value

Wrong_Color

Wrong_Color : exception;

Exception raised when some functions below could not find or allocate a color on the user's system.