Public Types | Public Member Functions | List of all members
icmm::CVarColor Class Reference

Generic color implementation with variable number of color components. More...

#include <CVarColor.h>

Inheritance diagram for icmm::CVarColor:
imath::CVarVector iser::ISerializable istd::IChangeable istd::IPolymorphic

Public Types

typedef imath::CVarVector BaseClass
 
- Public Types inherited from imath::CVarVector
typedef std::vector< double > Elements
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0, CF_ALL_DATA, CF_ANY, CF_DESTROYING,
  CF_DELEGATED, CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0, SO_OBSERVE = 1 << 0, SO_COPY = 1 << 1, SO_CLONE = 1 << 2,
  SO_COMPARE = 1 << 3, SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT, CM_WITHOUT_REFS, CM_WITH_REFS, CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 

Public Member Functions

 CVarColor ()
 Default constructor. More...
 
 CVarColor (int componentsCount, double value=0)
 Constructor with explicit initialization of number of elements. More...
 
 CVarColor (const CVarColor &color)
 Copy constructor. More...
 
template<int Size>
 CVarColor (const imath::TVector< Size > &vector)
 Template conversion constructor. More...
 
void GetRounded (const imath::IDoubleManip &manipulator, CVarColor &result)
 Get color after components value rounding with specified precision. More...
 
bool IsRoundedEqual (const CVarColor &color, const imath::IDoubleManip &manipulator) const
 Check if two values are equal after rounding. More...
 
bool IsSimilar (const CVarColor &color, double tolerance=I_BIG_EPSILON) const
 Allows to compare two colors with tolerance. More...
 
bool IsNormalized () const
 Check if this color value is normalized. More...
 
void Normalize ()
 Make this color to be normalized. More...
 
void GetNormalized (CVarColor &result) const
 Get normalized color. More...
 
CVarColor operator+ (const CVarColor &color) const
 
CVarColor operator- (const CVarColor &color) const
 
CVarColor operator* (const CVarColor &color) const
 
CVarColor operator/ (const CVarColor &color) const
 
CVarColor operator* (double value) const
 
CVarColor operator/ (double value) const
 
CVarColoroperator= (const CVarColor &color)
 
const CVarColoroperator+= (const CVarColor &color)
 
const CVarColoroperator-= (const CVarColor &color)
 
const CVarColoroperator*= (const CVarColor &color)
 
const CVarColoroperator/= (const CVarColor &color)
 
const CVarColoroperator*= (double value)
 
const CVarColoroperator/= (double value)
 
bool Serialize (iser::IArchive &archive)
 Load or store state of this object as a archive stream. More...
 
- Public Member Functions inherited from imath::CVarVector
 CVarVector ()
 Create the vector without components. More...
 
 CVarVector (int componentsCount, double value=0)
 Create vector and initialize number of components. More...
 
template<typename Iterator >
 CVarVector (Iterator beginIter, Iterator endIter)
 Constructor with iterators. More...
 
 CVarVector (const CVarVector &vector)
 Copy constructor. More...
 
template<int Size>
 CVarVector (const TVector< Size, double > &vector)
 
bool IsEmpty () const
 Get true, if the element ist is empty. More...
 
int GetElementsCount () const
 Get number of elements. More...
 
bool SetElementsCount (int count, double value=0)
 Set number of elements. More...
 
double GetElement (int index) const
 Get element at specified index. More...
 
double & GetElementRef (int index)
 Get reference to element at specified index. More...
 
void SetElement (int index, double value)
 Set element at specified index. More...
 
void SetAllElements (double value)
 Set some value to all elements. More...
 
void Reset ()
 Set size to zero. More...
 
void Reset (int elementsCount, double value)
 Set number of elements and set all elements to specified value. More...
 
void Clear ()
 Set all coordinates to zero. More...
 
void SetElementsFrom (const CVarVector &vector, double expansionValue=0)
 Set elements from other vector without resizing. More...
 
const ElementsGetElements () const
 Get read-only access to internal element container. More...
 
ElementsGetElementsRef ()
 Get access to internal element container. More...
 
bool EnsureElementsCount (int count, double value=0)
 Ensure, that number of elements is at least the specified value. More...
 
void Translate (const CVarVector &vector)
 Translate the point. More...
 
CVarVector GetTranslated (const CVarVector &vector)
 Get translated point. More...
 
void GetTranslated (const CVarVector &vector, CVarVector &result)
 /overloaded More...
 
void ScaledCumulate (const CVarVector &vector, double scale)
 Add second vector scaled by specified factor. More...
 
bool IsNull (double tolerance=I_BIG_EPSILON) const
 Check if this vector is null. More...
 
double GetDotProduct (const CVarVector &vector) const
 Return dot product of two vectors. More...
 
double GetLength2 () const
 Return euclidean length square. More...
 
double GetLength () const
 Return euclidian length. More...
 
double GetDistance2 (const CVarVector &vector) const
 Return distance square between two vectors. More...
 
double GetDistance (const CVarVector &vector) const
 Return distance between two vectors. More...
 
double GetElementsSum () const
 Get simple sum of all elements. More...
 
bool Normalize (double length=1.0)
 Normalize vector to specified length. More...
 
bool GetNormalized (CVarVector &result, double length=1.0) const
 Return normalized vector with the same direction and specified length. More...
 
void GetMinimal (const CVarVector &vector, CVarVector &result) const
 Get vector with minimal elements values. More...
 
void GetMaximal (const CVarVector &vector, CVarVector &result) const
 Get vector with maximal elements values. More...
 
bool Serialize (iser::IArchive &archive)
 Serialize this vector to specified archive. More...
 
