GradientInterface Class Reference

#include <gradient.h>

Detailed Description

This is the interface for the Gradient data type. The data is reference-counted and a copy will automatically be created if a non-const function is called. Alpha Gradients ONLY set Brightness, Color is always 1.0 Regular Gradients can set Brightness & Color

Public Member Functions

MAXON_METHOD Result< Gradient * > AllocAlphaGradient ()
 
MAXON_METHOD GradientGetAlphaGradient ()
 
MAXON_METHOD void SetIsAlphaGradient (Bool alphaGradient)
 
MAXON_METHOD Bool IsAlphaGradient () const
 
MAXON_METHOD COMPARERESULT Compare (const GradientInterface *arg2) const
 
MAXON_METHOD UInt GetHashCode () const
 
MAXON_METHOD Result< GradientRenderData > InitRender (const TransformColorDelegate &transformColorDelegate) const
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (GradientInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.interface.gradient")
 

Knots

MAXON_METHOD Int GetKnotCount () const
 
MAXON_METHOD Result< IntInsertKnot (const GradientKnot &knot, Bool keepId=false)
 
MAXON_METHOD Result< void > RemoveKnot (Int index)
 
MAXON_METHOD GradientKnot GetKnot (Int index) const
 
MAXON_METHOD Result< void > SetKnot (Int index, const GradientKnot &k)
 
MAXON_METHOD void ConvertToAlphaGradient ()
 
MAXON_METHOD void SortKnots ()
 
MAXON_METHOD Result< BoolInvertKnots ()
 
MAXON_METHOD Result< BoolDoubleKnots ()
 
MAXON_METHOD Bool DistributeKnots ()
 
MAXON_METHOD void Flush ()
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( GradientInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.interface.gradient"   
)
private

◆ AllocAlphaGradient()

MAXON_METHOD Result<Gradient*> AllocAlphaGradient ( )

Allocates an alpha gradient.

Returns
The alpha gradient.

◆ GetAlphaGradient()

MAXON_METHOD Gradient* GetAlphaGradient ( )

Returns the internal alpha gradient.

Returns
The alpha gradient.

◆ GetKnotCount()

MAXON_METHOD Int GetKnotCount ( ) const

Gets the number of knots.

Returns
The knot count.

◆ InsertKnot()

MAXON_METHOD Result<Int> InsertKnot ( const GradientKnot knot,
Bool  keepId = false 
)

Inserts a knot.

Parameters
[in]knotThe knot to insert.
[in]keepIdSpecifies if the knot ID should be taken from knot or if a new one should be generated.
Returns
The index of the inserted knot, GetKnotCount() - 1

◆ RemoveKnot()

MAXON_METHOD Result<void> RemoveKnot ( Int  index)

Removes a knot.

Parameters
[in]indexThe knot index. 0 <= index < GetKnotCount()
Returns
OK on success.

◆ GetKnot()

MAXON_METHOD GradientKnot GetKnot ( Int  index) const

Gets the knot at index.

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

◆ SetKnot()

MAXON_METHOD Result<void> SetKnot ( Int  index,
const GradientKnot k 
)

Sets knot at index.

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

◆ ConvertToAlphaGradient()

MAXON_METHOD void ConvertToAlphaGradient ( )

Converts the current gradient to an alpha gradient.

◆ SortKnots()

MAXON_METHOD void SortKnots ( )

Sorts the knots according to their position.

◆ InvertKnots()

MAXON_METHOD Result<Bool> InvertKnots ( )

Inverts the knots.

Returns
True if any knot inverted, otherwise false.

◆ DoubleKnots()

MAXON_METHOD Result<Bool> DoubleKnots ( )

Doubles the knots.

Returns
True if any knot doubled, otherwise false.

◆ DistributeKnots()

MAXON_METHOD Bool DistributeKnots ( )

Distributes the knots evenly.

Returns
True if any knot distributed, otherwise false.

◆ Flush()

MAXON_METHOD void Flush ( )

Flushes all the knots.

◆ SetIsAlphaGradient()

MAXON_METHOD void SetIsAlphaGradient ( Bool  alphaGradient)

Sets the alpha mode.

Parameters
[in]alphaGradientThe gradient alpha type.

◆ IsAlphaGradient()

MAXON_METHOD Bool IsAlphaGradient ( ) const

Checks if this is an alpha gradient.

Returns
True, if this is an alpha gradient.

◆ Compare()

MAXON_METHOD COMPARERESULT Compare ( const GradientInterface arg2) const

Compares this with another gradient.

Parameters
[in]arg2The other gradient to compare with.
Returns
The comparison result.

◆ GetHashCode()

MAXON_METHOD UInt GetHashCode ( ) const

Gets the hash code for the gradient.

Returns
The checksum.

◆ InitRender()

MAXON_METHOD Result<GradientRenderData> InitRender ( const TransformColorDelegate transformColorDelegate) const

Initializes the gradient for rendering.

Parameters
[in]transformColorDelegateA delegate to transform the color of a gradient knot.
Returns
The render data.