Antiprism 0.23
|
A colour map class. More...
#include <col_map.h>
Public Member Functions | |
color_map () | |
Constructor. | |
virtual | ~color_map () |
Destructor. | |
virtual bool | init (const char *map_name, char *errmsg=0) |
Initialise from a string. | |
bool | init_strip (char *map_name, char *errmsg=0) |
Initialise from a string, stripping parameters from the end. | |
bool | read_params (const char *params, char *errmsg) |
Read parameters. | |
virtual color_map * | get_condensed () const |
Get a copy of the map with any with the values indexed by order. | |
virtual color_map * | clone () const |
Get a copy of the map. | |
virtual int | effective_size () const |
The effective size of the map. | |
int | get_shift () const |
Get the map shift. | |
void | set_shift (int shft) |
Set the map shift. | |
int | get_step () const |
Get the map step. | |
void | set_step (int stp) |
Set the map shift. | |
int | get_wrap () const |
Get the map wrap size. | |
void | set_wrap (int wrp=-1) |
Set the map wrap size. | |
int | get_effective_index (int idx) const |
Get effective index. | |
virtual col_val | get_col (int) const |
Get the colour value for an index number. | |
void | cycle_colors () |
Cycle the map colours. | |
Protected Member Functions | |
void | copy_params (const color_map &cmap) |
Copy parameters. |
A colour map class.
virtual color_map* color_map::clone | ( | ) | const [inline, virtual] |
Get a copy of the map.
delete
, 0 indicates that the clone failed. Reimplemented in color_map_remap, color_map_deal, color_map_range, color_map_range_hsv, color_map_range_rgb, color_map_range_rand, color_map_range_rand_hsv, color_map_range_rand_rgb, color_map_spread, color_map_map, and color_map_multi.
void color_map::copy_params | ( | const color_map & | cmap | ) | [protected] |
Copy parameters.
cmap | the colour map to copy parameters from. |
void color_map::cycle_colors | ( | ) | [inline] |
Cycle the map colours.
Each colour index number is mapped to the previous colour value in the colour map.
virtual int color_map::effective_size | ( | ) | const [inline, virtual] |
The effective size of the map.
The effective size of a map is one greater than the highest index number in the map. It is the size of the smallest map (sequential, starting at 0) that will include all the entries of the map.
Reimplemented in color_map_deal, color_map_range, color_map_map, and color_map_multi.
virtual col_val color_map::get_col | ( | int | ) | const [inline, virtual] |
Get the colour value for an index number.
Reimplemented in color_map_remap, color_map_deal, color_map_range, color_map_range_rand, color_map_spread, color_map_map, and color_map_multi.
virtual color_map* color_map::get_condensed | ( | ) | const [inline, virtual] |
Get a copy of the map with any with the values indexed by order.
delete
, 0 indicates that the copy failed. Reimplemented in color_map_map.
int color_map::get_effective_index | ( | int | idx | ) | const [inline] |
Get effective index.
The effective index is (shift + index*step)wrap
idx | the index |
int color_map::get_shift | ( | ) | const [inline] |
Get the map shift.
Lookup of colour values is determined by (shift + index*step)wrap
int color_map::get_step | ( | ) | const [inline] |
Get the map step.
Look up of colour values is determined by (shift + index*step)wrap
int color_map::get_wrap | ( | ) | const [inline] |
Get the map wrap size.
Look up of colour values is determined by (shift + index*step)wrap a value of 0 indicates no wrapping.
bool color_map::init | ( | const char * | map_name, |
char * | errmsg = 0 |
||
) | [virtual] |
Initialise from a string.
map_name | the map name. |
errmsg | an array at least MSG_SZ chars long to return any error message. |
Reimplemented in color_map_deal, color_map_range, color_map_range_hsv, color_map_range_rgb, color_map_range_rand_hsv, color_map_range_rand_rgb, color_map_spread, color_map_map, and color_map_multi.
bool color_map::init_strip | ( | char * | map_name, |
char * | errmsg = 0 |
||
) |
Initialise from a string, stripping parameters from the end.
map_name | the map name. |
errmsg | an array at least MSG_SZ chars long to return any error message. |
bool color_map::read_params | ( | const char * | params, |
char * | errmsg | ||
) |
Read parameters.
params | the map name to read parameters from. |
errmsg | an array at least MSG_SZ chars long to return any error message. |
void color_map::set_shift | ( | int | shft | ) | [inline] |
Set the map shift.
Lookup of colour values is determined by (shift + index*step)wrap
shft | the shift |
void color_map::set_step | ( | int | stp | ) | [inline] |
Set the map shift.
Look up of colour values is determined by (shift + index*step)wrap
stp | the step |
void color_map::set_wrap | ( | int | wrp = -1 | ) |
Set the map wrap size.
Look up of colour values is determined by (shift + index*step)wrap a value of 0 indicates no wrapping, a negative value indicates wrapping after the highest index number.
wrp | the wrap |