16 #ifndef ROOT7_TPalette
17 #define ROOT7_TPalette
26 namespace Experimental {
66 TPalette(
bool interpolate,
bool knownNormalized,
const std::vector<OrdinalAndColor> &
points);
85 TPalette(
const std::vector<OrdinalAndColor> &interpPoints):
TPalette(true, false, interpPoints) {}
bool IsDiscrete() const
Whether the palette is discrete, i.e. does no interpolation between colors.
TColor fColor
The color associated with the value.
static constexpr const Discrete_t kDiscrete
Tag value used to signal that the palette's colors should not be interpolated.
double fOrdinal
The value associated with the color.
bool fInterpolate
Whether to interpolate between the colors (in contrast to picking one of fColors).
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 fNormalized
Whether the palette's ordinal numbers are normalized.
friend bool operator<(const OrdinalAndColor &lhs, const OrdinalAndColor &rhs)
Compare two OrdinalAndColors, for sorting.
Tag type used to signal that the palette's colors should not be interpolated.
TColor ResolveRGBAColor(const TColor &col)
Given a TColor (that might either be a RGBA or a TPalette ordinal), get the RGBA-based color...
TPalette(Discrete_t, const std::vector< TColor > &points)
Construct a normalized TPalette from a vector of colors.
An ordinal value and its associated color.
TColor GetColor(double ordinal)
Get the color associated with the ordinal value.
TPalette(Discrete_t, const std::vector< OrdinalAndColor > &points)
Construct a TPalette from a vector of (ordinal|color) pairs.
static const TPalette & GetPalette(std::string_view name)
Get a global palette by name.
static void RegisterPalette(std::string_view name, const TPalette &palette)
Register a palette in the set of global palettes, making it available to GetPalette().
friend bool operator<(const OrdinalAndColor &lhs, double rhs)
Compare an OrdinalAndColor and an ordinal value.
bool IsRGBA() const
Determine whether this TColor is storing RGBA (in contrast to an ordinal of a TPalette).
TPalette(const std::vector< OrdinalAndColor > &interpPoints)
Construct a TPalette from a vector of (ordinal|color) pairs as interpolation points.
bool IsGradient() const
Whether the palette is a smooth gradient generated by interpolating between the color points...
TPalette(const std::vector< TColor > &interpPoints)
Construct a normalized TPalette from a vector of colors as interpolation points.
A color: Red|Green|Blue|Alpha, or a position in a TPalette.
float GetPaletteOrdinal() const
If this is an ordinal in a palette, resolve the.