SDL Library Documentation
Prev |  | Next

# SDL_CreateRGBSurface

## Name

SDL_CreateRGBSurface -- Create an empty SDL_Surface

## Synopsis

    #include "SDL.h"

``SDL_Surface *SDL_CreateRGBSurface`(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);`

## Description

Allocate an empty surface (must be called after SDL_SetVideoMode)

If `depth` is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL_PixelFormat is created using the `[RGBA]mask`'s provided (see SDL_PixelFormat). The `flags` specifies the type of surface that should be created, it is an OR'd combination of the following possible values.

`SDL_SWSURFACE` | SDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
`SDL_HWSURFACE` | SDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
`SDL_SRCCOLORKEY` | With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware colorkey blitting support.
`SDL_SRCALPHA` | With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware alpha support

## See Also

`SDL_CreateRGBSurfaceFrom`, `SDL_FreeSurface`, `SDL_SetVideoMode`, `SDL_LockSurface`, SDL_PixelFormat, SDL_Surface

Prev | Home | Next
SDL_GetRGBA | Up | SDL_CreateRGBSurfaceFrom