Gradient Class Reference

#include <customgui_gradient.h>

Inheritance diagram for Gradient:

Private Member Functions

 Gradient ()
 
 ~Gradient ()
 

Alloc/Free

static GradientAlloc ()
 
static void Free (Gradient *&grad)
 

Knots

Bool InvertKnots ()
 
Bool DoubleKnots ()
 
void FlushKnots ()
 

Knot

Int32 GetKnotCount ()
 
Int32 InsertKnot (const GradientKnot &knot)
 
Bool RemoveKnot (Int32 index)
 
GradientKnot GetKnot (Int32 index)
 
void SetKnot (Int32 index, const GradientKnot &k)
 

Render

Bool InitRender ()
 
void FreeRender ()
 
GradientKnotGetRenderKnot (Int32 index)
 
Int32 GetRenderKnotCount ()
 
Vector CalcGradientPixel (Float pos)
 

Data

GeData GetData (Int32 id) const
 
Bool SetData (Int32 id, const GeData &data)
 

Alpha

static void ConvertToAlphaGradient (BaseContainer *bc, Int32 id)
 
GradientGetAlphaGradient ()
 
GradientAllocAlphaGradient ()
 
void ConvertToAlphaGradient ()
 
Bool CopyFrom (const Gradient *src)
 

Miscellaneous

UInt32 GetChecksum ()
 

Detailed Description

Gradient data type (CUSTOMDATATYPE_GRADIENT).

Note
Has to be created with Alloc() and destroyed with Free().

Constructor & Destructor Documentation

◆ Gradient()

Gradient ( )
private

◆ ~Gradient()

~Gradient ( )
private

Member Function Documentation

◆ Alloc()

static Gradient* Alloc ( )
static

Allocates a gradient data. Destroy the allocated gradient data with Free().

Returns
The allocated gradient data, or nullptr if the allocation failed.

◆ Free()

static void Free ( Gradient *&  grad)
static

Destructs gradient data allocated with Alloc().

Parameters
[in,out]gradThe gradient data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ InvertKnots()

Bool InvertKnots ( )

Inverts the knots.

Returns
true if knots were successfully inverted, otherwise false.

◆ DoubleKnots()

Bool DoubleKnots ( )

Doubles the knots.

Returns
true if knots were successfully doubled, otherwise false.

◆ FlushKnots()

void FlushKnots ( )

Flushes all knots.

◆ GetKnotCount()

Int32 GetKnotCount ( )

Gets the number of knots.

Returns
The knot count.

◆ InsertKnot()

Int32 InsertKnot ( const GradientKnot knot)

Inserts a knot.

Parameters
[in]knotThe knot to insert.
Returns
The index of the inserted knot. GetKnotCount() - 1

◆ RemoveKnot()

Bool RemoveKnot ( Int32  index)

Removes a knot.

Parameters
[in]indexThe knot index. 0 <= index < GetKnotCount()
Returns
true if knot was successfully removed, otherwise false.

◆ GetKnot()

GradientKnot GetKnot ( Int32  index)

Gets the knot at index.

Parameters
[in]indexThe knot index. 0 <= index < GetKnotCount()
Returns
The knot data.

◆ SetKnot()

void SetKnot ( Int32  index,
const GradientKnot k 
)

Sets the data for a knot at index.

Parameters
[in]indexThe knot index. 0 <= index < GetKnotCount()
[in]kThe knot information.

◆ InitRender()

Bool InitRender ( )

Initializes the gradient data for renderer.

Returns
true if the gradient data was successfully initialized for renderer, otherwise false.

◆ FreeRender()

void FreeRender ( )

Frees the gradient data from render.

Note
Call after gradient calculation is finished.

◆ GetRenderKnot()

GradientKnot* GetRenderKnot ( Int32  index)

Gets a pointer to the knot at index between InitRender() and FreeRender().

Parameters
[in]indexThe knot index. 0 <= index < GetKnotCount()
Returns
The knot at index. The gradient owns the pointed knot.

◆ GetRenderKnotCount()

Int32 GetRenderKnotCount ( )

Gets the number of knots for GetRenderKnot().

Returns
The render knot count.

◆ CalcGradientPixel()

Vector CalcGradientPixel ( Float  pos)

Calculates a gradient pixel.

Parameters
[in]posThe X position.
Returns
The calculated gradient pixel.

◆ GetData()

GeData GetData ( Int32  id) const

Gets data from the gradient container.

Parameters
[in]idThe gradient data ID: GRADIENT_CONTAINERIDS.
Returns
The data.

◆ SetData()

Bool SetData ( Int32  id,
const GeData data 
)

Sets data in the gradient container.

Parameters
[in]idThe gradient data ID: GRADIENT_CONTAINERIDS.
[in]dataThe data.
Returns
true if the gradient data was successfully set, otherwise false.

◆ GetAlphaGradient()

Gradient* GetAlphaGradient ( )

Gets the alpha gradient.

Returns
Alpha gradient. The gradient owns the pointed knot.

◆ AllocAlphaGradient()

Gradient* AllocAlphaGradient ( )

Allocates an alpha gradient.

Returns
The allocated alpha gradient, or nullptr if the allocation failed.

◆ ConvertToAlphaGradient() [1/2]

void ConvertToAlphaGradient ( )

Converts this gradient to an alpha gradient.

◆ CopyFrom()

Bool CopyFrom ( const Gradient src)

Copies all gradient data from the source gradient.

Since
R19
Parameters
[in]srcThe source gradient.
Returns
true if successful, otherwise false.

◆ ConvertToAlphaGradient() [2/2]

static void ConvertToAlphaGradient ( BaseContainer bc,
Int32  id 
)
static

Converts a gradient within a container into an alpha gradient.

Parameters
[in]bcThe container holding the gradient. The caller owns the pointed container.
[in]idThe ID of the gradient within the container.

◆ GetChecksum()

UInt32 GetChecksum ( )

Gets a checksum of the whole gradient state, including the needles, colors and interpolation type.

Returns
The checksum.