OpenTTD Source  20241120-master-g6d3adc6169
Colour Union Reference

Structure to access the alpha, red, green, and blue channels from a 32 bit number. More...

#include <gfx_type.h>

Public Member Functions

 Colour (uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xFF)
 Create a new colour. More...
 
 Colour (uint data=0)
 Create a new colour. More...
 

Data Fields

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

Detailed Description

Structure to access the alpha, red, green, and blue channels from a 32 bit number.

Definition at line 165 of file gfx_type.h.

Constructor & Destructor Documentation

◆ Colour() [1/2]

Colour::Colour ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 0xFF 
)
inline

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 184 of file gfx_type.h.

◆ Colour() [2/2]

Colour::Colour ( uint  data = 0)
inline

Create a new colour.

Parameters
dataThe colour in the correct packed format.

Definition at line 199 of file gfx_type.h.


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