#pragma section-numbers off #pragma camelcase off || DRAFT|| ##*^*^*^*^*See http://wiki.libsdl.org/moin.cgi/SGFunctions for details on editing this page*^*^*^*^* = SDL_CreateRGBSurfaceWithFormat = Use this function to allocate an RGB surface. <> == Syntax == {{{#!highlight cpp SDL_Surface* SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, Uint32 format) }}} == Function Parameters == ||'''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|| ||'''format'''||the [[SDL_PixelFormatEnum|pixel format]] of the surface to create|| == Return Value == Returns a new [[SDL_Surface]] on success or NULL on failure; call [[SDL_GetError]]() for more information. == Code Examples == {{{#!highlight cpp /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order, as expected by OpenGL for textures */ SDL_Surface* surf; surf = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGBA32); if (surf == NULL) { SDL_Log("SDL_CreateRGBSurfaceWithFormat() failed: %s", SDL_GetError()); exit(1); } }}} == Remarks == If the function runs out of memory, it will return NULL. == Version == This function is available since SDL 2.0.5. == Related Functions == .[[SDL_CreateRGBSurface]] .[[SDL_CreateRGBSurfaceWithFormatFrom]] .[[SDL_FreeSurface]] ##Remove this section if empty ---- [[CategoryAPI]], [[CategorySurface]] ##See the Style Guide for instructions on editing the footer.