sdlAllocFormat function

Pointer<SdlPixelFormat> sdlAllocFormat(
  1. int pixelFormat
)

Create an SDL_PixelFormat structure corresponding to a pixel format.

Returned structure may come from a shared global cache (i.e. not newly allocated), and hence should not be modified, especially the palette. Weird errors such as Blit combination not supported may occur.

\param pixel_format one of the SDL_PixelFormatEnum values \returns the new SDL_PixelFormat structure or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_FreeFormat

extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format)

Implementation

Pointer<SdlPixelFormat> sdlAllocFormat(int pixelFormat) {
  final sdlAllocFormatLookupFunction = libSdl2.lookupFunction<
      Pointer<SdlPixelFormat> Function(Uint32 pixelFormat),
      Pointer<SdlPixelFormat> Function(int pixelFormat)>('SDL_AllocFormat');
  return sdlAllocFormatLookupFunction(pixelFormat);
}