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.
Some of these functions expect a Colormap. There are two ways you can
get such a colormap, either a system default colormap or a per-widget
colormap. It is recommended, unless you are writing your own new widget,
to always use the system default Colormap. All the functions to get
these colormaps are found in
Gtk.Widget.
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.
Note for users transitioning from gtk+ 1.2: the Get_System call is now
obsolete, and you should use Gtk.Widget.Get_Default_Colormap instead.
Types
-
type Gdk_Color is private;
-
type Gdk_Color_Array is array (Natural range <>) of Gdk_Color;
-
type Gdk_Colormap is Gdk.Gdk_Colormap;
Subprograms
-
-
Setting/Getting the fields of Gdk_Color
-
procedure Set_Rgb (Color : out Gdk_Color; Red, Green, Blue : Guint16);
-
procedure Set_Pixel (Color : in out Gdk_Color; Pixel : Guint32);
-
function Red (Color : Gdk_Color) return Guint16;
-
function Green (Color : Gdk_Color) return Guint16;
-
function Blue (Color : Gdk_Color) return Guint16;
-
function Pixel (Color : Gdk_Color) return Guint32;
Creating and Destroying colors
-
procedure Gdk_New
(Colormap : out Gdk_Colormap;
Visual : Gdk.Visual.Gdk_Visual;
Private_Cmap : Boolean);
-
procedure Ref (Colormap : Gdk_Colormap);
-
procedure Unref (Colormap : Gdk_Colormap);
-
procedure Change
(Colormap : Gdk_Colormap; Ncolors : Gint);
-
procedure Alloc_Colors
(Colormap : Gdk_Colormap;
Colors : in out Gdk_Color_Array;
Writeable : Boolean := False;
Best_Match : Boolean := True;
Success : out Boolean_Array;
Result : out Gint);
-
procedure Alloc_Color
(Colormap : Gdk_Colormap;
Color : in out Gdk_Color;
Writeable : Boolean := False;
Best_Match : Boolean := True;
Success : out Boolean);
-
procedure Free_Colors (Colormap : Gdk_Colormap; Colors : Gdk_Color_Array);
-
procedure Get_Visual
(Colormap : Gdk_Colormap;
Visual : out Gdk.Visual.Gdk_Visual);
-
procedure Copy (Source : Gdk_Color; Destination : out Gdk_Color);
-
function Parse (Spec : String) return Gdk_Color;
-
function Equal (Colora, Colorb : Gdk_Color) return Boolean;
Example
-- Here is an example how you can allocate a new color, when you know
-- its red/green/blue components: Note that we allocate white in fact
-- since the maximal value for color components is 65535.
Color : Gdk_Color;
Success : Boolean;
Set_Rbg (Color, 65535, 65535, 65535);
Alloc_Color (Colormap => Gtk.Widget.Get_Default_Colormap,
Color => Color,
Writeable => False,
Best_Match => True,
Success => Success);
if not Success then
...; -- allocation failed
end if;