Gradient class. Use it to store gradient properties of your controls. It shouldn't be overrided because the renderer implementation depends on it.
Gradient require at least 2 points to be drawn. Each point has coordinate and color. Coordinate should be in range 0..1. Depending on gradient type you may draw gradients shown below. In following illustration the first point has green color and the second one has red color.
You can find more information in comments below. Overrided methods can be found in corresponding base class.
class Gradient: public CFeedback
{
public:
GradientType const &Type; // Type
int getPointCount() const; // Return point count
Color1D getPoint(const int index) const; // Return point by index
Color getColor(float position); // Return calculated color at specified position(position is in range 0..1)
const Color1DArray &getSortedPoints(); // Return points sorted by position
bool setType(const GradientType value); // Set type
bool setPointCount(const int count); // Set point count
bool setPoints(const int count, Color1D *points); // Set points
bool setPoint(const int index, const Color1D &value); // Set point
bool setPoint(const int index, const float position, const Color color); // Set point
bool setPointPosition(const int index, const float position); // Set point position
bool setPointColor(const int index, const Color color); // Set point color
bool setPoints(const Color1DArray &points); // Set points
Gradient();
Gradient(Callback callback, void *param); // Create with callback informing about changes
Gradient(const GradientType type, const Color1DArray &points);
Gradient(const Gradient &other);
Gradient(Gradient &&other);
Gradient &operator=(const Gradient &other);
Gradient &operator=(Gradient &&other);
bool isEqual(Gradient &other, const float tolerance = ntl::Tolerance<float>); // Check whether gradients are equal
bool isNotEqual(Gradient &other, const float tolerance = ntl::Tolerance<float>); // Check whether gradients are not equal
void AddPoint(const float position, const Color &color); // Add new point
bool DeletePoint(const int index); // Delete point by index
bool Clear(); // Delete all points
};
Following operators are also available.
std::wostream &operator<<(std::wostream &stream, const Gradient &a); // Output as source code
Namespace: | nitisa |
Include: | Nitisa/Image/Gradient.h |