OpenTTD Source 20260206-master-g4d4e37dbf1
ColourRGBA Union Reference

Packed colour union to access the alpha, red, green, and blue channels from a 32 bit number for Emscripten build. More...

#include <gfx_type.h>

Public Member Functions

constexpr ColourRGBA (uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xFF)
 Create a new colour.
constexpr ColourRGBA (uint data=0)
 Create a new colour.
bool operator== (const ColourRGBA &other) const

Data Fields

uint32_t data
 Conversion of the channel information to a 32 bit number.
struct { 
   uint8_t   r 
   uint8_t   g 
   uint8_t   b 
   uint8_t   a 
 colour channels as used in browsers More...
}; 

Detailed Description

Packed colour union to access the alpha, red, green, and blue channels from a 32 bit number for Emscripten build.

Definition at line 165 of file gfx_type.h.

Constructor & Destructor Documentation

◆ ColourRGBA() [1/2]

ColourRGBA::ColourRGBA ( uint8_t r,
uint8_t g,
uint8_t b,
uint8_t a = 0xFF )
inlineconstexpr

Create a new colour.

Parameters
rThe channel for the red colour.
gThe channel for the green colour.
bThe channel for the blue colour.
aThe channel for the alpha/transparency.

Definition at line 178 of file gfx_type.h.

References a.

◆ ColourRGBA() [2/2]

ColourRGBA::ColourRGBA ( uint data = 0)
inlineconstexpr

Create a new colour.

Parameters
dataThe colour in the correct packed format.

Definition at line 184 of file gfx_type.h.

References data.

Member Function Documentation

◆ operator==()

bool ColourRGBA::operator== ( const ColourRGBA & other) const
inline

Definition at line 186 of file gfx_type.h.

Field Documentation

◆ a

uint8_t ColourRGBA::a

colour channels as used in browsers

Definition at line 168 of file gfx_type.h.

Referenced by ColourRGBA().

◆ b

uint8_t ColourRGBA::b

Definition at line 168 of file gfx_type.h.

◆ data

uint32_t ColourRGBA::data

Conversion of the channel information to a 32 bit number.

Definition at line 166 of file gfx_type.h.

Referenced by ColourRGBA().

◆ g

uint8_t ColourRGBA::g

Definition at line 168 of file gfx_type.h.

◆ r

uint8_t ColourRGBA::r

Definition at line 168 of file gfx_type.h.


The documentation for this union was generated from the following file: