OpenVDB  11.0.0
Public Types | Public Member Functions | Static Public Attributes | List of all members
Rgba8 Class Reference

8-bit red, green, blue, alpha packed into 32 bit unsigned int More...

#include <nanovdb/NanoVDB.h>

Public Types

using ValueType = uint8_t
 

Public Member Functions

 Rgba8 (const Rgba8 &)=default
 Default copy constructor. More...
 
 Rgba8 (Rgba8 &&)=default
 Default move constructor. More...
 
Rgba8operator= (Rgba8 &&)=default
 Default move assignment operator. More...
 
Rgba8operator= (const Rgba8 &)=default
 Default copy assignment operator. More...
 
 Rgba8 ()
 Default ctor initializes all channels to zero. More...
 
 Rgba8 (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255u)
 integer r,g,b,a ctor where alpha channel defaults to opaque More...
 
 Rgba8 (uint8_t v)
 ctor where all channels are initialized to the same value More...
 
 Rgba8 (float r, float g, float b, float a=1.0f)
 floating-point r,g,b,a ctor where alpha channel defaults to opaque More...
 
 Rgba8 (const Vec3f &rgb)
 Vec3f r,g,b ctor (alpha channel it set to 1) More...
 
 Rgba8 (const Vec4f &rgba)
 Vec4f r,g,b,a ctor. More...
 
bool operator< (const Rgba8 &rhs) const
 
bool operator== (const Rgba8 &rhs) const
 
float lengthSqr () const
 
float length () const
 
float asFloat (int n) const
 return n'th color channel as a float in the range 0 to 1 More...
 
const uint8_t & operator[] (int n) const
 
uint8_t & operator[] (int n)
 
const uint32_t & packed () const
 
uint32_t & packed ()
 
const uint8_t & r () const
 
const uint8_t & g () const
 
const uint8_t & b () const
 
const uint8_t & a () const
 
uint8_t & r ()
 
uint8_t & g ()
 
uint8_t & b ()
 
uint8_t & a ()
 
 operator Vec3f () const
 
 operator Vec4f () const
 

Static Public Attributes

static const int SIZE = 4
 

Detailed Description

8-bit red, green, blue, alpha packed into 32 bit unsigned int

Member Typedef Documentation

using ValueType = uint8_t

Constructor & Destructor Documentation

Rgba8 ( const Rgba8 )
default

Default copy constructor.

Rgba8 ( Rgba8 &&  )
default

Default move constructor.

Rgba8 ( )
inline

Default ctor initializes all channels to zero.

Rgba8 ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255u 
)
inline

integer r,g,b,a ctor where alpha channel defaults to opaque

Note
all values should be in the range 0u to 255u
Rgba8 ( uint8_t  v)
inlineexplicit

ctor where all channels are initialized to the same value

Note
value should be in the range 0u to 255u
Rgba8 ( float  r,
float  g,
float  b,
float  a = 1.0f 
)
inline

floating-point r,g,b,a ctor where alpha channel defaults to opaque

Note
all values should be in the range 0.0f to 1.0f
Rgba8 ( const Vec3f rgb)
inline

Vec3f r,g,b ctor (alpha channel it set to 1)

Note
all values should be in the range 0.0f to 1.0f
Rgba8 ( const Vec4f rgba)
inline

Vec4f r,g,b,a ctor.

Note
all values should be in the range 0.0f to 1.0f

Member Function Documentation

const uint8_t& a ( ) const
inline
uint8_t& a ( )
inline
float asFloat ( int  n) const
inline

return n'th color channel as a float in the range 0 to 1

const uint8_t& b ( ) const
inline
uint8_t& b ( )
inline
const uint8_t& g ( ) const
inline
uint8_t& g ( )
inline
float length ( ) const
inline
float lengthSqr ( ) const
inline
operator Vec3f ( ) const
inline
operator Vec4f ( ) const
inline
bool operator< ( const Rgba8 rhs) const
inline
Rgba8& operator= ( Rgba8 &&  )
default

Default move assignment operator.

Returns
non-const reference to this instance
Rgba8& operator= ( const Rgba8 )
default

Default copy assignment operator.

Returns
non-const reference to this instance
bool operator== ( const Rgba8 rhs) const
inline
const uint8_t& operator[] ( int  n) const
inline
uint8_t& operator[] ( int  n)
inline
const uint32_t& packed ( ) const
inline
uint32_t& packed ( )
inline
const uint8_t& r ( ) const
inline
uint8_t& r ( )
inline

Member Data Documentation

uint8_t c[4]
uint32_t packed
const int SIZE = 4
static