sdlCreatePalette function

Pointer<SdlPalette> sdlCreatePalette(
  1. int ncolors
)

Create a palette structure with the specified number of color entries.

The palette entries are initialized to white.

\param ncolors represents the number of color entries in the color palette. \returns a new SDL_Palette structure on success or NULL on failure (e.g. if there wasn't enough memory); call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_DestroyPalette \sa SDL_SetPaletteColors \sa SDL_SetSurfacePalette

extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors)

Implementation

Pointer<SdlPalette> sdlCreatePalette(int ncolors) {
  final sdlCreatePaletteLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlPalette> Function(Int32 ncolors),
      Pointer<SdlPalette> Function(int ncolors)>('SDL_CreatePalette');
  return sdlCreatePaletteLookupFunction(ncolors);
}