SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SDL::Color Struct Reference

A structure that represents a color as RGBA components. More...

Inheritance diagram for SDL::Color:
Inheritance graph
[legend]
Collaboration diagram for SDL::Color:
Collaboration graph
[legend]

Public Member Functions

constexpr Color (ColorRaw color={}) noexcept
 Wraps Color. More...
 
constexpr Color (Uint8 r, Uint8 g, Uint8 b, Uint8 a=255) noexcept
 Constructs from its fields. More...
 
constexpr Uint8 GetR () const noexcept
 Get the red component from the color. More...
 
constexpr ColorSetR (Uint8 newR) noexcept
 Set the red component from the color. More...
 
constexpr Uint8 GetG () const noexcept
 Get the green component from the color. More...
 
constexpr ColorSetG (Uint8 newG) noexcept
 Set the green component from the color. More...
 
constexpr Uint8 GetB () const noexcept
 Get the blue component from the color. More...
 
constexpr ColorSetB (Uint8 newB) noexcept
 Set the blue component from the color. More...
 
constexpr Uint8 GetA () const noexcept
 Get the alpha component from the color. More...
 
constexpr ColorSetA (Uint8 newA) noexcept
 Set the alpha component from the color. More...
 
Uint32 Map (const PixelFormatDetails &format, PaletteConstParam palette) const
 Map an RGBA quadruple to a pixel value for a given pixel format. More...
 

Static Public Member Functions

static Color Get (Uint32 pixel, const PixelFormatDetails &format, PaletteConstParam palette)
 Get RGBA values from a pixel in the specified format. More...
 

Detailed Description

The bits of this structure can be directly reinterpreted as an integer-packed color which uses the PIXELFORMAT_RGBA32 format (PIXELFORMAT_ABGR8888 on little-endian systems and PIXELFORMAT_RGBA8888 on big-endian systems).

Since
This struct is available since SDL 3.2.0.
Category:
Wrap extending struct
See also
FColor

Constructor & Destructor Documentation

◆ Color() [1/2]

constexpr SDL::Color::Color ( ColorRaw  color = {})
inlineconstexprnoexcept
Parameters
colorthe value to be wrapped

◆ Color() [2/2]

constexpr SDL::Color::Color ( Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a = 255 
)
inlineconstexprnoexcept
Parameters
rthe value for channel r.
gthe value for channel g.
bthe value for channel b.
athe value for channel a.

Member Function Documentation

◆ GetA()

constexpr Uint8 SDL::Color::GetA ( ) const
inlineconstexprnoexcept
Returns
The alpha component from the color.

◆ GetB()

constexpr Uint8 SDL::Color::GetB ( ) const
inlineconstexprnoexcept
Returns
The blue component from the color.

◆ GetG()

constexpr Uint8 SDL::Color::GetG ( ) const
inlineconstexprnoexcept
Returns
The green component from the color.

◆ GetR()

constexpr Uint8 SDL::Color::GetR ( ) const
inlineconstexprnoexcept
Returns
The red component from the color.

◆ SetA()

constexpr Color & SDL::Color::SetA ( Uint8  newA)
inlineconstexprnoexcept
Parameters
newANew alpha component value.
Returns
Reference to self.

◆ SetB()

constexpr Color & SDL::Color::SetB ( Uint8  newB)
inlineconstexprnoexcept
Parameters
newBNew blue component value.
Returns
Reference to self.

◆ SetG()

constexpr Color & SDL::Color::SetG ( Uint8  newG)
inlineconstexprnoexcept
Parameters
newGNew green component value.
Returns
Reference to self.

◆ SetR()

constexpr Color & SDL::Color::SetR ( Uint8  newR)
inlineconstexprnoexcept
Parameters
newRNew red component value.
Returns
Reference to self.

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