setPalette method

bool setPalette(
  1. Pointer<SdlPalette> palette
)

Set the palette used by a surface.

Setting the palette keeps an internal reference to the palette, which can be safely destroyed afterwards.

A single palette can be shared with many surfaces.

\param surface the SDL_Surface structure to update. \param palette the SDL_Palette structure to use. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function is not thread safe.

\since This function is available since SDL 3.2.0.

\sa SDL_CreatePalette \sa SDL_GetSurfacePalette

extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)

{@category surface}

Implementation

bool setPalette(Pointer<SdlPalette> palette) =>
    sdlSetSurfacePalette(this, palette);