HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Ramp Class Reference

Utility class for containing a color ramp. More...

#include <UT_Ramp.h>

Public Member Functions

 UT_Ramp ()
 
 UT_Ramp (const UT_Ramp &copy)
 
 ~UT_Ramp ()
 
int64 getMemoryUsage (bool inclusive) const
 Return the amount of memory owned by this UT_Ramp in bytes. More...
 
void setColorType (UT_ColorType color_space)
 
UT_ColorType getColorType () const
 
void clearAndDestroy ()
 
void ensureRampIsBuilt ()
 Force updating of the ramp after being modified. More...
 
bool getGlobalEnable () const
 
void setGlobalEnable (bool enable)
 
int getNodeCount () const
 
const UT_ColorNodegetNode (int i) const
 
UT_ColorNodegetRamp ()
 
const UT_ColorNodegetRamp () const
 
void convertToRaster (UT_Raster *raster, UT_RampOrient dir, bool do_interp=true, fpreal cx=0.0f, fpreal cy=0.0f, fpreal phase=0.0f, fpreal radius=1.0f)
 
const UT_ColorNodegetClosestNode (fpreal pos) const
 
int getClosestNodeIndex (fpreal pos) const
 
const UT_ColorNodegetClosestNode (fpreal pos, fpreal val) const
 
int getClosestNodeIndex (fpreal pos, fpreal val) const
 
const UT_ColorNodegetCurrentNode () const
 
int getCurrentNodeIndex () const
 
void setCurrentNodeIndex (int i, bool add_to_selection)
 
void getColor (fpreal pos, UT_FRGBA *clr, bool do_interp=true) const
 
void getColor (fpreal pos, float fvals[4], bool do_interp=true) const
 
void getColor (UT_FRGBA *values, int num, bool do_interp=true) const
 
void setColorAt (int i, float fvals[4])
 
void setColorAt (int i, const UT_FRGBA &clr)
 
void setCurrentNodeColor (fpreal32 fvals[4])
 
void setCurrentNodeColor (fpreal64 fvals[4])
 
void setCurrentNodeColor (const UT_FRGBA &clr)
 
void setCurrentNodeBasis (UT_SPLINE_BASIS basis)
 
void setNodeBasis (int i, UT_SPLINE_BASIS basis)
 
void setEnable (int i, bool enable_pos, bool enable_val, bool enable_interp)
 
bool getEnablePos (int i) const
 
bool getEnableVal (int i) const
 
bool getEnableInterp (int i) const
 
bool getStrictOrder () const
 
void setStrictOrder (bool strict)
 
void clearSelection ()
 
bool isNodeSelected (int i) const
 
void selectNode (int i, bool add)
 
void selectRange (int first_i, int last_i, bool add)
 
void deselectNode (int i)
 
void toggleSelectNode (int i)
 
void getSelectionIndices (UT_IntArray &indices)
 
void setSelectionIndices (const UT_IntArray &indices)
 
int addNode (fpreal pos)
 Returns the index of the inserted node. More...
 
int addNode (fpreal pos, fpreal32 fvals[4], UT_SPLINE_BASIS basis=UT_SPLINE_LINEAR, bool current=true)
 
int addNode (fpreal pos, fpreal64 fvals[4], UT_SPLINE_BASIS basis=UT_SPLINE_LINEAR, bool current=true)
 
int addNode (fpreal pos, const UT_FRGBA &color, UT_SPLINE_BASIS basis=UT_SPLINE_LINEAR, bool current=true)
 
int insertNode (int i, fpreal pos, fpreal32 fvals[4], UT_SPLINE_BASIS basis=UT_SPLINE_LINEAR, bool current=true)
 
int insertNode (int i, fpreal pos, fpreal64 fvals[4], UT_SPLINE_BASIS basis=UT_SPLINE_LINEAR, bool current=true)
 
void reorderNodes ()
 
void recordNodePositions ()
 
bool deleteNode (fpreal pos)
 
bool deleteNodeAt (int i)
 
void deleteSelectedNodes ()
 
bool isNodeHandle (int i) const
 
bool isNodeLeftHandle (int i) const
 
bool isNodeRightHandle (int i) const
 
void moveNode (int i, fpreal pos)
 
void moveNode (const UT_ColorNode *node, fpreal pos)
 
fpreal solveSpline (fpreal pos) const
 
int load (const char *pathname)
 
bool load (UT_IStream &is)
 
bool load (UT_JSONParser &p)
 
int save (const char *pathname) const
 
int save (std::ostream &os) const
 
UT_Rampoperator= (const UT_Ramp &from)
 
bool operator== (const UT_Ramp &from) const
 
