Gradient.h 438 B

123456789101112131415161718192021222324
  1. #ifndef GRADIENT_H
  2. #define GRADIENT_H
  3. #include <vector>
  4. #include "Color.h"
  5. class Gradient
  6. {
  7. std::vector<std::pair<RGBColor, float>> colors;
  8. float max;
  9. public:
  10. Gradient();
  11. void addColor(RGBColor c, float value);
  12. RGBColor get(float x) const;
  13. private:
  14. static RGBColor lerpColors(RGBColor a, RGBColor b, float val);
  15. std::tuple<RGBColor, RGBColor, float> getNeighbors(float x) const;
  16. };
  17. #endif // GRADIENT_H