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.
 ~Palette ()
 Destructor.
constexpr Paletteoperator= (Palette &&other) noexcept
 Assignment operator.
Paletteoperator= (const Palette &other)
 Assignment operator.
Public Member Functions inherited from SDL::PaletteBase
constexpr operator PaletteConstRef () const noexcept
 Converts to PaletteConstRef.
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 ResourceBaseT ()=default
 Default constructor, creates null/invalid resource.
constexpr ResourceBaseT (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBaseT (std::nullptr_t)
 Constructs null/invalid.
constexpr ResourceBaseT (const ResourceBaseT &)=default
 Copy constructor.
constexpr ResourceBaseT (ResourceBaseT &&) noexcept=default
 Move constructor.
Public Member Functions inherited from SDL::ResourceBaseT< PaletteRaw, PaletteRawConst >
constexpr ResourceBaseT ()=default
 Default constructor, creates null/invalid resource.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBaseT &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::ResourceBaseT< PaletteRaw, PaletteRawConst >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.
Protected Member Functions inherited from SDL::ResourceBaseT< PaletteRaw, PaletteRawConst >
constexpr ~ResourceBaseT ()=default
 Destructor.
constexpr ResourceBaseToperator= (const ResourceBaseT &)=default
 Assignment operator.

Detailed Description

A set of indexed colors representing a palette.

Since
This struct is available since SDL 3.2.0.
See also
SetPaletteColors
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: