HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Color4< T > Class Template Reference

#include <ImathColor.h>

+ Inheritance diagram for Color4< T >:

Public Types

typedef T BaseType
 
- Public Types inherited from VectorN< Color4, float, 4 >
using Iterator = typename std::array< float, N >::iterator
 
using ConstIterator = typename std::array< float, N >::const_iterator
 

Public Member Functions

 Color4 ()=default
 
 Color4 (float r, float g, float b, float a)
 
Constructors and Assignment
IMATH_HOSTDEVICE Color4 () IMATH_NOEXCEPT
 No initialization by default. More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (T a) IMATH_NOEXCEPT
 Initialize to (a a a a) More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (T a, T b, T c, T d) IMATH_NOEXCEPT
 Initialize to (a b c d) More...
 
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4 &v) IMATH_NOEXCEPT
 Construct from Color4. More...
 
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4< S > &v) IMATH_NOEXCEPT
 Construct from Color4. More...
 
IMATH_HOSTDEVICE ~Color4 ()=default
 Destructor. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator= (const Color4 &v) IMATH_NOEXCEPT
 Assignment. More...
 
IMATH_HOSTDEVICE Toperator[] (int i) IMATH_NOEXCEPT
 Component-wise value. More...
 
IMATH_HOSTDEVICE const Toperator[] (int i) const IMATH_NOEXCEPT
 Component-wise value. More...
 
Arithmetic and Comparison
template<class S >
IMATH_HOSTDEVICE constexpr bool operator== (const Color4< S > &v) const IMATH_NOEXCEPT
 Equality. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator!= (const Color4< S > &v) const IMATH_NOEXCEPT
 Inequality. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator+= (const Color4 &v) IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator+ (const Color4 &v) const IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator-= (const Color4 &v) IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator- (const Color4 &v) const IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator- () const IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
negate () IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator*= (const Color4 &v) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator*= (T a) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator* (const Color4 &v) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator* (T a) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator/= (const Color4 &v) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color4
operator/= (T a) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator/ (const Color4 &v) const IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Color4 operator/ (T a) const IMATH_NOEXCEPT
 Component-wise division. More...
 
Compatibilty with Sb
template<class S >
IMATH_HOSTDEVICE void setValue (S a, S b, S c, S d) IMATH_NOEXCEPT
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void setValue (const Color4< S > &v) IMATH_NOEXCEPT
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (S &a, S &b, S &c, S &d) const IMATH_NOEXCEPT
 Return the value. More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (Color4< S > &v) const IMATH_NOEXCEPT
 Return the value. More...
 
IMATH_HOSTDEVICE TgetValue () IMATH_NOEXCEPT
 Return raw pointer to the value. More...
 
IMATH_HOSTDEVICE const TgetValue () const IMATH_NOEXCEPT
 Return raw pointer to the value. More...
 
- Public Member Functions inherited from VectorN< Color4, float, 4 >
 VectorN ()
 
 VectorN (Uninit)
 
 VectorN (floats)
 
 VectorN (const std::array< float, N > &arr)
 
 VectorN (const vector< float > &vec)
 
 VectorN (const float *begin, const float *end)
 
bool operator== (const Color4 &rhs) const
 Return true if the given vector is identical to this one. More...
 
bool operator!= (const Color4 &rhs) const
 Return true if the given vector differs from this one. More...
 
bool operator< (const Color4 &rhs) const
 Compare two vectors lexicographically. More...
 
floatoperator[] (size_t i)
 Return the scalar value at the given index. More...
 
const floatoperator[] (size_t i) const
 Return the const scalar value at the given index. More...
 
Color4 operator+ (const Color4 &rhs) const
 Component-wise addition of two vectors. More...
 
VectorNoperator+= (const Color4 &rhs)
 Component-wise addition of two vectors. More...
 
Color4 operator- (const Color4 &rhs) const
 Component-wise subtraction of two vectors. More...
 
Color4 operator- () const
 Unary negation of a vector. More...
 
VectorNoperator-= (const Color4 &rhs)
 Component-wise subtraction of two vectors. More...
 
Color4 operator* (const Color4 &rhs) const
 Component-wise multiplication of two vectors. More...
 
Color4 operator* (floats) const
 Component-wise multiplication of a vector by a scalar. More...
 
VectorNoperator*= (const Color4 &rhs)
 Component-wise multiplication of two vectors. More...
 
VectorNoperator*= (floats)
 Component-wise multiplication of a vector by a scalar. More...
 
Color4 operator/ (const Color4 &rhs) const
 Component-wise division of two vectors. More...
 
Color4 operator/ (floats) const
 Component-wise division of a vector by a scalar. More...
 
VectorNoperator/= (const Color4 &rhs)
 Component-wise division of two vectors. More...
 
VectorNoperator/= (floats)
 Component-wise division of a vector by a scalar. More...
 
float getMagnitude () const
 Return the magnitude of the vector. More...
 
Color4 getNormalized () const
 Return a normalized vector. More...
 
float dot (const Color4 &rhs) const
 Return the dot product of two vectors. More...
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
floatdata ()
 Return a pointer to the underlying data array. More...
 
const floatdata () const
 Return a const pointer to the underlying data array. More...
 

Static Public Member Functions

Numeric Limits
IMATH_HOSTDEVICE static
constexpr unsigned int 
dimensions () IMATH_NOEXCEPT
 Number of dimensions (channels), i.e. 4 for a Color4. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeLowest () IMATH_NOEXCEPT
 Largest possible negative value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeMax () IMATH_NOEXCEPT
 Largest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest () IMATH_NOEXCEPT
 Smallest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon () IMATH_NOEXCEPT
 Smallest possible e for which 1+e != 1. More...
 
- Static Public Member Functions inherited from VectorN< Color4, float, 4 >
static constexpr size_t numElements ()
 Return the number of scalar elements for the vector. More...
 

Public Attributes

Direct access to elements
T r
 
T g
 
T b
 
T a
 

Additional Inherited Members

- Protected Attributes inherited from VectorN< Color4, float, 4 >
std::array< float, N > _arr
 

Detailed Description

template<class T>
class Color4< T >

A 4-channel color class: 3 channels plus alpha.

For convenience, the fields are named r, g, and b, although this class does not impose interpretation on the channels, which can represent either rgb or hsv color values.

A four-component color value

Definition at line 116 of file ImathColor.h.

Member Typedef Documentation

template<class T>
typedef T Color4< T >::BaseType

The base type: In templates that accept a parameter V (could be a Color4), you can refer to T as V::BaseType

Definition at line 234 of file ImathColor.h.

Constructor & Destructor Documentation

template<class T >
IMATH_HOSTDEVICE Color4< T >::Color4 ( )
inline

No initialization by default.

Definition at line 469 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4< T >::Color4 ( T  a)
inlineexplicit

Initialize to (a a a a)

Definition at line 475 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4< T >::Color4 ( T  a,
T  b,
T  c,
T  d 
)
inline

Initialize to (a b c d)

Definition at line 481 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4< T >::Color4 ( const Color4< T > &  v)
inline

Construct from Color4.

Definition at line 490 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4< T >::Color4 ( const Color4< S > &  v)
inline

Construct from Color4.

Definition at line 500 of file ImathColor.h.

template<class T>
IMATH_HOSTDEVICE Color4< T >::~Color4 ( )
default

Destructor.

template<class T>
Color4< T >::Color4 ( )
default
template<class T>
Color4< T >::Color4 ( float  r,
float  g,
float  b,
float  a 
)
inline

Definition at line 368 of file Types.h.

Member Function Documentation

template<class T>
IMATH_HOSTDEVICE static constexpr T Color4< T >::baseTypeEpsilon ( )
inlinestatic

Smallest possible e for which 1+e != 1.

Definition at line 228 of file ImathColor.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Color4< T >::baseTypeLowest ( )
inlinestatic

Largest possible negative value.

Definition at line 219 of file ImathColor.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Color4< T >::baseTypeMax ( )
inlinestatic

Largest possible positive value.

Definition at line 222 of file ImathColor.h.

template<class T>
IMATH_HOSTDEVICE static constexpr T Color4< T >::baseTypeSmallest ( )
inlinestatic

Smallest possible positive value.

Definition at line 225 of file ImathColor.h.

template<class T>
IMATH_HOSTDEVICE static constexpr unsigned int Color4< T >::dimensions ( )
inlinestatic

Number of dimensions (channels), i.e. 4 for a Color4.

Definition at line 216 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Color4< T >::getValue ( S a,
S b,
S c,
S d 
) const
inline

Return the value.

Definition at line 544 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Color4< T >::getValue ( Color4< S > &  v) const
inline

Return the value.

Definition at line 555 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE T * Color4< T >::getValue ( )
inline

Return raw pointer to the value.

Definition at line 565 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE const T * Color4< T >::getValue ( ) const
inline

Return raw pointer to the value.

Definition at line 572 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::negate ( )
inline

Component-wise multiplication by -1.

Definition at line 638 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Color4< T >::operator!= ( const Color4< S > &  v) const
inline

Inequality.

Definition at line 588 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator* ( const Color4< T > &  v) const
inline

Component-wise multiplication.

Definition at line 671 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator* ( T  a) const
inline

Component-wise multiplication.

Definition at line 678 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator*= ( const Color4< T > &  v)
inline

Component-wise multiplication.

Definition at line 649 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator*= ( T  a)
inline

Component-wise multiplication.

Definition at line 660 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator+ ( const Color4< T > &  v) const
inline

Component-wise addition.

Definition at line 606 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator+= ( const Color4< T > &  v)
inline

Component-wise addition.

Definition at line 595 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator- ( const Color4< T > &  v) const
inline

Component-wise subtraction.

Definition at line 624 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator- ( ) const
inline

Component-wise multiplication by -1.

Definition at line 631 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator-= ( const Color4< T > &  v)
inline

Component-wise subtraction.

Definition at line 613 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator/ ( const Color4< T > &  v) const
inline

Component-wise division.

Definition at line 707 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color4< T > Color4< T >::operator/ ( T  a) const
inline

Component-wise division.

Definition at line 714 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator/= ( const Color4< T > &  v)
inline

Component-wise division.

Definition at line 685 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator/= ( T  a)
inline

Component-wise division.

Definition at line 696 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4< T > & Color4< T >::operator= ( const Color4< T > &  v)
inline

Assignment.

Definition at line 510 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr bool Color4< T >::operator== ( const Color4< S > &  v) const
inline

Equality.

Definition at line 580 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE T & Color4< T >::operator[] ( int  i)
inline

Component-wise value.

Definition at line 456 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE const T & Color4< T >::operator[] ( int  i) const
inline

Component-wise value.

Definition at line 463 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Color4< T >::setValue ( S  a,
S  b,
S  c,
S  d 
)
inline

Set the value.

Definition at line 522 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE void Color4< T >::setValue ( const Color4< S > &  v)
inline

Set the value.

Definition at line 533 of file ImathColor.h.

Member Data Documentation

template<class T>
T Color4< T >::a

Definition at line 123 of file ImathColor.h.

template<class T>
T Color4< T >::b

Definition at line 123 of file ImathColor.h.

template<class T>
T Color4< T >::g

Definition at line 123 of file ImathColor.h.

template<class T>
T Color4< T >::r

Definition at line 123 of file ImathColor.h.


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