Gradient Class Reference

#include <customgui_gradient.h>

Inheritance diagram for Gradient:

Detailed Description

Gradient data type (CUSTOMDATATYPE_GRADIENT) for GradientCustomGui.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Private Member Functions

 Gradient ()
 
 ~Gradient ()
 

Alloc/Free

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

Alpha

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

Knots

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

Render

maxon::Result< maxon::GradientRenderData > PrepareRenderData (const InitRenderStruct &irs) const
 
maxon::Result< GradientRenderDataTuplePrepareRenderDataWithAlpha (const InitRenderStruct &irs) const
 
maxon::Result< maxon::GradientRenderData > PrepareRenderData () const
 
maxon::Result< GradientRenderDataTuplePrepareRenderDataWithAlpha () const
 

Knot

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

Data

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

Miscellaneous

UInt32 GetChecksum () const
 
void GetGradient (maxon::Gradient &gradient) const
 
void SetGradient (maxon::Gradient &gradient)
 

Additional Inherited Members

- Static Public Attributes inherited from CustomDataTypeT< 1000481 >
static constexpr Int32 DATATYPEID
 

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(). Use AutoAlloc to automate the allocation and destruction based on scope.

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

◆ Free()

static void Free ( Gradient *&  grad)
static

Destructs gradient data allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

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 the knots were successfully inverted, otherwise false.

◆ DoubleKnots()

Bool DoubleKnots ( )

Doubles the knots.

Returns
true if the knots were successfully doubled, otherwise false.

◆ DistributeKnots()

Bool DistributeKnots ( )

Distributes the knots evenly.

Returns
true if the knots were successfully distributed, otherwise false.

◆ FlushKnots()

void FlushKnots ( )

Flushes all the knots.

◆ PrepareRenderData() [1/2]

maxon::Result<maxon::GradientRenderData> PrepareRenderData ( const InitRenderStruct irs) const

Initializes the gradient data for render.

Parameters
[in]irsA struct with information about the upcoming gradient calculation.
Returns
RenderData on success.

◆ PrepareRenderDataWithAlpha() [1/2]

maxon::Result<GradientRenderDataTuple> PrepareRenderDataWithAlpha ( const InitRenderStruct irs) const

Initializes the gradient and the alpha gradint data for render.

Parameters
[in]irsA struct with information about the upcoming gradient calculation.
Returns
RenderData on success.

◆ PrepareRenderData() [2/2]

maxon::Result<maxon::GradientRenderData> PrepareRenderData ( ) const

Initializes the gradient data for render. No color transformation is applied.

Returns
RenderData on success.

◆ PrepareRenderDataWithAlpha() [2/2]

maxon::Result<GradientRenderDataTuple> PrepareRenderDataWithAlpha ( ) const

Initializes the gradient data for render. No color transformation is applied.

Returns
RenderData on success.

◆ GetKnotCount()

Int32 GetKnotCount ( ) const

Gets the number of knots.

Returns
The knot count.

◆ InsertKnot()

Int32 InsertKnot ( const maxon::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 the knot was successfully removed, otherwise false.

◆ GetKnot()

maxon::GradientKnot GetKnot ( Int32  index) const

Gets the knot at index.

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

◆ SetKnot()

void SetKnot ( Int32  index,
const maxon::GradientKnot k 
)

Sets knot at index.

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

◆ 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 successful, otherwise false.

◆ GetAlphaGradient() [1/2]

Gradient* GetAlphaGradient ( )

Gets the alpha gradient.

Returns
The alpha gradient. The gradient data owns the pointed alpha gradient.

◆ GetAlphaGradient() [2/2]

const Gradient* GetAlphaGradient ( ) const

◆ AllocAlphaGradient()

Gradient* AllocAlphaGradient ( )

Allocates an alpha gradient.

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

◆ 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 ( ) const

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

Returns
The checksum.

◆ GetGradient()

void GetGradient ( maxon::Gradient &  gradient) const

Gets the internal gradient.

◆ SetGradient()

void SetGradient ( maxon::Gradient &  gradient)

Sets the internal gradient.