bool operator== (const CVarVector &vector) const
 
bool operator!= (const CVarVector &vector) const
 
bool operator< (const CVarVector &vector) const
 
bool operator> (const CVarVector &vector) const
 
bool operator<= (const CVarVector &vector) const
 
bool operator>= (const CVarVector &vector) const
 
CVarVector operator- () const
 
CVarVector operator+ (const CVarVector &vector) const
 
CVarVector operator- (const CVarVector &vector) const
 
CVarVector operator* (double scalar) const
 
CVarVector operator/ (double scalar) const
 
CVarVectoroperator+= (const CVarVector &vector)
 
CVarVectoroperator-= (const CVarVector &vector)
 
CVarVectoroperator*= (double scalar)
 
CVarVectoroperator/= (double scalar)
 
CVarVectoroperator= (const CVarVector &vector)
 
double operator[] (int i) const
 
double & operator[] (int i)
 
- Public Member Functions inherited from iser::ISerializable
virtual quint32 GetMinimalVersion (int versionId) const
 Get minimal needed version to correct storing of this data. More...
 
- Public Member Functions inherited from istd::IChangeable
virtual int GetSupportedOperations () const
 Get set of flags for supported operations. More...
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
 Copy this object from another one. More...
 
virtual bool IsEqual (const IChangeable &object) const
 Compare this object with another object. More...
 
virtual IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const
 Make a copy of this object. More...
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS)
 Reset data to its default state. More...
 
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction. More...
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction. More...
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes. More...
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes. More...
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Additional Inherited Members

- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes. More...
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set. More...
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set. More...
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set. More...
 
- Protected Member Functions inherited from istd::IChangeable
virtual void OnBeginChanges ()
 Callback function for begin change event. More...
 
virtual void OnEndChanges (const ChangeSet &changeSet)
 Callback function for end change event. More...
 

Detailed Description

Generic color implementation with variable number of color components.

The dimension of used colorspace can be set at the construction time of CVarColor object,

Definition at line 21 of file CVarColor.h.

Member Typedef Documentation

Definition at line 24 of file CVarColor.h.

Constructor & Destructor Documentation

icmm::CVarColor::CVarColor ( )

Default constructor.

It set number of elements to 0.

icmm::CVarColor::CVarColor ( int  componentsCount,
double  value = 0 
)
explicit

Constructor with explicit initialization of number of elements.

icmm::CVarColor::CVarColor ( const CVarColor color)

Copy constructor.

template<int Size>
icmm::CVarColor::CVarColor ( const imath::TVector< Size > &  vector)
inline

Template conversion constructor.

Definition at line 46 of file CVarColor.h.

Member Function Documentation

void icmm::CVarColor::GetNormalized ( CVarColor result) const

Get normalized color.

Normalized values have all components in the range [0, 1].

void icmm::CVarColor::GetRounded ( const imath::IDoubleManip manipulator,
CVarColor result 
)

Get color after components value rounding with specified precision.

Parameters
manipulatormanipulator object used to round single components.
resultresult object.
bool icmm::CVarColor::IsNormalized ( ) const
inline

Check if this color value is normalized.

Normalized values have all components in the range [0, 1].

Definition at line 119 of file CVarColor.h.

References imath::CVarVector::GetElement(), and imath::CVarVector::GetElementsCount().

bool icmm::CVarColor::IsRoundedEqual ( const CVarColor color,
const imath::IDoubleManip manipulator 
) const

Check if two values are equal after rounding.

Parameters
colorsecond color to comparision.
manipulatorvalue manipulator used to round single components.
bool icmm::CVarColor::IsSimilar ( const CVarColor color,
double  tolerance = I_BIG_EPSILON 
) const
inline

Allows to compare two colors with tolerance.

Definition at line 113 of file CVarColor.h.

References imath::CVarVector::GetDistance().

void icmm::CVarColor::Normalize ( )

Make this color to be normalized.

Normalized values have all components in the range [0, 1].

CVarColor icmm::CVarColor::operator* ( const CVarColor color) const
inline

Definition at line 155 of file CVarColor.h.

CVarColor icmm::CVarColor::operator* ( double  value) const
inline
const CVarColor& icmm::CVarColor::operator*= ( const CVarColor color)
const CVarColor & icmm::CVarColor::operator*= ( double  value)
inline

Definition at line 203 of file CVarColor.h.

References imath::CVarVector::operator*=().

CVarColor icmm::CVarColor::operator+ ( const CVarColor color) const
inline

Definition at line 135 of file CVarColor.h.

const CVarColor& icmm::CVarColor::operator+= ( const CVarColor color)
CVarColor icmm::CVarColor::operator- ( const CVarColor color) const
inline

Definition at line 145 of file CVarColor.h.

const CVarColor& icmm::CVarColor::operator-= ( const CVarColor color)
CVarColor icmm::CVarColor::operator/ ( const CVarColor color) const
inline

Definition at line 165 of file CVarColor.h.

CVarColor icmm::CVarColor::operator/ ( double  value) const
inline
const CVarColor& icmm::CVarColor::operator/= ( const CVarColor color)
const CVarColor & icmm::CVarColor::operator/= ( double  value)
inline

Definition at line 211 of file CVarColor.h.

References imath::CVarVector::operator/=().

CVarColor& icmm::CVarColor::operator= ( const CVarColor color)
bool icmm::CVarColor::Serialize ( iser::IArchive archive)
virtual

Load or store state of this object as a archive stream.

Type of operation is depending on archive type.

See Also
iser::IArchive

Implements iser::ISerializable.


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy