2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2014-11-11 08:11:12 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class GradientColor {
|
|
|
|
public:
|
2014-11-12 21:55:11 -05:00
|
|
|
float r, g, b;
|
2014-11-11 08:11:12 -05:00
|
|
|
float w;
|
2014-11-12 21:55:11 -05:00
|
|
|
|
|
|
|
GradientColor(float r_in, float g_in, float b_in) :
|
|
|
|
r(r_in), g(g_in), b(b_in), w(1) {
|
|
|
|
}
|
2014-11-11 08:11:12 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class Gradient {
|
|
|
|
public:
|
2014-11-12 21:55:11 -05:00
|
|
|
Gradient();
|
2014-11-11 08:11:12 -05:00
|
|
|
|
2014-11-12 21:55:11 -05:00
|
|
|
void addColor(GradientColor c);
|
2014-11-11 08:11:12 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
std::vector<float> &getRed();
|
2014-11-12 21:55:11 -05:00
|
|
|
std::vector<float> &getGreen();
|
|
|
|
std::vector<float> &getBlue();
|
2014-11-11 08:11:12 -05:00
|
|
|
|
2014-11-12 21:55:11 -05:00
|
|
|
void generate(unsigned int len);
|
2014-11-11 20:25:16 -05:00
|
|
|
|
2014-11-12 21:55:11 -05:00
|
|
|
~Gradient();
|
2014-11-11 08:11:12 -05:00
|
|
|
private:
|
|
|
|
std::vector<GradientColor> colors;
|
2014-11-11 20:25:16 -05:00
|
|
|
std::vector<float> r_val;
|
|
|
|
std::vector<float> g_val;
|
|
|
|
std::vector<float> b_val;
|
|
|
|
};
|