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.
Objects:
NullPalette
Palette.new(Palette palette)
Copy constructor. This uses reference counting so is a cheap operation.
Palette.new(Integer n, Integer red,
Integer green,
Integer blue)
Creates a palette from arrays of size n, one for each red, blue or green component.
destructor()
Destructor.
Boolean create(Integer n, Integer red, Integer green,
Integer blue)
Creates a palette from arrays of size n, one for each red, blue or green component.
true if the creation was successful, false otherwise.
Integer get_colours_count()
Returns number of entries in palette.
Integer get_pixel(Integer red, Integer green, Integer blue)
Returns a pixel value (index into the palette) for the given RGB values.
The nearest palette index.
Boolean get_rgb(Integer pixel, Integer red, Integer green,
Integer blue)
Returns RGB values for a given palette index.
true if the operation was successful.
Boolean ok()
Returns true if palette data is present.
Palette operator $=$(Palette palette)
Assignment operator, using reference counting. Returns a reference to `this’.
Boolean operator $==$(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.
Boolean operator $!=$(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 Thu May 01 00:50:42 +0100 2008]