void setRamp (const UT_ColorNode *r, int size)
 
void rampLookup (fpreal pos, float values[4], int order=0) const
 
void rampLookupNoInterp (fpreal pos, float values[4]) const
 
void rampLookup (fpreal u0, fpreal u1, float values[4], int ns, int order=0) const
 
void rampLookupNoInterp (fpreal u0, fpreal u1, float values[4], int ns) const
 
template<typename ARCHIVER_T >
bool serialize (ARCHIVER_T &archiver)
 
bool resolveOpRamp (const char *op_path, const char *ramp_parm, bool *is_rgb=nullptr, int *op_id=nullptr, int *op_version=nullptr)
 

Static Public Member Functions

static void setRampOpResolver (UT_RampOpResolver *resolver)
 

Detailed Description

Utility class for containing a color ramp.

Definition at line 92 of file UT_Ramp.h.

Constructor & Destructor Documentation

UT_Ramp::UT_Ramp ( )
UT_Ramp::UT_Ramp ( const UT_Ramp copy)
explicit

Do not pass by value, you should be passing by const &. If you really need by value make the copy internally to your system.

UT_Ramp::~UT_Ramp ( )

Member Function Documentation

int UT_Ramp::addNode ( fpreal  pos)

Returns the index of the inserted node.

int UT_Ramp::addNode ( fpreal  pos,
fpreal32  fvals[4],
UT_SPLINE_BASIS  basis = UT_SPLINE_LINEAR,
bool  current = true 
)

WARNING: If building scalar ramps, set ALL the fvals to the same value. Code will randomly evaluate .r or .a

int UT_Ramp::addNode ( fpreal  pos,
fpreal64  fvals[4],
UT_SPLINE_BASIS  basis = UT_SPLINE_LINEAR,
bool  current = true 
)
int UT_Ramp::addNode ( fpreal  pos,
const UT_FRGBA color,
UT_SPLINE_BASIS  basis = UT_SPLINE_LINEAR,
bool  current = true 
)
void UT_Ramp::clearAndDestroy ( )
void UT_Ramp::clearSelection ( )
void UT_Ramp::convertToRaster ( UT_Raster raster,
UT_RampOrient  dir,
bool  do_interp = true,
fpreal  cx = 0.0f,
fpreal  cy = 0.0f,
fpreal  phase = 0.0f,
fpreal  radius = 1.0f 
)
bool UT_Ramp::deleteNode ( fpreal  pos)
bool UT_Ramp::deleteNodeAt ( int  i)
void UT_Ramp::deleteSelectedNodes ( )
void UT_Ramp::deselectNode ( int  i)
void UT_Ramp::ensureRampIsBuilt ( )

Force updating of the ramp after being modified.

const UT_ColorNode* UT_Ramp::getClosestNode ( fpreal  pos) const
const UT_ColorNode* UT_Ramp::getClosestNode ( fpreal  pos,
fpreal  val 
) const
int UT_Ramp::getClosestNodeIndex ( fpreal  pos) const
int UT_Ramp::getClosestNodeIndex ( fpreal  pos,
fpreal  val 
) const
void UT_Ramp::getColor ( fpreal  pos,
UT_FRGBA clr,
bool  do_interp = true 
) const
void UT_Ramp::getColor ( fpreal  pos,
float  fvals[4],
bool  do_interp = true 
) const
void UT_Ramp::getColor ( UT_FRGBA values,
int  num,
bool  do_interp = true 
) const
UT_ColorType UT_Ramp::getColorType ( ) const
inline

Definition at line 107 of file UT_Ramp.h.

const UT_ColorNode* UT_Ramp::getCurrentNode ( ) const
int UT_Ramp::getCurrentNodeIndex ( ) const
bool UT_Ramp::getEnableInterp ( int  i) const
bool UT_Ramp::getEnablePos ( int  i) const
bool UT_Ramp::getEnableVal ( int  i) const
bool UT_Ramp::getGlobalEnable ( ) const
inline

Definition at line 115 of file UT_Ramp.h.

int64 UT_Ramp::getMemoryUsage ( bool  inclusive) const

Return the amount of memory owned by this UT_Ramp in bytes.

const UT_ColorNode* UT_Ramp::getNode ( int  i) const
int UT_Ramp::getNodeCount ( ) const
inline

Definition at line 120 of file UT_Ramp.h.

UT_ColorNode* UT_Ramp::getRamp ( )
inline

Definition at line 123 of file UT_Ramp.h.

const UT_ColorNode* UT_Ramp::getRamp ( ) const
inline

Definition at line 126 of file UT_Ramp.h.

