Gradient Class Reference

#include <customgui_gradient.h>

Inheritance diagram for Gradient:

详细描述

渐变 data type ( CUSTOMDATATYPE_GRADIENT ) for GradientCustomGui .

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

私有成员函数

  渐变 ()
  ~Gradient ()

Alloc/Free

static 渐变 Alloc ()
static void  Free ( 渐变 *&grad)

Knots

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

渲染

maxon::Result < void >  InitRender (const InitRenderStruct &irs)
void  FreeRender ()
向量   CalcGradientPixel ( Float pos) const
const GradientKnot GetRenderKnot ( Int32 index) const
Int32   GetRenderKnotCount () const

Knot

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

数据

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

Alpha

static void  ConvertToAlphaGradient ( BaseContainer *bc, Int32 id)
渐变 GetAlphaGradient ()
渐变 AllocAlphaGradient ()
void  ConvertToAlphaGradient ()
Bool   CopyFrom (const 渐变 *src)

杂项

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

构造函数 & 析构函数文档编制

◆  Gradient()

渐变 () private

◆  ~Gradient()

~ 渐变 () private

成员函数文档编制

◆  Alloc()

static 渐变 * Alloc ( )
static

Allocates a gradient data. Destroy the allocated gradient data with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

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

◆  Free()

static void Free ( 渐变 *&  grad )
static

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

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

◆  InvertKnots()

Bool InvertKnots ( )

Inverts the knots.

返回
true if the knots were successfully inverted, otherwise false .

◆  DoubleKnots()

Bool DoubleKnots ( )

Doubles the knots.

返回
true if the knots were successfully doubled, otherwise false .

◆  DistributeKnots()

Bool DistributeKnots ( )

Distributes the knots evenly.

返回
true if the knots were successfully distributed, otherwise false .

◆  FlushKnots()

void FlushKnots ( )

Flushes all the knots.

◆  InitRender()

maxon::Result <void> InitRender ( const InitRenderStruct irs )

Initializes the gradient data for render.

注意
Call before CalcGradientPixel() .
参数
[in] irs A struct with information about the upcoming gradient calculation.
返回
true if successful, otherwise false .

◆  FreeRender()

void FreeRender ( )

Frees the gradient data from render.

注意
Call after gradient calculation is finished.

◆  CalcGradientPixel()

向量 CalcGradientPixel ( Float   pos ) const

Calculates a gradient pixel.

参数
[in] pos The X position.
返回
The calculated gradient pixel.

◆  GetRenderKnot()

const GradientKnot * GetRenderKnot ( Int32   index ) const

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

参数
[in] index The knot index. 0 <= index < GetRenderKnotCount()
返回
The render knot at index . The gradient data owns the pointed knot.

◆  GetRenderKnotCount()

Int32 GetRenderKnotCount ( ) const

Gets the number of knots for GetRenderKnot() .

返回
The render knot count.

◆  GetKnotCount()

Int32 GetKnotCount ( ) const

Gets the number of knots.

返回
The knot count.

◆  InsertKnot()

Int32 InsertKnot ( const GradientKnot knot )

Inserts a knot.

参数
[in] knot The knot to insert.
返回
The index of the inserted knot: GetKnotCount() - 1

◆  RemoveKnot()

Bool RemoveKnot ( Int32   index )

Removes a knot.

参数
[in] index The knot index. 0 <= index < GetKnotCount()
返回
true if the knot was successfully removed, otherwise false .

◆  GetKnot()

GradientKnot GetKnot ( Int32   index ) const

Gets the knot at index .

参数
[in] index The knot index. 0 <= index < GetKnotCount()
返回
The knot.

◆  SetKnot()

void SetKnot ( Int32   index ,
const GradientKnot k  
)

Sets knot at index .

参数
[in] index The knot index. 0 <= index < GetKnotCount()
[in] k The knot.

◆  GetData()

GeData GetData ( Int32   id ) const

Gets data from the gradient container.

参数
[in] id The gradient data ID: GRADIENT_CONTAINERIDS
返回
The data.

◆  SetData()

Bool SetData ( Int32   id ,
const GeData data  
)

Sets data in the gradient container.

参数
[in] id The gradient data ID: GRADIENT_CONTAINERIDS
[in] data The data.
返回
true if successful, otherwise false .

◆  GetAlphaGradient()

渐变 * GetAlphaGradient ( )

Gets the alpha gradient.

返回
The alpha gradient. The gradient data owns the pointed alpha gradient.

◆  AllocAlphaGradient()

渐变 * AllocAlphaGradient ( )

Allocates an alpha gradient.

返回
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 渐变 src )

Copies all gradient data from the source gradient.

由于
R19
参数
[in] src The source gradient.
返回
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.

参数
[in] bc The container holding the gradient. The caller owns the pointed container.
[in] id The 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.

返回
The checksum.

◆  GetGradient()

void GetGradient ( maxon::Gradient &  gradient ) const

Gets the internal gradient.

◆  SetGradient()

void SetGradient ( maxon::Gradient &  gradient )

Sets the internal gradient.