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

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

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

Public Member Functions

constexpr int GetSize () const
 Return the number of colors.
 
constexpr Color operator[] (int index) const
 Get the index color.
 
void SetColors (SpanRef< const SDL_Color > colors, int firstcolor=0)
 Set a range of colors in a palette.
 
constexpr Resource (T resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< T > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
- Public Member Functions inherited from SDL::Resource< SDL_Palette * >
constexpr Resource (SDL_Palette * resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< SDL_Palette * > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr operator value_type () const
 Converts back to underlying type.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_Palette * get () const
 Return contained resource;.
 
constexpr const SDL_Palette * operator-> () const
 Access to fields.
 
constexpr SDL_Palette * operator-> ()
 Access to fields.
 

Static Public Member Functions

static void reset (SDL_Palette *resource)
 Free a palette created with Palette.Create().
 

Additional Inherited Members

- Public Types inherited from SDL::Resource< SDL_Palette * >
using value_type = SDL_Palette *
 The raw resource type.
 

Detailed Description

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

Member Function Documentation

◆ reset()

static void SDL::PaletteRef::reset ( SDL_Palette *  resource)
inlinestatic
Parameters
resourcethe PaletteRef structure to be freed.
Thread safety:
It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
Since
This function is available since SDL 3.2.0.
See also
Palette.Create

◆ SetColors()

void SDL::PaletteRef::SetColors ( SpanRef< const SDL_Color >  colors,
int  firstcolor = 0 
)
inline
Parameters
colorsan array of Color structures to copy into the palette.
firstcolorthe index of the first palette entry to modify.
Exceptions
Erroron failure.
Thread safety:
It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.
Since
This function is available since SDL 3.2.0.

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