10 #define ROOT7_RPalette
19 namespace Experimental {
41 struct OrdinalAndColor {
46 friend bool operator<(
const OrdinalAndColor &lhs,
const OrdinalAndColor &rhs)
48 return lhs.fOrdinal < rhs.fOrdinal;
51 friend bool operator<(
const OrdinalAndColor &lhs,
double rhs) {
return lhs.fOrdinal < rhs; }
56 std::vector<OrdinalAndColor> fColors;
59 bool fInterpolate =
true;
62 bool fNormalized =
true;
64 RPalette(
bool interpolate,
bool knownNormalized,
const std::vector<OrdinalAndColor> &points);
65 RPalette(
bool interpolate,
const std::vector<RColor> &points);
74 static constexpr
const Discrete_t kDiscrete{};
83 RPalette(
const std::vector<OrdinalAndColor> &interpPoints): RPalette(true, false, interpPoints) {}
89 RPalette(Discrete_t,
const std::vector<OrdinalAndColor> &points): RPalette(false, false, points) {}
95 RPalette(
const std::vector<RColor> &interpPoints): RPalette(true, interpPoints) {}
100 RPalette(Discrete_t,
const std::vector<RColor> &points): RPalette(false, points) {}
103 bool IsNormalized()
const {
return fNormalized; }
106 bool IsDiscrete()
const {
return !fInterpolate; }
109 bool IsGradient()
const {
return fInterpolate; }
113 RColor GetColor(
double ordinal);
120 static void RegisterPalette(std::string_view name,
const RPalette &palette);
124 static const RPalette &GetPalette(std::string_view name);