17#include <unordered_map>
25 throw std::runtime_error(
"Must have at least two points to build a palette!");
31 double high =
fColors.back().fOrdinal;
32 double low =
fColors.front().fOrdinal;
33 double prec = (high - low) * 1
e-8;
41std::vector<RPalette::OrdinalAndColor>
AddOrdinals(
const std::vector<RColor> &
points)
43 std::vector<RPalette::OrdinalAndColor>
ret(
points.size());
45 return {1. / (
points.size() - 1) * (&col -
points.data()), col};
64 constexpr float epsilon = 1
e-8;
77 if ((
diff1 < -epsilon) || (
diff2 < -epsilon)) {
92 if ((dist > epsilon) && (
rgba1.size() > 2) && (
rgba2.size() > 2)) {
93 if (
rgba1.size() == 4)
94 rgba2.resize(4, 0xff);
95 else if (
rgba2.size() == 4)
96 rgba1.resize(4, 0xff);
98 for (
unsigned i = 0; i <
rgba1.size(); ++i)
103 if (
rgba1.size() == 4)
#define R__LOG_ERROR(...)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
static R__DLLEXPORT constexpr RGB_t kRed
void SetRGB(const RGB_t &rgb)
Set r/g/b components of color.
static R__DLLEXPORT constexpr RGB_t kWhite
void SetAlpha(uint8_t alpha)
Set alpha as value from range 0..255.
static R__DLLEXPORT constexpr RGB_t kBlack
static R__DLLEXPORT constexpr RGB_t kBlue
static void RegisterPalette(std::string_view name, const RPalette &palette)
Register a palette in the set of global palettes, making it available to GetPalette().
RColor GetColor(double ordinal)
Get the color associated with the ordinal value.
std::vector< OrdinalAndColor > fColors
Palette colors: the color points and their ordinal value.
static const RPalette & GetPalette(std::string_view name="")
Get a global palette by name.
bool fNormalized
Whether the palette's ordinal numbers are normalized.
bool IsGradient() const
Whether the palette is a smooth gradient generated by interpolating between the color points.
const_iterator begin() const
RLogChannel & GPadLog()
Log channel for GPad diagnostics.
An ordinal value and its associated color.