1 // Copyright (c) Charles J. Cliffe
2 // SPDX-License-Identifier: GPL-2.0+
3 
4 #pragma once
5 
6 #include <vector>
7 
8 class GradientColor {
9 public:
10     float r, g, b;
11     float w;
12 
13     //should work with both float and double inputs
GradientColor(double r_in,double g_in,double b_in)14     GradientColor(double r_in, double g_in, double b_in) :
15             r((float)r_in), g((float)g_in), b((float)b_in), w(1) {
16     }
17 };
18 
19 class Gradient {
20 public:
21     Gradient();
22 
23     void addColor(GradientColor c);
24 
25 	void clear();
26 
27 	void addColors(const std::vector<GradientColor>& color_list);
28 
29     std::vector<float> &getRed();
30     std::vector<float> &getGreen();
31     std::vector<float> &getBlue();
32 
33     void generate(unsigned int len);
34 
35     ~Gradient();
36 private:
37     std::vector<GradientColor> colors;
38     std::vector<float> r_val;
39     std::vector<float> g_val;
40     std::vector<float> b_val;
41 };
42