sdlCreateSurface function

Pointer<SdlSurface> sdlCreateSurface(
  1. int width,
  2. int height,
  3. int format
)

Allocate a new surface with a specific pixel format.

The pixels of the new surface are initialized to zero.

\param width the width of the surface. \param height the height of the surface. \param format the SDL_PixelFormat for the new surface's pixel format. \returns the new SDL_Surface structure that is created or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_CreateSurfaceFrom \sa SDL_DestroySurface

extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormat format)

Implementation

Pointer<SdlSurface> sdlCreateSurface(int width, int height, int format) {
  final sdlCreateSurfaceLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlSurface> Function(Int32 width, Int32 height, Int32 format),
      Pointer<SdlSurface> Function(
          int width, int height, int format)>('SDL_CreateSurface');
  return sdlCreateSurfaceLookupFunction(width, height, format);
}