|
ACF $AcfVersion:0$
|
Generic color implementation with variable number of color components. More...
#include <CVarColor.h>
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... | |
| typedef QMultiMap< QByteArray, QVariant > | ChangeInfoMap |
Public Member Functions | |
| CVarColor () | |
| Default constructor. | |
| CVarColor (int componentsCount, double value=0) | |
| Constructor with explicit initialization of number of elements. | |
| CVarColor (const CVarColor &color) | |
| Copy constructor. | |
| template<int Size> | |
| CVarColor (const imath::TVector< Size > &vector) | |
| Template conversion constructor. | |
| void | GetRounded (const imath::IDoubleManip &manipulator, CVarColor &result) |
| Get color after components value rounding with specified precision. | |
| bool | IsRoundedEqual (const CVarColor &color, const imath::IDoubleManip &manipulator) const |
| Check if two values are equal after rounding. | |
| bool | IsSimilar (const CVarColor &color, double tolerance=I_BIG_EPSILON) const |
| Allows to compare two colors with tolerance. | |
| bool | IsNormalized () const |
| Check if this color value is normalized. | |
| void | Normalize () |
| Make this color to be normalized. | |
| void | GetNormalized (CVarColor &result) const |
| Get normalized color. | |
| 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 |
| 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/= (const CVarColor &color) |
| const CVarColor & | operator*= (double value) |
| const CVarColor & | operator/= (double value) |
| virtual bool | Serialize (iser::IArchive &archive) override |
| Load or store state of this object as a archive stream. | |
Public Member Functions inherited from imath::CVarVector | |
| CVarVector () | |
| Create the vector without components. | |
| CVarVector (int componentsCount, double value=0) | |
| Create vector and initialize number of components. | |
| template<typename Iterator > | |
| CVarVector (Iterator beginIter, Iterator endIter) | |
| Creates a vector from a range of values using iterators. | |
| CVarVector (const CVarVector &vector) | |
| Copy constructor. | |
| template<int Size> | |
| CVarVector (const TVector< Size, double > &vector) | |
| Creates a variable-size vector from a fixed-size TVector. | |
| bool | IsEmpty () const |
Get true, if the element ist is empty. | |
| int | GetElementsCount () const |
| Get number of elements. | |
| bool | SetElementsCount (int count, double value=0) |
| Set number of elements. | |
| double | GetElement (int index) const |
| Get element at specified index. | |
| double & | GetElementRef (int index) |
| Get reference to element at specified index. | |
| void | SetElement (int index, double value) |
| Set element at specified index. | |
| void | SetAllElements (double value) |
| Set some value to all elements. | |
| void | Reset () |
| Set size to zero. | |
| void | Reset (int elementsCount, double value) |
| Set number of elements and set all elements to specified value. | |
| void | Clear () |
| Set all coordinates to zero. | |
| void | SetElementsFrom (const CVarVector &vector, double expansionValue=0) |
| Set elements from other vector without resizing. | |
| const Elements & | GetElements () const |
| Get read-only access to internal element container. | |
| Elements & | GetElementsRef () |
| Get access to internal element container. | |
| bool | EnsureElementsCount (int count, double value=0) |
| Ensure, that number of elements is at least the specified value. | |
| void | Translate (const CVarVector &vector) |
| Translate the point. | |
| CVarVector | GetTranslated (const CVarVector &vector) |
| Get translated point. | |
| void | GetTranslated (const CVarVector &vector, CVarVector &result) |
| /overloaded | |
| void | ScaledCumulate (const CVarVector &vector, double scale) |
| Add second vector scaled by specified factor. | |
| bool | IsNull (double tolerance=I_BIG_EPSILON) const |
| Check if this vector is null. | |
| double | GetDotProduct (const CVarVector &vector) const |
| Return dot product of two vectors. | |
| double | GetLength2 () const |
| Return euclidean length square. | |
| double | GetLength () const |
| Return euclidian length. | |
| double | GetDistance2 (const CVarVector &vector) const |
| Return distance square between two vectors. | |
| double | GetDistance (const CVarVector &vector) const |
| Return distance between two vectors. | |
| double | GetElementsSum () const |
| Get simple sum of all elements. | |
| bool | Normalize (double length=1.0) |
| Normalize vector to specified length. | |
| bool | GetNormalized (CVarVector &result, double length=1.0) const |
| Return normalized vector with the same direction and specified length. | |
| void | GetMinimal (const CVarVector &vector, CVarVector &result) const |
| Get vector with minimal elements values. | |
| void | GetMaximal (const CVarVector &vector, CVarVector &result) const |
| Get vector with maximal elements values. | |
| bool | Serialize (iser::IArchive &archive) |
| Serialize this vector to specified archive. | |
| 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 |
| CVarVector & | operator+= (const CVarVector &vector) |
| CVarVector & | operator-= (const CVarVector &vector) |
| CVarVector & | operator*= (double scalar) |
| CVarVector & | operator/= (double scalar) |
| CVarVector & | operator= (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. | |
Public Member Functions inherited from istd::IChangeable | |
| virtual int | GetSupportedOperations () const |
| Get set of flags for supported operations. | |
| virtual bool | CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) |
| Copy this object from another one. | |
| virtual bool | IsEqual (const IChangeable &object) const |
| Compare this object with another object. | |
| virtual istd::TUniqueInterfacePtr< istd::IChangeable > | CloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const |
| Make a copy of this object. | |
| virtual bool | ResetData (CompatibilityMode mode=CM_WITHOUT_REFS) |
| Reset data to its default state. | |
| virtual void | BeginChanges (const ChangeSet &changeSet) |
| Starts the change transaction. | |
| virtual void | EndChanges (const ChangeSet &changeSet) |
| Ends the change transaction. | |
| virtual void | BeginChangeGroup (const ChangeSet &changeSet) |
| Starts group of changes. | |
| virtual void | EndChangeGroup (const ChangeSet &changeSet) |
| Ends group of changes. | |
Public Member Functions inherited from istd::IPolymorphic | |
| virtual | ~IPolymorphic () |
Additional Inherited Members | |
Static Public Member Functions inherited from istd::IChangeable | |
| static const ChangeSet & | GetNoChanges () |
| Get empty set of changes. | |
| static const ChangeSet & | GetAnyChange () |
| Get anonymous change set. | |
| static const ChangeSet & | GetAllChanges () |
| Get anonymous change set. | |
| static const ChangeSet & | GetDelegatedChanges () |
| Get delegated change set. | |
Protected Member Functions inherited from istd::IChangeable | |
| virtual void | OnBeginChanges () |
| Callback function for begin change event. | |
| virtual void | OnEndChanges (const ChangeSet &changeSet) |
| Callback function for end change event. | |
Generic color implementation with variable number of color components.
CVarColor provides a flexible color representation that can accommodate any color space with any number of components. Unlike fixed-size color classes (CRgb, CCmyk), CVarColor's dimensionality is determined at runtime, making it ideal for generic color processing, color transformations, and working with exotic or custom color spaces.
CVarColor is used when:
Definition at line 175 of file CVarColor.h.
Definition at line 178 of file CVarColor.h.
| icmm::CVarColor::CVarColor | ( | ) |
Default constructor.
It set number of elements to 0.
|
explicit |
Constructor with explicit initialization of number of elements.
| icmm::CVarColor::CVarColor | ( | const CVarColor & | color | ) |
Copy constructor.
|
inline |
Template conversion constructor.
Definition at line 200 of file CVarColor.h.
| 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.
| manipulator | manipulator object used to round single components. |
| result | result object. |
|
inline |
Check if this color value is normalized.
Normalized values have all components in the range [0, 1].
Definition at line 273 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.
| color | second color to comparision. |
| manipulator | value manipulator used to round single components. |
|
inline |
Allows to compare two colors with tolerance.
Definition at line 267 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].
Definition at line 309 of file CVarColor.h.
|
inline |
Definition at line 329 of file CVarColor.h.
References imath::CVarVector::GetElement(), imath::CVarVector::GetElementsCount(), and imath::CVarVector::SetElement().
|
inline |
Definition at line 357 of file CVarColor.h.
References imath::CVarVector::operator*=().
Definition at line 289 of file CVarColor.h.
Definition at line 299 of file CVarColor.h.
Definition at line 319 of file CVarColor.h.
|
inline |
Definition at line 343 of file CVarColor.h.
References imath::CVarVector::GetElement(), imath::CVarVector::GetElementsCount(), and imath::CVarVector::SetElement().
|
inline |
Definition at line 365 of file CVarColor.h.
References imath::CVarVector::operator/=().
|
overridevirtual |
Load or store state of this object as a archive stream.
Type of operation is depending on archive type.
Implements iser::ISerializable.