Loading...
Searching...
No Matches
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.
| Rgba8 (Rgba8 &&)=default
| Default move constructor.
Rgba8 & | operator= (Rgba8 &&)=default
| Default move assignment operator.
Rgba8 & | operator= (const Rgba8 &)=default
| Default copy assignment operator.
| Rgba8 ()
| Default ctor initializes all channels to zero.
| 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
| Rgba8 (uint8_t v)
| ctor where all channels are initialized to the same value
| Rgba8 (float r, float g, float b, float a=1.0f)
| floating-point r,g,b,a ctor where alpha channel defaults to opaque
| Rgba8 (const Vec3f &rgb)
| Vec3f r,g,b ctor (alpha channel it set to 1)
| Rgba8 (const Vec4f &rgba)
| Vec4f r,g,b,a ctor.
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
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

## ValueType

using ValueType = uint8_t

## Constructor & Destructor Documentation

## Rgba8() [1/8]

Rgba8 | ( | const Rgba8 & |  | ) |

default

Default copy constructor.

## Rgba8() [2/8]

Rgba8 | ( | Rgba8 && |  | ) |

default

Default move constructor.

## Rgba8() [3/8]

Rgba8 | ( |  | ) |

inline

Default ctor initializes all channels to zero.

## Rgba8() [4/8]

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() [5/8]

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() [6/8]

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() [7/8]

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() [8/8]

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

## a() [1/2]

uint8_t & a | ( |  | ) |

inline

## a() [2/2]

const uint8_t & a | ( |  | ) | const

inline

## asFloat()

float asFloat | ( | int | n | ) | const

inline

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

## b() [1/2]

uint8_t & b | ( |  | ) |

inline

## b() [2/2]

const uint8_t & b | ( |  | ) | const

inline

## g() [1/2]

uint8_t & g | ( |  | ) |

inline

## g() [2/2]

const uint8_t & g | ( |  | ) | const

inline

## length()

float length | ( |  | ) | const

inline

## lengthSqr()

float lengthSqr | ( |  | ) | const

inline

## operator Vec3f()

operator Vec3f | ( |  | ) | const

inline

## operator Vec4f()

operator Vec4f | ( |  | ) | const

inline

## operator<()

bool operator< | ( | const Rgba8 & | rhs | ) | const

inline

## operator=() [1/2]

Rgba8 & operator= | ( | const Rgba8 & |  | ) |

default

Default copy assignment operator.

Returns
  non-const reference to this instance

## operator=() [2/2]

Rgba8 & operator= | ( | Rgba8 && |  | ) |

default

Default move assignment operator.

Returns
  non-const reference to this instance

## operator==()

bool operator== | ( | const Rgba8 & | rhs | ) | const

inline

## operator[]() [1/2]

uint8_t & operator[] | ( | int | n | ) |

inline

## operator[]() [2/2]

const uint8_t & operator[] | ( | int | n | ) | const

inline

## packed() [1/2]

uint32_t & packed | ( |  | ) |

inline

## packed() [2/2]

const uint32_t & packed | ( |  | ) | const

inline

## r() [1/2]

uint8_t & r | ( |  | ) |

inline

## r() [2/2]

const uint8_t & r | ( |  | ) | const

inline

## Member Data Documentation

## c

uint8_t c[4]

## packed

uint32_t packed

## SIZE

const int SIZE = 4

static