Ardour  9.0-pre0-582-g084a23a80d
Gdk::Colormap Class Reference

#include <colormap.h>

Inheritance diagram for Gdk::Colormap:
[legend]

Public Member Functions

virtual ~Colormap ()
 
GdkColormapgobj ()
 Provides access to the underlying C GObject. More...
 
const GdkColormapgobj () const
 Provides access to the underlying C GObject. More...
 
GdkColormapgobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
int alloc_colors (ArrayHandle_Color &colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle< bool > &success)
 
void free_colors (Color &colors, int ncolors)
 
bool alloc_color (Color &color, bool writeable=false, bool best_match=true)
 
void free_color (Color &color)
 
void query_color (gulong pixel, Color &result)
 
Glib::RefPtr< Visualget_visual ()
 
Glib::RefPtr< const Visualget_visual () const
 
Glib::RefPtr< Screenget_screen ()
 
Glib::RefPtr< const Screenget_screen () const
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static Glib::RefPtr< Colormapcreate (const Glib::RefPtr< Visual > &visual, bool allocate)
 
static Glib::RefPtr< Colormapget_system ()
 

Protected Member Functions

 Colormap (const Glib::RefPtr< Visual > &visual, bool allocate)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Colormapwrap (GdkColormap *object, bool take_copy=false)
 

Detailed Description

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

Definition at line 66 of file colormap.h.

Constructor & Destructor Documentation

◆ ~Colormap()

virtual Gdk::Colormap::~Colormap ( )
virtual

◆ Colormap()

Gdk::Colormap::Colormap ( const Glib::RefPtr< Visual > &  visual,
bool  allocate 
)
explicitprotected

Member Function Documentation

◆ alloc_color()

bool Gdk::Colormap::alloc_color ( Color color,
bool  writeable = false,
bool  best_match = true 
)

Allocates a single color from a colormap.

Parameters
colorThe color to allocate. On return the pixel field will be filled in if allocation succeeds.
writeableIf true, the color is allocated writeable (their values can later be changed using gdk_color_change()). Writeable colors cannot be shared between applications.
best_matchIf true, GDK will attempt to do matching against existing colors if the color cannot be allocated as requested.
Returns
true if the allocation succeeded.

◆ alloc_colors()

int Gdk::Colormap::alloc_colors ( ArrayHandle_Color colors,
int  ncolors,
bool  writeable,
bool  best_match,
Glib::ArrayHandle< bool > &  success 
)

◆ create()

static Glib::RefPtr<Colormap> Gdk::Colormap::create ( const Glib::RefPtr< Visual > &  visual,
bool  allocate 
)
static

◆ free_color()

void Gdk::Colormap::free_color ( Color color)

◆ free_colors()

void Gdk::Colormap::free_colors ( Color colors,
int  ncolors 
)

◆ get_screen() [1/2]

Glib::RefPtr<Screen> Gdk::Colormap::get_screen ( )

Gets the screen for which this colormap was created.

Returns
The screen for which this colormap was created.

◆ get_screen() [2/2]

Glib::RefPtr<const Screen> Gdk::Colormap::get_screen ( ) const

Gets the screen for which this colormap was created.

Returns
The screen for which this colormap was created.

◆ get_system()

static Glib::RefPtr<Colormap> Gdk::Colormap::get_system ( )
static

Gets the system's default colormap for the default screen. (See gdk_colormap_get_system_for_screen())

Returns
The default colormap.

◆ get_type()

static GType Gdk::Colormap::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_visual() [1/2]

Glib::RefPtr<Visual> Gdk::Colormap::get_visual ( )

Returns the visual for which a given colormap was created.

Returns
The visual of the colormap.

◆ get_visual() [2/2]

Glib::RefPtr<const Visual> Gdk::Colormap::get_visual ( ) const

Returns the visual for which a given colormap was created.

Returns
The visual of the colormap.

◆ gobj() [1/2]

GdkColormap* Gdk::Colormap::gobj ( )
inline

Provides access to the underlying C GObject.

Definition at line 105 of file colormap.h.

◆ gobj() [2/2]

const GdkColormap* Gdk::Colormap::gobj ( ) const
inline

Provides access to the underlying C GObject.

Definition at line 108 of file colormap.h.

◆ gobj_copy()

GdkColormap* Gdk::Colormap::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ query_color()

void Gdk::Colormap::query_color ( gulong  pixel,
Color result 
)

Locates the RGB color in colormap corresponding to the given hardware pixel pixel. pixel must be a valid pixel in the colormap; it's a programmer error to call this function with a pixel which is not in the colormap. Hardware pixels are normally obtained from alloc_colors(), or from a Gdk::Image. (A Gdk::Image contains image data in hardware format, a Gdk::Pixbuf contains image data in a canonical 24-bit RGB format.)

This function is rarely useful; it's used for example to implement the eyedropper feature in Gtk::ColorSelection.

Parameters
pixelPixel value in hardware display format.
resultGdk::Color with red, green, blue fields initialized.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::Colormap > wrap ( GdkColormap object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: