MorphoGraphX  2.0-1-227
Public Member Functions | List of all members
mgx::Color< T > Class Template Reference

A utility class to encapsulate color data. More...

#include <Color.hpp>

+ Inheritance diagram for mgx::Color< T >:

Public Member Functions

template<typename T1 >
 Color (const Color< T1 > &color)
 Constructor to convert from one color type to another. More...
 
template<typename T1 >
 Color (const Vector< 4, T1 > &color, const T &scale)
 
 Color (const Vector< 4, T > &copy)
 
 Color (const QColor &c)
 
 Color (const T &r=T(), const T &g=T(), const T &b=T(), const T &a=T())
 Constructor. More...
 
T & r ()
 Return the red component. More...
 
T & g ()
 Return the green component. More...
 
T & b ()
 Return the blue component. More...
 
T & a ()
 Return the alpha component. More...
 
const T & r () const
 Return the red component. More...
 
const T & g () const
 Return the green component. More...
 
const T & b () const
 Return the blue component. More...
 
const T & a () const
 Return the alpha component. More...
 
void r (const T &val)
 Set the red component. More...
 
void g (const T &val)
 Set the green component. More...
 
void b (const T &val)
 Set the blue component. More...
 
void a (const T &val)
 Set the alpha component. More...
 
Color< T > & operator= (const Color< T > &c)
 Assignment of color data. More...
 
Color< T > & operator= (const Vector< 4, T > &c)
 
Color< T > & operator= (const T &val)
 
Color< T > & operator= (const QColor &c)
 
 operator QColor () const
 
- Public Member Functions inherited from mgx::Vector< 4, T >
CU_HOST_DEVICE Vector (const Vector< d1, T1 > &vec)
 Copy another vector with different number of elements. More...
 
CU_HOST_DEVICE Vector (const Vec &el)
 Initialize a vector from any object behaving like an array. More...
 
CU_HOST_DEVICE Vector (const T &x=T())
 Initialize a vector with all values to x. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y)
 Initialize a 2D vector. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y, const T &z)
 Initialize a 3D vector. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y, const T &z, const T &t)
 Initialize a 4D vector. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y, const T &z, const T &a, const T &b)
 Initialize a 5D vector. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y, const T &z, const T &a, const T &b, const T &c)
 Initialize a 6D vector. More...
 
CU_HOST_DEVICE Vector (const T &x, const T &y, const T &z, const T &a, const T &b, const T &c, const T &d)
 Initialize a 7D vector. More...
 
CU_HOST_DEVICE Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h)
 Initialize a 8D vector. More...
 
CU_HOST_DEVICE Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i)
 Initialize a 9D vector. More...
 
CU_HOST_DEVICE Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i, const T &j, const T &k, const T &l)
 Initialize a 12D vector. More...
 
CU_HOST_DEVICE Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i, const T &j, const T &k, const T &l, const T &m, const T &n, const T &o, const T &p, const T &q, const T &r)
 Initialize a 18D vector. More...
 
CU_HOST_DEVICE T * data ()
 Returns a raw pointer on the data. More...
 
CU_HOST_DEVICE iterator begin ()
 STL-iteration begin. More...
 
CU_HOST_DEVICE const_iterator begin () const
 Stl-iteration constant begin. More...
 
CU_HOST_DEVICE iterator end ()
 STL-iteration end. More...
 
CU_HOST_DEVICE const_iterator end () const
 Stl-iteration constant end. More...
 
const CU_HOST_DEVICE T * c_data () const
 Returns a constant raw pointer on the data. More...
 
CU_HOST_DEVICE Vector operator- (void) const
 Vector negation. More...
 
CU_HOST_DEVICE Vector operator- (const Vector &vec) const
 Vector subtraction. More...
 
CU_HOST_DEVICE Vector operator+ (const Vector &vec) const
 Vector addition. More...
 
CU_HOST_DEVICE Vector mult (const Vector &vec) const
 Element-wise multiplcation. More...
 
CU_HOST_DEVICE Vector operator* (const T &scalar) const
 Multiplication by a scalar. More...
 
CU_HOST_DEVICEoperator* (const Vector &vec) const
 Dot product. More...
 
CU_HOST_DEVICE Vector operator/ (const T &scalar) const
 Division by a scalar. More...
 
CU_HOST_DEVICE Vector operator/ (const Vector &vec) const
 Element-wise division. More...
 
CU_HOST_DEVICE Vectoroperator/= (const Vector &vec)
 In-place element-wise division by a scalar. More...
 
CU_HOST_DEVICE Vectoroperator/= (const T &scalar)
 In-place division by a scalar. More...
 
CU_HOST_DEVICE Vectoroperator/= (const T1 &scalar)
 In-place division by a scalar. More...
 
CU_HOST_DEVICE Vectoroperator+= (const Vector &vec)
 Vector copy. More...
 
CU_HOST_DEVICE Vectoroperator+= (const T &val)
 In-place constant addition. More...
 
CU_HOST_DEVICE Vectoroperator-= (const Vector &vec)
 In-place vector subtraction. More...
 
CU_HOST_DEVICE Vectoroperator-= (const T &val)
 In-place value subtraction. More...
 
CU_HOST_DEVICE Vectoroperator*= (const T &scalar)
 In-place multiplication by a scalar. More...
 
CU_HOST_DEVICE Vectoroperator*= (const T1 &scalar)
 In-place multiplication by a scalar. More...
 
CU_HOST_DEVICE bool operator== (const Vector &vec) const
 Element-wise equality. More...
 
CU_HOST_DEVICE bool operator!= (const Vector &vec) const
 Element-wise inequality. More...
 
CU_HOST_DEVICE T & operator[] (size_t idx)
 Access to the element idx. More...
 
const CU_HOST_DEVICE T & operator[] (size_t idx) const
 Access to the element idx. More...
 
CU_HOST_DEVICEnorm () const
 Euclidean norm of the vector. More...
 
CU_HOST_DEVICEnormsq () const
 Square of the Euclidean norm of the vector. More...
 
CU_HOST_DEVICE Vectornormalize (void)
 Normalize the vector. More...
 
CU_HOST_DEVICE Vector normalized (void) const
 Returns a normalized version of the vector. More...
 
bool iszero (void)
 
Vectorzero (void)
 
CU_HOST_DEVICE void set (const T &x)
 Set the values of a 1-D vector. More...
 
CU_HOST_DEVICE void set (const T &x, const T &y)
 Set the values of a 2-D vector. More...
 
CU_HOST_DEVICE void set (const T &x, const T &y, const T &z)
 Set the values of a 3-D vector. More...
 
CU_HOST_DEVICE void set (const T &x, const T &y, const T &z, const T &t)
 Set the values of a 4-D vector. More...
 
CU_HOST_DEVICE Vectoroperator= (const T &value)
 Set all the elements to value. More...
 
CU_HOST_DEVICE Vector cross (const Vector &other) const
 Compute the cross product as this x other. More...
 
CU_HOST_DEVICE void x (const T &v)
 Short access to the first element. More...
 
CU_HOST_DEVICE T & x ()
 Short access to the first element. More...
 
const CU_HOST_DEVICE T & x () const
 Short access to the first element. More...
 
CU_HOST_DEVICE void y (const T &v)
 Short access to the second element. More...
 
CU_HOST_DEVICE T & y ()
 Short access to the second element. More...
 
const CU_HOST_DEVICE T & y () const
 Short access to the second element. More...
 
CU_HOST_DEVICE void z (const T &v)
 Short access to the third element. More...
 
CU_HOST_DEVICE T & z ()
 Short access to the third element. More...
 
const CU_HOST_DEVICE T & z () const
 Short access to the third element. More...
 
CU_HOST_DEVICE void t (const T &v)
 Short access to the fourth element. More...
 
CU_HOST_DEVICE T & t ()
 Short access to the fourth element. More...
 
const CU_HOST_DEVICE T & t () const
 Short access to the fourth element. More...
 
CU_HOST_DEVICE void i (const T &v)
 Short access to the first element. More...
 
CU_HOST_DEVICE T & i ()
 Short access to the first element. More...
 
const CU_HOST_DEVICE T & i () const
 Short access to the first element. More...
 
CU_HOST_DEVICE void j (const T &v)
 Short access to the second element. More...
 
CU_HOST_DEVICE T & j ()
 Short access to the second element. More...
 
const CU_HOST_DEVICE T & j () const
 Short access to the second element. More...
 
CU_HOST_DEVICE void k (const T &v)
 Short access to the third element. More...
 
CU_HOST_DEVICE T & k ()
 Short access to the third element. More...
 
const CU_HOST_DEVICE T & k () const
 Short access to the third element. More...
 
CU_HOST_DEVICE void l (const T &v)
 Short access to the fourth element. More...
 
CU_HOST_DEVICE T & l ()
 Short access to the fourth element. More...
 
const CU_HOST_DEVICE T & l () const
 Short access to the fourth element. More...
 
CU_HOST_DEVICE Vector< 2, T > projectXY (void)
 Extract the two first elements of the vector. More...
 
CU_HOST_DEVICE bool operator< (const Vector &other) const
 Comparison operator. More...
 
CU_HOST_DEVICE bool operator<= (const Vector &other) const
 Comparison operator. More...
 
CU_HOST_DEVICE bool operator> (const Vector &other) const
 Comparison operator. More...
 
CU_HOST_DEVICE bool operator>= (const Vector &other) const
 Comparison operator. More...
 

Additional Inherited Members

- Public Types inherited from mgx::Vector< 4, T >
typedef T value_type
 
typedef T & reference_type
 
typedef T * pointer_type
 
typedef T * iterator
 
- Static Public Member Functions inherited from mgx::Vector< 4, T >
static CU_HOST_DEVICE size_t size ()
 Returns the size of the vector (i.e. More...
 
- Public Attributes inherited from mgx::Vector< 4, T >
const typedef T & const_reference_type
 
const typedef T * const_pointer_type
 
const typedef T * const_iterator
 
- Static Public Attributes inherited from mgx::Vector< 4, T >
static const size_t numElems
 
- Protected Attributes inherited from mgx::Vector< 4, T >
elems [dim]
 

Detailed Description

template<class T>
class mgx::Color< T >

A utility class to encapsulate color data.

Definition at line 34 of file Color.hpp.

Constructor & Destructor Documentation

◆ Color() [1/5]

template<class T >
template<typename T1 >
mgx::Color< T >::Color ( const Color< T1 > &  color)
inlineexplicit

Constructor to convert from one color type to another.

Definition at line 41 of file Color.hpp.

◆ Color() [2/5]

template<class T >
template<typename T1 >
mgx::Color< T >::Color ( const Vector< 4, T1 > &  color,
const T &  scale 
)
inline

Definition at line 45 of file Color.hpp.

◆ Color() [3/5]

template<class T >
mgx::Color< T >::Color ( const Vector< 4, T > &  copy)
inline

Definition at line 48 of file Color.hpp.

◆ Color() [4/5]

template<class T >
mgx::Color< T >::Color ( const QColor< T > &  c)
inline

Definition at line 50 of file Color.hpp.

◆ Color() [5/5]

template<class T >
mgx::Color< T >::Color ( const T &  r = T(),
const T &  g = T(),
const T &  b = T(),
const T &  a = T() 
)
inline

Constructor.

Parameters
rValue for red.
gValue for green.
bValue for blue.
aValue for alpha.

Definition at line 59 of file Color.hpp.

Member Function Documentation

◆ a() [1/3]

template<class T >
T& mgx::Color< T >::a ( )
inline

Return the alpha component.

Definition at line 80 of file Color.hpp.

◆ a() [2/3]

template<class T >
const T& mgx::Color< T >::a ( ) const
inline

Return the alpha component.

Definition at line 100 of file Color.hpp.

◆ a() [3/3]

template<class T >
void mgx::Color< T >::a ( const T &  val)
inline

Set the alpha component.

Definition at line 120 of file Color.hpp.

◆ b() [1/3]

template<class T >
T& mgx::Color< T >::b ( )
inline

Return the blue component.

Definition at line 75 of file Color.hpp.

◆ b() [2/3]

template<class T >
const T& mgx::Color< T >::b ( ) const
inline

Return the blue component.

Definition at line 95 of file Color.hpp.

◆ b() [3/3]

template<class T >
void mgx::Color< T >::b ( const T &  val)
inline

Set the blue component.

Definition at line 115 of file Color.hpp.

◆ g() [1/3]

template<class T >
T& mgx::Color< T >::g ( )
inline

Return the green component.

Definition at line 70 of file Color.hpp.

◆ g() [2/3]

template<class T >
const T& mgx::Color< T >::g ( ) const
inline

Return the green component.

Definition at line 90 of file Color.hpp.

◆ g() [3/3]

template<class T >
void mgx::Color< T >::g ( const T &  val)
inline

Set the green component.

Definition at line 110 of file Color.hpp.

◆ operator QColor()

template<class T >
mgx::Color< T >::operator QColor ( ) const
inline

Definition at line 131 of file Color.hpp.

◆ operator=() [1/4]

template<class T >
Color< T > & mgx::Color< T >::operator= ( const Color< T > &  c)

Assignment of color data.

Definition at line 147 of file Color.hpp.

◆ operator=() [2/4]

template<class T >
Color<T>& mgx::Color< T >::operator= ( const QColor< T > &  c)
inline

Definition at line 125 of file Color.hpp.

◆ operator=() [3/4]

template<class T >
Color< T > & mgx::Color< T >::operator= ( const T &  val)

Definition at line 153 of file Color.hpp.

◆ operator=() [4/4]

template<class T >
Color< T > & mgx::Color< T >::operator= ( const Vector< 4, T > &  c)

Definition at line 159 of file Color.hpp.

◆ r() [1/3]

template<class T >
T& mgx::Color< T >::r ( )
inline

Return the red component.

Definition at line 65 of file Color.hpp.

◆ r() [2/3]

template<class T >
const T& mgx::Color< T >::r ( ) const
inline

Return the red component.

Definition at line 85 of file Color.hpp.

◆ r() [3/3]

template<class T >
void mgx::Color< T >::r ( const T &  val)
inline

Set the red component.

Definition at line 105 of file Color.hpp.


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