cgv
Loading...
Searching...
No Matches
cgv::media::discrete_color_scheme Class Reference

This class represents a discrete color scheme using sets of colors to convert discrete scalars to colors. More...

#include <color_scheme.h>

Inheritance diagram for cgv::media::discrete_color_scheme:
cgv::media::color_scheme

Public Member Functions

 discrete_color_scheme ()
 Construct an empty scheme.
 
 discrete_color_scheme (const std::vector< cgv::rgb > &colors, ColorSchemeType type=ColorSchemeType::kUndefined)
 Construct from a set of colors and scheme type.
 
 discrete_color_scheme (const std::vector< std::vector< cgv::rgb > > &variants, ColorSchemeType type=ColorSchemeType::kUndefined)
 Construct from a list of color sets and scheme type.
 
const std::vector< cgv::rgbget_colors (size_t n) const
 Return a sequence of colors of the specified count.
 

Additional Inherited Members

- Public Attributes inherited from cgv::media::color_scheme
ColorSchemeType type = ColorSchemeType::kUndefined
 The type of this color scheme.
 

Detailed Description

This class represents a discrete color scheme using sets of colors to convert discrete scalars to colors.

Definition at line 149 of file color_scheme.h.

Constructor & Destructor Documentation

◆ discrete_color_scheme() [1/3]

cgv::media::discrete_color_scheme::discrete_color_scheme ( )
inline

Construct an empty scheme.

Definition at line 152 of file color_scheme.h.

◆ discrete_color_scheme() [2/3]

cgv::media::discrete_color_scheme::discrete_color_scheme ( const std::vector< cgv::rgb > &  colors,
ColorSchemeType  type = ColorSchemeType::kUndefined 
)
inline

Construct from a set of colors and scheme type.

The type should describe the color set produced by the interpolator if possible (typically ColorSchemeType::kCategorical).

Parameters
colorsThe set of used colors.
typeThe color scheme type.

Definition at line 158 of file color_scheme.h.

◆ discrete_color_scheme() [3/3]

cgv::media::discrete_color_scheme::discrete_color_scheme ( const std::vector< std::vector< cgv::rgb > > &  variants,
ColorSchemeType  type = ColorSchemeType::kUndefined 
)
inline

Construct from a list of color sets and scheme type.

The color sets represent variants of the scheme that should be similar but can express slight variations at different scheme sizes.

Parameters
variantsThe list of sets of color scheme variants.
typeThe color scheme type.

Definition at line 165 of file color_scheme.h.

References cgv::media::color_scheme::type.

Member Function Documentation

◆ get_colors()

const std::vector< cgv::rgb > cgv::media::discrete_color_scheme::get_colors ( size_t  n) const
inline

Return a sequence of colors of the specified count.

Returns the scheme variant with exact size n if it exists. Otherwise, for schemes of type ColorSchemeType::kCategorical the next largest or largest available variant is returned, possibly being larger than n. For all other scheme types the next smaller variant is smoothly interpolated at n positions and the result returned.

Parameters
nThe number of requested colors.
Returns
A sequence of n colors.

Definition at line 180 of file color_scheme.h.

References cgv::math::interpolator< ValueT, ParamT >::quantize().

Referenced by cgv::media::discrete_color_scale::set_scheme().


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