ezEngine Release 26.3
Loading...
Searching...
No Matches
ezColorGradient Class Reference

A color curve for animating colors. More...

#include <ColorGradient.h>

Public Types

using ColorCP = ezColorGradientColorCP
 
using AlphaCP = ezColorGradientAlphaCP
 
using IntensityCP = ezColorGradientIntensityCP
 

Public Member Functions

 ezColorGradient (const ezColorGradient &rhs)
 
 ezColorGradient (ezColorGradient &&rhs) noexcept
 
void operator= (const ezColorGradient &rhs)
 
void operator= (ezColorGradient &&rhs) noexcept
 
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.
 
void AddAlphaControlPoint (double x, ezUInt8 uiAlpha)
 Appends an alpha control point.
 
void AddIntensityControlPoint (double x, float fIntensity)
 Appends an intensity control point.
 
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 ColorCPGetColorControlPoint (ezUInt32 uiIdx) const
 Const access to a control point.
 
const AlphaCPGetAlphaControlPoint (ezUInt32 uiIdx) const
 Const access to a control point.
 
const IntensityCPGetIntensityControlPoint (ezUInt32 uiIdx) const
 Const access to a control point.
 
ColorCPModifyColorControlPoint (ezUInt32 uiIdx)
 Non-const access to a control point.
 
AlphaCPModifyAlphaControlPoint (ezUInt32 uiIdx)
 Non-const access to a control point.
 
IntensityCPModifyIntensityControlPoint (ezUInt32 uiIdx)
 Non-const access to a control point.
 
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.
 
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.
 
void EvaluateAlpha (double x, ezUInt8 &ref_uiAlpha) const
 Evaluates only the alpha curve.
 
void EvaluateIntensity (double x, float &ref_fIntensity) const
 Evaluates only the intensity curve.
 
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.
 

Static Public Member Functions

static double TickToTime (ezInt64 iTick)
 Converts a tick value to time (in seconds). 4800 ticks per second.
 
static ezInt64 TimeToTick (double fTimeInSeconds)
 Converts a time value (in seconds) to ticks. 4800 ticks per second.
 
static ezInt64 SnapTimeToTick (double fTimeInSeconds, ezUInt32 uiFramesPerSecond=120)
 Converts a time value to ticks and snaps to the nearest frame boundary for the given FPS.
 
static ezInt64 SnapTickTo (ezInt64 iTick, ezUInt32 uiFramesPerSecond)
 Snaps a tick value to the nearest frame boundary for the given FPS.
 
static double SnapTimeTo (double fTimeInSeconds, ezUInt32 uiFramesPerSecond=120)
 Snaps a time value to the nearest frame boundary for the given FPS.
 

Detailed Description

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.

Member Function Documentation

◆ EvaluateAlpha()

void ezColorGradient::EvaluateAlpha ( double  x,
ezUInt8 &  ref_uiAlpha 
) const

Evaluates only the alpha curve.

Todo:
Use a midpoint interpolation

◆ EvaluateColor()

void ezColorGradient::EvaluateColor ( double  x,
ezColor ref_rgb 
) const

Evaluates only the color curve.

Todo:
Use a midpoint interpolation

◆ EvaluateIntensity()

void ezColorGradient::EvaluateIntensity ( double  x,
float &  ref_fIntensity 
) const

Evaluates only the intensity curve.

Todo:
Use a midpoint interpolation

◆ ModifyAlphaControlPoint()

AlphaCP & ezColorGradient::ModifyAlphaControlPoint ( ezUInt32  uiIdx)
inline

Non-const access to a control point.

Invalidates the cached sort order, which will be rebuilt on next evaluation.

◆ ModifyColorControlPoint()

ColorCP & ezColorGradient::ModifyColorControlPoint ( ezUInt32  uiIdx)
inline

Non-const access to a control point.

Invalidates the cached sort order, which will be rebuilt on next evaluation.

◆ ModifyIntensityControlPoint()

IntensityCP & ezColorGradient::ModifyIntensityControlPoint ( ezUInt32  uiIdx)
inline

Non-const access to a control point.

Invalidates the cached sort order, which will be rebuilt on next evaluation.


The documentation for this class was generated from the following files: