OpenTTD Source: Colour Union Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Data Fields
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.
| Colour (uint data=0)
| Create a new colour.

## Data Fields
uint32_t | data
| Conversion of the channel information to a 32 bit number.
struct { |
uint8_t a |
uint8_t r |
uint8_t g |
uint8_t b |
| colour channels in BE order More...
}; |  |

## 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

  r | The channel for the red colour.
  g | The channel for the green colour.
  b | The channel for the blue colour.
  a | The 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

  data | The colour in the correct packed format.

Definition at line 199 of file gfx_type.h.

## Field Documentation

## ◆ a

uint8_t Colour::a

Definition at line 171 of file gfx_type.h.

## ◆ b

uint8_t Colour::b

colour channels in BE order

Definition at line 171 of file gfx_type.h.

Referenced by CalculateColourDistance(), Blitter_32bppBase::ComposeColourPANoCheck(), Blitter_32bppBase::ComposeColourRGBANoCheck(), Blitter_32bppOptimized::Draw(), Blitter_40bppAnim::Draw(), Blitter_32bppSimple::Encode(), GetContrastColour(), MakeBMPImage(), Blitter_32bppBase::MakeDark(), Blitter_32bppBase::MakeGrey(), MakeHeightmapScreenshot(), MakePCXImage(), MakePNGImage(), Blitter_32bppBase::MakeTransparent(), and OpenGLSprite::Update().

## ◆ data

uint32_t Colour::data

Conversion of the channel information to a 32 bit number.

Definition at line 166 of file gfx_type.h.

Referenced by Blitter_40bppAnim::CopyImageToBuffer(), Blitter_32bppOptimized::Draw(), Blitter_40bppAnim::Draw(), DrawSpriteToRgbaBuffer(), MakeBMPImage(), and OpenGLBackend::Resize().

## ◆ g

uint8_t Colour::g

Definition at line 171 of file gfx_type.h.

## ◆ r

uint8_t Colour::r

Definition at line 171 of file gfx_type.h.

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

- src/gfx_type.h