93 float linearToPalette(
const float value)
const;
95 float paletteToLinear(
const float value)
const;
Generic dynamically allocated resizable storage.
Generic wrappers of lambdas, functors and other callables.
uint32_t Size
Integral type used to index arrays (by default).
#define NAMESPACE_SPH_END
Return value of function that may fail, containing either SUCCEES (true) or error message.
@ HYBRID
Logarithic scale for values > 1 and < -1, linear scale on interval <-1, 1>
Generic dynamically allocated resizable storage.
Object representing a 1D interval of real numbers.
Represents a color palette, used for mapping arbitrary number to a color.
void setInterval(const Interval &newRange)
Palette & operator=(const Palette &other)
float relativeToPalette(const float value) const
Converts a relative position to an absolute position on a palette.
PaletteScale getScale() const
Returns the scale of the palette.
Palette transform(Function< Rgba(const Rgba &)> func) const
Returns the palette with colors modified by generic transform.
Palette(Palette &&other)=default
Outcome saveToStream(std::ostream &ofs, const Size lineCnt=256) const
Saves the palettes into given output stream.
float paletteToRelative(const float value) const
Inverse transform to relativeToPalette.
Outcome loadFromFile(const Path &path)
Loads the palette from given .csv file.
Outcome loadFromStream(std::istream &ifs)
Loads the palette from given input stream.
Palette & operator=(Palette &&other)=default
Outcome saveToFile(const Path &path, const Size lineCnt=256) const
Saves the palette to a .csv file.
Rgba operator()(const float value) const
Returns the color mapped to given number.
Interval getInterval() const
Returns the interval for which the palette is defined.
Object representing a path on a filesystem.
@ LINEAR
Constant time between consecutive output times.
@ LOGARITHMIC
Constant ratio between consecutive output times.