sdlSetSurfacePalette function

bool sdlSetSurfacePalette(
  1. Pointer<SdlSurface> surface,
  2. Pointer<SdlPalette> palette
)

Set the palette used by a surface.

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.

\since This function is available since SDL 3.1.3.

\sa SDL_CreatePalette \sa SDL_GetSurfacePalette

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

Implementation

bool sdlSetSurfacePalette(
    Pointer<SdlSurface> surface, Pointer<SdlPalette> palette) {
  final sdlSetSurfacePaletteLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlSurface> surface, Pointer<SdlPalette> palette),
      int Function(Pointer<SdlSurface> surface,
          Pointer<SdlPalette> palette)>('SDL_SetSurfacePalette');
  return sdlSetSurfacePaletteLookupFunction(surface, palette) == 1;
}