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

Safe reference for Palette.

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

Public Member Functions

 PaletteRef (PaletteRaw resource) noexcept
 Constructs from PaletteRaw. More...
 
 PaletteRef (Palette resource) noexcept
 Constructs from Palette.
 
constexpr Palette (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr Palette (const PaletteRaw resource) noexcept
 Constructs from PaletteParam. More...
 
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. More...
 
- Public Member Functions inherited from SDL::Palette
constexpr Palette (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr Palette (const PaletteRaw resource) noexcept
 Constructs from PaletteParam. More...
 
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. More...
 
constexpr const PaletteRaw operator-> () const noexcept
 member access to underlying PaletteRaw.
 
constexpr PaletteRaw operator-> () noexcept
 member access to underlying PaletteRaw.
 
 ~Palette ()
 Destructor.
 
constexpr Paletteoperator= (Palette &&other) noexcept
 Assignment operator.
 
constexpr Paletteoperator= (const Palette &other) noexcept=default
 Assignment operator.
 
constexpr PaletteRaw get () const noexcept
 Retrieves underlying PaletteRaw.
 
constexpr PaletteRaw release () noexcept
 Retrieves underlying PaletteRaw and clear this.
 
constexpr auto operator<=> (const Palette &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
constexpr operator PaletteParam () const noexcept
 Converts to PaletteParam.
 
void Destroy ()
 Free a palette created with Palette.Palette(). More...
 
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.
 
void SetColors (SpanRef< const ColorRaw > colors, int firstcolor=0)
 Set a range of colors in a palette. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SDL::Palette
static constexpr Palette Borrow (PaletteParam resource)
 Safely borrows the from PaletteParam. More...
 

Constructor & Destructor Documentation

◆ PaletteRef()

SDL::PaletteRef::PaletteRef ( PaletteRaw  resource)
inlinenoexcept
Parameters
resourcea PaletteRaw.

This borrows the ownership, increments the refcount!

Member Function Documentation

◆ Palette() [1/2]

constexpr SDL::Palette::Palette ( const PaletteRaw  resource)
inlineexplicitconstexprnoexcept
Parameters
resourcea PaletteRaw to be wrapped.

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

◆ Palette() [2/2]

SDL::Palette::Palette ( int  ncolors)
inline

The palette entries are initialized to white.

Parameters
ncolorsrepresents the number of color entries in the color palette.
Postcondition
a new Palette structure on success.
Exceptions
Erroron failure.
Thread safety:
It is safe to call this function from any thread.
Since
This function is available since SDL 3.2.0.
See also
Palette.Destroy
Palette.SetColors
Surface.SetPalette

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