MapLink Pro .
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
envitia::win_colorref Struct Reference

RGB colour stored as a 32-bit value with red in the least significant byte. More...

Detailed Description

RGB colour stored as a 32-bit value with red in the least significant byte.

Public Member Functions

constexpr win_colorref ()=default
 Construct black (all channels zero).
constexpr win_colorref (uint32_t v) noexcept
 Construct from a packed RGB value, discarding the high byte.
constexpr win_colorref (unsigned char R, unsigned char G, unsigned char B) noexcept
 Construct from 8-bit red, green and blue components.
constexpr win_colorref (double R, double G, double B) noexcept
 Construct from unit-range red, green and blue components.
constexpr unsigned char r () const noexcept
 Get the 8-bit red component.
constexpr unsigned char g () const noexcept
 Get the 8-bit green component.
constexpr unsigned char b () const noexcept
 Get the 8-bit blue component.
constexpr double r_d () const noexcept
 Get the red component in the range 0 to 1.
constexpr double g_d () const noexcept
 Get the green component in the range 0 to 1.
constexpr double b_d () const noexcept
 Get the blue component in the range 0 to 1.
constexpr std::uint32_t u32 () const noexcept
 Get the packed RGB value.

Static Public Member Functions

static constexpr unsigned char d_u8 (double v) noexcept
 Convert a unit-range colour component to an 8-bit component.

Constructor & Destructor Documentation

◆ win_colorref() [1/4]

envitia::win_colorref::win_colorref ( )
constexprdefault

Construct black (all channels zero).

◆ win_colorref() [2/4]

envitia::win_colorref::win_colorref ( uint32_t v)
inlineexplicitconstexprnoexcept

Construct from a packed RGB value, discarding the high byte.

Parameters
vPacked colour value.

◆ win_colorref() [3/4]

envitia::win_colorref::win_colorref ( unsigned char R,
unsigned char G,
unsigned char B )
inlineconstexprnoexcept

Construct from 8-bit red, green and blue components.

Parameters
RRed component.
GGreen component.
BBlue component.

◆ win_colorref() [4/4]

envitia::win_colorref::win_colorref ( double R,
double G,
double B )
inlineconstexprnoexcept

Construct from unit-range red, green and blue components.

Parameters
RRed component in the range 0 to 1.
GGreen component in the range 0 to 1.
BBlue component in the range 0 to 1.

Member Function Documentation

◆ b()

unsigned char envitia::win_colorref::b ( ) const
inlineconstexprnoexcept

Get the 8-bit blue component.

Returns
The blue component in the range 0 to 255.

◆ b_d()

double envitia::win_colorref::b_d ( ) const
inlineconstexprnoexcept

Get the blue component in the range 0 to 1.

Returns
The normalized blue component.

◆ d_u8()

constexpr unsigned char envitia::win_colorref::d_u8 ( double v)
inlinestaticconstexprnoexcept

Convert a unit-range colour component to an 8-bit component.

Parameters
vComponent value in the range 0 to 1.
Returns
The component scaled to an unsigned 8-bit value.

◆ g()

unsigned char envitia::win_colorref::g ( ) const
inlineconstexprnoexcept

Get the 8-bit green component.

Returns
The green component in the range 0 to 255.

◆ g_d()

double envitia::win_colorref::g_d ( ) const
inlineconstexprnoexcept

Get the green component in the range 0 to 1.

Returns
The normalized green component.

◆ r()

unsigned char envitia::win_colorref::r ( ) const
inlineconstexprnoexcept

Get the 8-bit red component.

Returns
The red component in the range 0 to 255.

◆ r_d()

double envitia::win_colorref::r_d ( ) const
inlineconstexprnoexcept

Get the red component in the range 0 to 1.

Returns
The normalized red component.

◆ u32()

std::uint32_t envitia::win_colorref::u32 ( ) const
inlineconstexprnoexcept

Get the packed RGB value.

Returns
The packed colour value with red in the least significant byte.