123456789101112131415161718192021222324252627282930313233 |
- #ifndef GRADIENT_H
- #define GRADIENT_H
- #include <vector>
- #include "Color.h"
- #include <tuple>
- #include <cinttypes>
- class Gradient
- {
-
-
- std::vector<RGBColor> colors;
- float max;
- public:
- Gradient(void);
- Gradient(const std::vector<std::pair<RGBColor, float>>&, int precalcSteps = 10000);
- static Gradient defaultGradient(void);
-
- 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
|