void UT_Ramp::getSelectionIndices ( UT_IntArray indices)
bool UT_Ramp::getStrictOrder ( ) const
int UT_Ramp::insertNode ( int  i,
fpreal  pos,
fpreal32  fvals[4],
UT_SPLINE_BASIS  basis = UT_SPLINE_LINEAR,
bool  current = true 
)
int UT_Ramp::insertNode ( int  i,
fpreal  pos,
fpreal64  fvals[4],
UT_SPLINE_BASIS  basis = UT_SPLINE_LINEAR,
bool  current = true 
)
bool UT_Ramp::isNodeHandle ( int  i) const
bool UT_Ramp::isNodeLeftHandle ( int  i) const
bool UT_Ramp::isNodeRightHandle ( int  i) const
bool UT_Ramp::isNodeSelected ( int  i) const
int UT_Ramp::load ( const char *  pathname)
bool UT_Ramp::load ( UT_IStream is)
bool UT_Ramp::load ( UT_JSONParser p)
void UT_Ramp::moveNode ( int  i,
fpreal  pos 
)
void UT_Ramp::moveNode ( const UT_ColorNode node,
fpreal  pos 
)
UT_Ramp& UT_Ramp::operator= ( const UT_Ramp from)
bool UT_Ramp::operator== ( const UT_Ramp from) const
void UT_Ramp::rampLookup ( fpreal  pos,
float  values[4],
int  order = 0 
) const
void UT_Ramp::rampLookup ( fpreal  u0,
fpreal  u1,
float  values[4],
int  ns,
int  order = 0 
) const
void UT_Ramp::rampLookupNoInterp ( fpreal  pos,
float  values[4] 
) const
void UT_Ramp::rampLookupNoInterp ( fpreal  u0,
fpreal  u1,
float  values[4],
int  ns 
) const
void UT_Ramp::recordNodePositions ( )
void UT_Ramp::reorderNodes ( )
bool UT_Ramp::resolveOpRamp ( const char *  op_path,
const char *  ramp_parm,
bool *  is_rgb = nullptr,
int op_id = nullptr,
int op_version = nullptr 
)

Fetch the ramp from an OP node's ramp parm. May return false if the OP or parm is not found, if the parm is not a ramp, or if the UT_RampOpResolver is not assigned by setRampOpResolver(). is_rgb, op_id, and op_version are optional return values for the type of ramp, the parent node's unique ID, and the parent node's version parm serial (as reported by getVersionParms()).

int UT_Ramp::save ( const char *  pathname) const
int UT_Ramp::save ( std::ostream &  os) const
void UT_Ramp::selectNode ( int  i,
bool  add 
)
void UT_Ramp::selectRange ( int  first_i,
int  last_i,
bool  add 
)
template<typename ARCHIVER_T >
bool UT_Ramp::serialize ( ARCHIVER_T &  archiver)
void UT_Ramp::setColorAt ( int  i,
float  fvals[4] 
)

Warning: If setting scalar ramps, make sure all of the fvals have the same value, as evaluators will pick a channel at whim.

void UT_Ramp::setColorAt ( int  i,
const UT_FRGBA clr 
)
void UT_Ramp::setColorType ( UT_ColorType  color_space)
inline

Definition at line 105 of file UT_Ramp.h.

void UT_Ramp::setCurrentNodeBasis ( UT_SPLINE_BASIS  basis)
void UT_Ramp::setCurrentNodeColor ( fpreal32  fvals[4])
void UT_Ramp::setCurrentNodeColor ( fpreal64  fvals[4])
void UT_Ramp::setCurrentNodeColor ( const UT_FRGBA clr)
void UT_Ramp::setCurrentNodeIndex ( int  i,
bool  add_to_selection 
)
void UT_Ramp::setEnable ( int  i,
bool  enable_pos,
bool  enable_val,
bool  enable_interp 
)
void UT_Ramp::setGlobalEnable ( bool  enable)
inline

Definition at line 117 of file UT_Ramp.h.

void UT_Ramp::setNodeBasis ( int  i,
UT_SPLINE_BASIS  basis 
)
void UT_Ramp::setRamp ( const UT_ColorNode r,
int  size 
)
static void UT_Ramp::setRampOpResolver ( UT_RampOpResolver resolver)
static

Install an OP node resolver for ramp parameters. Required for resolveOpRamp() to work. OP_Director calls this.

void UT_Ramp::setSelectionIndices ( const UT_IntArray indices)
void UT_Ramp::setStrictOrder ( bool  strict)
fpreal UT_Ramp::solveSpline ( fpreal  pos) const
void UT_Ramp::toggleSelectNode ( int  i)

The documentation for this class was generated from the following file: