19namespace Experimental {
64 RPalette(
bool interpolate,
bool knownNormalized,
const std::vector<OrdinalAndColor> &
points);
83 RPalette(
const std::vector<OrdinalAndColor> &interpPoints):
RPalette(true, false, interpPoints) {}
RPalette(Discrete_t, const std::vector< OrdinalAndColor > &points)
Construct a RPalette from a vector of (ordinal|color) pairs.
RPalette(Discrete_t, const std::vector< RColor > &points)
Construct a normalized RPalette from a vector of colors.
static void RegisterPalette(std::string_view name, const RPalette &palette)
Register a palette in the set of global palettes, making it available to GetPalette().
bool IsDiscrete() const
Whether the palette is discrete, i.e. does no interpolation between colors.
RColor GetColor(double ordinal)
Get the color associated with the ordinal value.
RPalette(const std::vector< RColor > &interpPoints)
Construct a normalized RPalette from a vector of colors as interpolation points.
RPalette(const std::vector< OrdinalAndColor > &interpPoints)
Construct a RPalette from a vector of (ordinal|color) pairs as interpolation points.
std::vector< OrdinalAndColor > fColors
Palette colors: the color points and their ordinal value.
bool IsNormalized() const
Whether the palette is normalized, i.e. covers colors in the ordinal range 0..1.
bool fInterpolate
Whether to interpolate between the colors (in contrast to picking one of fColors).
bool fNormalized
Whether the palette's ordinal numbers are normalized.
static const RPalette & GetPalette(std::string_view name)
Get a global palette by name.
bool IsGradient() const
Whether the palette is a smooth gradient generated by interpolating between the color points.
static constexpr const Discrete_t kDiscrete
Tag value used to signal that the palette's colors should not be interpolated.
basic_string_view< char > string_view
Tag type used to signal that the palette's colors should not be interpolated.
An ordinal value and its associated color.
friend bool operator<(const OrdinalAndColor &lhs, double rhs)
Compare an OrdinalAndColor and an ordinal value.
double fOrdinal
The value associated with the color.
RColor fColor
The color associated with the value.
friend bool operator<(const OrdinalAndColor &lhs, const OrdinalAndColor &rhs)
Compare two OrdinalAndColors, for sorting.