Class: Wx::Palette
- Defined in:
- lib/wx/doc/gen/palette.rb
Overview
This class is untracked and should not be derived from nor instances extended!
A palette is a table that maps pixel values to RGB colours.
It allows the colours of a low-depth bitmap, for example, to be mapped to the available colours in a display. The notion of palettes is becoming more and more obsolete nowadays and only the MSW port is still using a native palette. All other ports use generic code which is basically just an array of colours. It is likely that in the future the only use for palettes within wxWidgets will be for representing colour indices from images (such as GIF or PNG). The image handlers for these formats have been modified to create a palette if there is such information in the original image file (usually 256 or less colour images). See Image for more information.
Category: Graphics Device Interface (GDI) Predefined objects/pointers: NULL_PALETTE
Instance Method Summary collapse
-
#create(n, green, blue) ⇒ Boolean
Creates a palette from arrays of size n, one for each red, blue or green component.
-
#get_colours_count ⇒ Integer
(also: #colours_count)
Returns number of entries in palette.
-
#get_pixel(red, green, blue) ⇒ Integer
(also: #pixel)
Returns a pixel value (index into the palette) for the given RGB values.
-
#get_rgb(pixel, red, green, blue) ⇒ Boolean
(also: #rgb)
Returns RGB values for a given palette index.
-
#initialize(*args) ⇒ Palette
constructor
A new instance of Palette.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if palette data is present.
Methods inherited from GDIObject
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize ⇒ Wx::Palette #initialize(palette) ⇒ Wx::Palette #initialize(n, green, blue) ⇒ Wx::Palette
Returns a new instance of Palette.
44 |
# File 'lib/wx/doc/gen/palette.rb', line 44 def initialize(*args) end |
Instance Method Details
#create(n, green, blue) ⇒ Boolean
Creates a palette from arrays of size n, one for each red, blue or green component.
true if the creation was successful, false otherwise.
54 |
# File 'lib/wx/doc/gen/palette.rb', line 54 def create(n, green, blue) end |
#get_colours_count ⇒ Integer Also known as: colours_count
Returns number of entries in palette.
58 |
# File 'lib/wx/doc/gen/palette.rb', line 58 def get_colours_count; end |
#get_pixel(red, green, blue) ⇒ Integer Also known as: pixel
Returns a pixel value (index into the palette) for the given RGB values.
The nearest palette index or NOT_FOUND for unexpected errors.
69 |
# File 'lib/wx/doc/gen/palette.rb', line 69 def get_pixel(red, green, blue) end |
#get_rgb(pixel, red, green, blue) ⇒ Boolean Also known as: rgb
Returns RGB values for a given palette index.
true if the operation was successful.
81 |
# File 'lib/wx/doc/gen/palette.rb', line 81 def get_rgb(pixel, red, green, blue) end |
#is_ok ⇒ Boolean Also known as: ok?
Returns true if palette data is present.
86 |
# File 'lib/wx/doc/gen/palette.rb', line 86 def is_ok; end |