sdlSetSurfacePalette function surface

bool sdlSetSurfacePalette(
  1. Pointer<SdlSurface> surface,
  2. 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 can be called on different threads with different surfaces.

\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)

Implementation

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