pub unsafe extern "C" fn SDL_CreateRGBSurface(
    flags: u32,
    width: c_int,
    height: c_int,
    depth: c_int,
    Rmask: u32,
    Gmask: u32,
    Bmask: u32,
    Amask: u32
) -> *mut SDL_Surface
Expand description

Allocate a new RGB surface.

If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater than 8 bits, the pixel format is set using the flags [RGB]mask.

If the function runs out of memory, it will return NULL.

  • flags: The flags are obsolete and should be set to 0.
  • width: The width in pixels of the surface to create.
  • height: The height in pixels of the surface to create.
  • depth: The depth in bits of the surface to create.
  • Rmask: The red mask of the surface to create.
  • Gmask: The green mask of the surface to create.
  • Bmask: The blue mask of the surface to create.
  • Amask: The alpha mask of the surface to create.

Return: A new SDL_Surface, or NULL on error (call SDL_GetErrorMsg for more info).

Note: This actually uses SDL_MasksToPixelFormatEnum to determine a pixel format enum value, and then calls SDL_CreateRGBSurfaceWithFormat. If you already know the pixel format enum value, then you can use that function directly.