XII Release 0.1.0
Loading...
Searching...
No Matches
xiiColorGradient Class Reference

#include <ColorGradient.h>

Classes

struct  ColorCP
 Color control point. Stores red, green and blue in gamma space. More...
struct  AlphaCP
 Alpha control point. More...
struct  IntensityCP
 Intensity control point. Used to scale rgb for high-dynamic range values. More...

Public Member Functions

 xiiColorGradient ()
 Copyright (c) Theophilus Eriata. All Rights Reserved.
void Clear ()
 Removes all control points.
bool IsEmpty () const
 Checks whether the curve has any control point.
void AddColorControlPoint (double x, const xiiColorGammaUB &rgb)
 Appends a color control point. SortControlPoints() must be called to before evaluating the curve.
void AddAlphaControlPoint (double x, xiiUInt8 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 (xiiUInt32 &ref_uiRgb, xiiUInt32 &ref_uiAlpha, xiiUInt32 &ref_uiIntensity) const
 Returns the number of control points of each type.
const ColorCP & GetColorControlPoint (xiiUInt32 uiIdx) const
 Const access to a control point.
const AlphaCP & GetAlphaControlPoint (xiiUInt32 uiIdx) const
 Const access to a control point.
const IntensityCP & GetIntensityControlPoint (xiiUInt32 uiIdx) const
 Const access to a control point.
ColorCP & ModifyColorControlPoint (xiiUInt32 uiIdx)
AlphaCP & ModifyAlphaControlPoint (xiiUInt32 uiIdx)
IntensityCP & ModifyIntensityControlPoint (xiiUInt32 uiIdx)
void SortControlPoints ()
void Evaluate (double x, xiiColorGammaUB &ref_rgba, float &ref_fIntensity) const
void Evaluate (double x, xiiColor &ref_hdr) const
 Evaluates the curve and returns RGBA and intensity in one combined xiiColor value.
void EvaluateColor (double x, xiiColorGammaUB &ref_rgb) const
 Evaluates only the color curve.
void EvaluateColor (double x, xiiColor &ref_rgb) const
 Evaluates only the color curve.
void EvaluateAlpha (double x, xiiUInt8 &ref_uiAlpha) const
 Evaluates only the alpha curve.
void EvaluateIntensity (double x, float &ref_fIntensity) const
 Evaluates only the intensity curve.
xiiUInt64 GetHeapMemoryUsage () const
 How much heap memory the curve uses.
void Save (xiiStreamWriter &ref_stream) const
 Stores the current state in a stream.
void Load (xiiStreamReader &ref_stream)
 Restores the state from a stream.

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

◆ Evaluate()

void xiiColorGradient::Evaluate ( double x,
xiiColorGammaUB & 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.

◆ EvaluateAlpha()

void xiiColorGradient::EvaluateAlpha ( double x,
xiiUInt8 & ref_uiAlpha ) const

Evaluates only the alpha curve.

Todo
Use a midpoint interpolation

◆ EvaluateColor()

void xiiColorGradient::EvaluateColor ( double x,
xiiColor & ref_rgb ) const

Evaluates only the color curve.

Todo
Use a midpoint interpolation

◆ EvaluateIntensity()

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

Evaluates only the intensity curve.

Todo
Use a midpoint interpolation

◆ ModifyAlphaControlPoint()

AlphaCP & xiiColorGradient::ModifyAlphaControlPoint ( xiiUInt32 uiIdx)
inline

Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve.

◆ ModifyColorControlPoint()

ColorCP & xiiColorGradient::ModifyColorControlPoint ( xiiUInt32 uiIdx)
inline

Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve.

◆ ModifyIntensityControlPoint()

IntensityCP & xiiColorGradient::ModifyIntensityControlPoint ( xiiUInt32 uiIdx)
inline

Non-const access to a control point. If you modify the x coordinate, SortControlPoints() has to be called before evaluating the curve.

◆ SortControlPoints()

void xiiColorGradient::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.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Tracks/ColorGradient.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Tracks/Implementation/ColorGradient.cpp