12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef GRADIENT_H
- #define GRADIENT_H
- #include <QString>
- #include <vector>
- #include "Color.h"
- #include <tuple>
- #include <cinttypes>
- class Gradient
- {
-
-
- std::vector<RGBColor> colors;
- float max;
- bool repeat;
- public:
- Gradient(void);
- Gradient(const std::vector<std::pair<RGBColor, float>>&, bool repeat = false, int precalcSteps = 10000);
- static Gradient defaultGradient(void);
- static Gradient readXml(const QString& xml);
-
- RGBColor get(float x) const;
- private:
- static RGBColor lerpColors(RGBColor a, RGBColor b, float val);
- std::tuple<RGBColor, RGBColor, float> getNeighbors(float x) const;
- };
- #endif
|