sdlSetTexturePalette function render

bool sdlSetTexturePalette(
  1. Pointer<SdlTexture> texture,
  2. Pointer<SdlPalette> palette
)

Set the palette used by a texture.

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

A single palette can be shared with many textures.

\param texture the texture 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 should only be called on the main thread.

\since This function is available since SDL 3.4.0.

\sa SDL_CreatePalette \sa SDL_GetTexturePalette

extern SDL_DECLSPEC bool SDLCALL SDL_SetTexturePalette(SDL_Texture *texture, SDL_Palette *palette)

Implementation

bool sdlSetTexturePalette(
  Pointer<SdlTexture> texture,
  Pointer<SdlPalette> palette,
) {
  final sdlSetTexturePaletteLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlTexture> texture,
          Pointer<SdlPalette> palette,
        ),
        int Function(Pointer<SdlTexture> texture, Pointer<SdlPalette> palette)
      >('SDL_SetTexturePalette');
  return sdlSetTexturePaletteLookupFunction(texture, palette) == 1;
}