1 .TH "SDL_CreateRGBSurface" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference"
3 SDL_CreateRGBSurface\- Create an empty SDL_Surface
8 \fBSDL_Surface *\fBSDL_CreateRGBSurface\fP\fR(\fBUint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask\fR);
11 Allocate an empty surface (must be called after \fISDL_SetVideoMode\fR)
13 If \fBdepth\fR is 8 bits an empty palette is allocated for the surface, otherwise a \&'packed-pixel\&' \fI\fBSDL_PixelFormat\fR\fR is created using the \fB[RGBA]mask\fR\&'s provided (see \fI\fBSDL_PixelFormat\fR\fR)\&. The \fBflags\fR specifies the type of surface that should be created, it is an OR\&'d combination of the following possible values\&.
16 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\&.
19 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)\&.
22 This flag turns on colourkeying for blits from this surface\&. If \fBSDL_HWSURFACE\fP is also specified and colourkeyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory\&. Use \fI\fBSDL_SetColorKey\fP\fR to set or clear this flag after surface creation\&.
25 This flag turns on alpha-blending for blits from this surface\&. If \fBSDL_HWSURFACE\fP is also specified and alpha-blending blits are hardware-accelerated, then the surface will be placed in video memory if possible\&. Use \fI\fBSDL_SetAlpha\fP\fR to set or clear this flag after surface creation\&.
30 If an alpha-channel is specified (that is, if \fBAmask\fR is nonzero), then the \fBSDL_SRCALPHA\fP flag is automatically set\&. You may remove this flag by calling \fI\fBSDL_SetAlpha\fP\fR after surface creation\&.
34 Returns the created surface, or \fBNULL\fR upon error\&.
38 \f(CW /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order,
39 as expected by OpenGL for textures */
41 Uint32 rmask, gmask, bmask, amask;
43 /* SDL interprets each pixel as a 32-bit number, so our masks must depend
44 on the endianness (byte order) of the machine */
45 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
57 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
58 rmask, gmask, bmask, amask);
60 fprintf(stderr, "CreateRGBSurface failed: %s
68 \fI\fBSDL_CreateRGBSurfaceFrom\fP\fR, \fI\fBSDL_FreeSurface\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_Surface\fR\fR \fI\fBSDL_SetAlpha\fP\fR \fI\fBSDL_SetColorKey\fP\fR
69 ...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01