Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login


class Gdk::Colormap

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 Gdk::Colormap.system) is the default colormap of the system. If you are using Gdk::RGB, there is another colormap that is important - the colormap in which Gdk::RGB works, retrieved with Gdk::RGB.colormap. However, when using Gdk::RGB, it is not generally necessary to allocate colors directly.

Class Methods, allocate)
Creates a new colormap for the given visual.
  • visual: a Gdk::Visual.
  • allocate: if true, the newly created colormap will be a private colormap, and all colors in it will be allocated for the applications use.
  • Returns: the new Gdk::Colormap.
Returns the system's default colormap.

Instance Methods

alloc_color(color, writeable, best_match)
Allocates a single color from a colormap.
  • color: the color to allocate. On return the pixel field will be filled in if allocation succeeds.
  • writeable: If true, the color is allocated writeable. 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.
Frees a previously allocated color.
  • color: the color(Gdk::Color) to free.
  • Returns: self
Locates the RGB color in colormap corresponding to the given hardware pixel. pixel must be a valid pixel in the colormap; it's a programmer error to call this methodwith a pixel which is not in the colormap. Hardware pixels are normally obtained from Gdk::Colormap#alloc_color, 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 method is rarely useful, it's used for example to implement the eyedropper feature in Gtk::ColorSelection.
  • pixel: pixel value in hardware display format
  • Returns: Gdk::Color with red, green, blue fields initialized
Returns the visual for which a given colormap was created.
Returns an Array containing the current values(Gdk::Color) in the colormap.
  • Returns: self
Ultima modifica:2005/11/17 02:43:41
Parola chiave:
Referenze:[Gdk::Pixbuf] [Gdk::Drawable] [Gdk::Image] [Gdk::Visual] [Pango::Context] [Gdk::Pixmap] [Gdk::GC] [Gdk::Color] [Gtk::Drag] [Gdk::Screen] [Gdk::GLConfig] [Gdk::Colormap] [Gtk::Widget] [Gdk::RGB]