![]() |
ezEngine
Release 25.03
|
A color curve for animating colors. More...
#include <ColorGradient.h>
Classes | |
struct | AlphaCP |
Alpha control point. More... | |
struct | ColorCP |
Color control point. Stores red, green and blue in gamma space. More... | |
struct | IntensityCP |
Intensity control point. Used to scale rgb for high-dynamic range values. More... | |
Public Member Functions | |
void | Clear () |
Removes all control points. | |
bool | IsEmpty () const |
Checks whether the curve has any control point. | |
void | AddColorControlPoint (double x, const ezColorGammaUB &rgb) |
Appends a color control point. SortControlPoints() must be called to before evaluating the curve. | |
void | AddAlphaControlPoint (double x, ezUInt8 uiAlpha) |
Appends an alpha control point. SortControlPoints() must be called to before evaluating the curve. | |
void | AddIntensityControlPoint (double x, float fIntensity) |
Appends an intensity control point. SortControlPoints() must be called to before evaluating the curve. | |
bool | GetExtents (double &ref_fMinx, double &ref_fMaxx) const |
Determines the min and max x-coordinate value across all control points. | |
void | GetNumControlPoints (ezUInt32 &ref_uiRgb, ezUInt32 &ref_uiAlpha, ezUInt32 &ref_uiIntensity) const |
Returns the number of control points of each type. | |
const ColorCP & | GetColorControlPoint (ezUInt32 uiIdx) const |
Const access to a control point. | |
const AlphaCP & | GetAlphaControlPoint (ezUInt32 uiIdx) const |
Const access to a control point. | |
const IntensityCP & | GetIntensityControlPoint (ezUInt32 uiIdx) const |
Const access to a control point. | |
ColorCP & | ModifyColorControlPoint (ezUInt32 uiIdx) |
Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve. | |
AlphaCP & | ModifyAlphaControlPoint (ezUInt32 uiIdx) |
Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve. | |
IntensityCP & | ModifyIntensityControlPoint (ezUInt32 uiIdx) |
Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve. | |
void | SortControlPoints () |
Sorts the control point arrays by their x-coordinate. The CPs have to be sorted before calling Evaluate(), otherwise the result will be wrong. | |
void | Evaluate (double x, ezColorGammaUB &ref_rgba, float &ref_fIntensity) const |
Evaluates the curve at the given x-coordinate and returns RGBA and intensity separately. More... | |
void | Evaluate (double x, ezColor &ref_hdr) const |
Evaluates the curve and returns RGBA and intensity in one combined ezColor value. | |
void | EvaluateColor (double x, ezColorGammaUB &ref_rgb) const |
Evaluates only the color curve. | |
void | EvaluateColor (double x, ezColor &ref_rgb) const |
Evaluates only the color curve. More... | |
void | EvaluateAlpha (double x, ezUInt8 &ref_uiAlpha) const |
Evaluates only the alpha curve. More... | |
void | EvaluateIntensity (double x, float &ref_fIntensity) const |
Evaluates only the intensity curve. More... | |
ezUInt64 | GetHeapMemoryUsage () const |
How much heap memory the curve uses. | |
void | Save (ezStreamWriter &inout_stream) const |
Stores the current state in a stream. | |
void | Load (ezStreamReader &inout_stream) |
Restores the state from a stream. | |
A color curve for animating colors.
The gradient consists of a number of control points, for rgb, alpha and intensity. One can evaluate the curve at any x coordinate.
void ezColorGradient::Evaluate | ( | double | x, |
ezColorGammaUB & | ref_rgba, | ||
float & | ref_fIntensity | ||
) | const |
Evaluates the curve at the given x-coordinate and returns RGBA and intensity separately.
The control points have to be sorted, so call SortControlPoints() before, if any modifications where done.
void ezColorGradient::EvaluateAlpha | ( | double | x, |
ezUInt8 & | ref_uiAlpha | ||
) | const |
Evaluates only the alpha curve.
void ezColorGradient::EvaluateColor | ( | double | x, |
ezColor & | ref_rgb | ||
) | const |
Evaluates only the color curve.
void ezColorGradient::EvaluateIntensity | ( | double | x, |
float & | ref_fIntensity | ||
) | const |
Evaluates only the intensity curve.