Main Page Widgets Namespaces Book

# Gdk::Colormap Class Reference

Inheritance diagram for Gdk::Colormap:

[legend]
List of all members.

## Public Member Functions

virtual | ~Colormap ()
GdkColormap* | gobj ()
| Provides access to the underlying C GObject.
const GdkColormap* | gobj () const
| Provides access to the underlying C GObject.
GdkColormap* | gobj_copy ()
int | alloc_colors (GdkColor* colors, int ncolors, bool writeable, bool best_match, gboolean* success)
| Allocates colors from a colormap.
bool | alloc_color (Color& color, bool writeable=false, bool best_match=true)
| Allocates a single color from a colormap.
void | free_colors (GdkColor* colors, int ncolors)
| Frees previously allocated colors.
void | query_color (gulong pixel, Color& result)
| Locates the RGB color in colormap corresponding to the given hardware pixel pixel .
Glib::RefPtr<Visual> | get_visual ()
| Returns the visual for which a given colormap was created.
Glib::RefPtr<const Visual> | get_visual () const
| Returns the visual for which a given colormap was created.
Glib::RefPtr<Screen> | get_screen ()
| Gets the screen for which this colormap was created.
Glib::RefPtr<const Screen> | get_screen () const
| Gets the screen for which this colormap was created.

## Static Public Member Functions

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

## Protected Member Functions

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

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gdk::Colormap> | wrap (GdkColormap* object, bool take_copy=false)

## Constructor & Destructor Documentation

virtual Gdk::Colormap::~Colormap | ( |  | ) | `[virtual]`

Gdk::Colormap::Colormap | ( | const Glib::RefPtr<Visual>& | visual,
|  | bool | allocate
| ) | `[explicit, protected]`

## Member Function Documentation

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

Allocates a single color from a colormap.

Parameters:

  color | The color to allocate. On return the <structfield>pixel</structfield> field will be filled in if allocation succeeds.
  writeable | If `true`, the color is allocated writeable (their values can later be changed using gdk_color_change()). Writeable colors cannot be shared between applications.
  best_match | If `true`, GDK will attempt to do matching against existing colors if the color cannot be allocated as requested.

Returns:
  `true` if the allocation succeeded.

int Gdk::Colormap::alloc_colors | ( | GdkColor* | colors,
|  | int | ncolors,
|  | bool | writeable,
|  | bool | best_match,
|  | gboolean* | success
| ) |

Allocates colors from a colormap.

Parameters:

  colors | The color values to allocate. On return, the pixel values for allocated colors will be filled in.
  ncolors | The number of colors in colors .
  writeable | If `true`, the colors are allocated writeable (their values can later be changed using gdk_color_change()). Writeable colors cannot be shared between applications.
  best_match | If `true`, GDK will attempt to do matching against existing colors if the colors cannot be allocated as requested.
  success | An array of length ncolors . On return, this indicates whether the corresponding color in colors was sucessfully allocated or not.

Returns:
  The number of colors that were not sucessfully allocated.

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

void Gdk::Colormap::free_colors | ( | GdkColor* | colors,
|  | int | ncolors
| ) |

Frees previously allocated colors.

Parameters:

  colors | The colors to free.
  ncolors | The number of colors in colors .

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.

Since: 2.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.

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

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

Returns the visual for which a given colormap was created.

Returns:
  The visual of the colormap.

const GdkColormap* Gdk::Colormap::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GdkColormap* Gdk::Colormap::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GdkColormap* Gdk::Colormap::gobj_copy | ( |  | ) |

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:

  pixel | Pixel value in hardware display format.
  result | Gdk::Color with red, green, blue fields initialized.

## Friends And Related Function Documentation

Glib::RefPtr<Gdk::Colormap> wrap | ( | GdkColormap* | object,
|  | bool | take_copy = false
| ) | `[related]`

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

- colormap.h