SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::Palette Struct Reference

A set of indexed colors representing a palette. More...

Inheritance diagram for SDL::Palette:
[legend]

Public Member Functions

constexpr Palette (PaletteRaw resource) noexcept
 Constructs from raw Palette.
constexpr Palette (const Palette &other)
 Copy constructor.
constexpr Palette (Palette &&other) noexcept
 Move constructor.
 Palette (int ncolors)
 Create a palette structure with the specified number of color entries.
constexpr operator PaletteConstRef () const noexcept
 Converts to PaletteConstRef.
 ~Palette ()
 Destructor.
constexpr Paletteoperator= (Palette &&other) noexcept
 Assignment operator.
Paletteoperator= (const Palette &other)
 Assignment operator.
void Destroy ()
 Free a palette created with CreatePalette().
constexpr const ColorRawdata () const
 Access specific pallete colors.
constexpr int size () const
 Returns number of colors in the palette.
constexpr ColorRaw operator[] (int index) const
 Access specific pallete index.
constexpr PaletteIndex operator[] (int index)
 Change specific pallete index.
void SetColors (SpanRef< const ColorRaw > colors, int firstcolor=0)
 Set a range of colors in a palette.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< PaletteRaw, PaletteRawConst >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Static Public Member Functions

static Palette Borrow (PaletteRaw resource)
 Safely borrows the from PaletteRaw.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< PaletteRaw, PaletteRawConst >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

A set of indexed colors representing a palette.

Since
This struct is available since SDL 3.2.0.
See also
Palette.SetColors
Category:
Resource

Constructor & Destructor Documentation

◆ Palette()

SDL::Palette::Palette ( PaletteRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Palette.

Parameters
resourcea PaletteRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

Member Function Documentation

◆ Borrow()

Palette SDL::Palette::Borrow ( PaletteRaw resource)
inlinestatic

Safely borrows the from PaletteRaw.

Parameters
resourcea PaletteRaw.

This does not takes ownership!


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