Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::Colormap Class Reference

A Colormap. More...

#include <geogram/image/colormap.h>

Inheritance diagram for GEO::Colormap:
GEO::Counted

Public Types

typedef GenColor< Numeric::uint8ColorCell
 Type of each cell of the Colormap.
 

Public Member Functions

 Colormap (index_t size_in=256)
 Colormap constructor. More...
 
 ~Colormap () override
 Colormap destructor.
 
const ColorCellcolor_cell (index_t index) const
 Gets a ColorCell by index. More...
 
ColorCellcolor_cell (index_t index)
 Gets a ColorCell by index. More...
 
index_t size () const
 Gets the size. More...
 
void set_color (index_t index, float r, float g, float b)
 Sets a color by index and components. More...
 
void set_color (index_t index, float r, float g, float b, float a)
 Sets a color by index and components. More...
 
void color_ramp_component (index_t component, index_t index1, Numeric::uint8 val1, index_t index2, Numeric::uint8 val2)
 Make a color component linearly interpolate two values between two given indices. More...
 
void color_ramp_rgba (index_t index1, const Color &c1, index_t index2, const Color &c2)
 Make a color linearly interpolate two values between two given indices. More...
 
void color_ramp_rgb (index_t index1, const Color &c1, index_t index2, const Color &c2)
 Make a color linearly interpolate two values between two given indices. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Detailed Description

A Colormap.

A Colormap is an array of colors, encoded with one byte per component.

Definition at line 61 of file colormap.h.

Constructor & Destructor Documentation

◆ Colormap()

GEO::Colormap::Colormap ( index_t  size_in = 256)

Colormap constructor.

Parameters
[in]size_innumber of cells in the Colormap

Member Function Documentation

◆ color_cell() [1/2]

ColorCell& GEO::Colormap::color_cell ( index_t  index)
inline

Gets a ColorCell by index.

Parameters
[in]indexthe index of the ColorCell
Returns
a modifiable reference to the ColorCell
Precondition
index < size()

Definition at line 97 of file colormap.h.

◆ color_cell() [2/2]

const ColorCell& GEO::Colormap::color_cell ( index_t  index) const
inline

Gets a ColorCell by index.

Parameters
[in]indexthe index of the ColorCell
Returns
a const reference to the ColorCell
Precondition
index < size()

Definition at line 86 of file colormap.h.

◆ color_ramp_component()

void GEO::Colormap::color_ramp_component ( index_t  component,
index_t  index1,
Numeric::uint8  val1,
index_t  index2,
Numeric::uint8  val2 
)

Make a color component linearly interpolate two values between two given indices.

Parameters
[in]componentthe index of the component, one of 0,1,2,3
[in]index1the first index
[in]val1the first value of the component, associated with index1
[in]index2the second index
[in]val2the second value of the component, associated with index2

◆ color_ramp_rgb()

void GEO::Colormap::color_ramp_rgb ( index_t  index1,
const Color c1,
index_t  index2,
const Color c2 
)

Make a color linearly interpolate two values between two given indices.

Only r,g,b are updated. Transparency a is left unmodified in the concerned color cells.

Parameters
[in]index1the first index
[in]c1the first color, associated with index1
[in]index2the second index
[in]c2the first color, associated with index2

◆ color_ramp_rgba()

void GEO::Colormap::color_ramp_rgba ( index_t  index1,
const Color c1,
index_t  index2,
const Color c2 
)

Make a color linearly interpolate two values between two given indices.

All components and transparency are updated.

Parameters
[in]index1the first index
[in]c1the first color, associated with index1
[in]index2the second index
[in]c2the first color, associated with index2

◆ set_color() [1/2]

void GEO::Colormap::set_color ( index_t  index,
float  r,
float  g,
float  b 
)

Sets a color by index and components.

The transparency a is left unchanged.

Parameters
[in]indexthe index
[in]r,g,bthe components, as single-precision floating points, between 0.0f, and 1.0f

◆ set_color() [2/2]

void GEO::Colormap::set_color ( index_t  index,
float  r,
float  g,
float  b,
float  a 
)

Sets a color by index and components.

Parameters
[in]indexthe index
[in]r,g,b,athe components, as single-precision floating points, between 0.0f, and 1.0f

◆ size()

index_t GEO::Colormap::size ( ) const
inline

Gets the size.

Returns
the number of ColorCells in this Colormap

Definition at line 106 of file colormap.h.


The documentation for this class was generated from the following file: