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...
 
 ~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...
 
Color4 operator+ () const
 Unary plus of a vector. Returns the unaltered vector. More...
 
Color4operator+= (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...
 
Color4operator-= (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...
 
Color4operator*= (const Color4 &rhs)
 Component-wise multiplication of two vectors. More...
 
Color4operator*= (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...
 
Color4operator/= (const Color4 &rhs)
 Component-wise division of two vectors. More...
 
Color4operator/= (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 127 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 277 of file ImathColor.h.

Constructor & Destructor Documentation

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

No initialization by default.

Definition at line 526 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 532 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 538 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 549 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 559 of file ImathColor.h.

template<class T>
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 377 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 268 of file ImathColor.h.

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

Largest possible negative value.

Definition at line 250 of file ImathColor.h.

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

Largest possible positive value.

Definition at line 256 of file ImathColor.h.

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

Smallest possible positive value.

Definition at line 262 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 244 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 604 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 615 of file ImathColor.h.

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

Return raw pointer to the value.

Definition at line 625 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 632 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 698 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 648 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 731 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 738 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 709 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 720 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 666 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 655 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 684 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 691 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 673 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 767 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 774 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 745 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 756 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 570 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 640 of file ImathColor.h.

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

Component-wise value.

Definition at line 514 of file ImathColor.h.

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

Component-wise value.

Definition at line 521 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 582 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 593 of file ImathColor.h.

Member Data Documentation

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

Definition at line 133 of file ImathColor.h.

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

Definition at line 133 of file ImathColor.h.

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

Definition at line 133 of file ImathColor.h.

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

Definition at line 133 of file ImathColor.h.


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