wxRuby Documentation Home

Wx::Palette

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.

Derived from

GDIObject

Object

Predefined objects

Objects:

NullPalette

See also

DC#set_palette, Bitmap

Methods

Palette.new

Palette.new(%(arg-type)Palette% palette)

Copy constructor. This uses reference counting so is a cheap operation.

Palette.new(%(arg-type)Integer% n, Integer red, Integer green, Integer blue)

Creates a palette from arrays of size n, one for each
red, blue or green component.

Parameters

See also

Palette#create

destructor()

Destructor.

Palette#create

Boolean create(%(arg-type)Integer% n, Integer red, Integer green, Integer blue)

Creates a palette from arrays of size n, one for each
red, blue or green component.

Parameters

Return value

true if the creation was successful, false otherwise.

See also

Palette.new

Palette#get_colours_count

Integer get_colours_count()

Returns number of entries in palette.

Palette#get_pixel

Integer get_pixel(%(arg-type)Integer% red, Integer green, Integer blue)

Returns a pixel value (index into the palette) for the given RGB values.

Parameters

Return value

The nearest palette index.

See also

Palette#get_rgb

Palette#get_rgb

Boolean get_rgb(%(arg-type)Integer% pixel, Integer red, Integer green, Integer blue)

Returns RGB values for a given palette index.

Parameters

Return value

true if the operation was successful.

See also

Palette#get_pixel

Palette#ok

Boolean ok()

Returns true if palette data is present.

Palette#=

Palette operator $=$(%(arg-type)Palette% palette)

Assignment operator, using reference counting. Returns a reference
to `this’.

Palette#==

Boolean operator $==$(%(arg-type)Palette% palette)

Equality operator. Two palettes are equal if they contain pointers
to the same underlying palette data. It does not compare each attribute,
so two independently-created palettes using the same parameters will
fail the test.

Palette#!=

Boolean operator $!=$(%(arg-type)Palette% palette)

Inequality operator. Two palettes are not equal if they contain pointers
to different underlying palette data. It does not compare each attribute.

[This page automatically generated from the Textile source at 2023-06-13 21:31:33 +0000]