home *** CD-ROM | disk | FTP | other *** search
- <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
- <!-- available at http://polyglotman.sourceforge.net/ -->
-
- <html>
- <head>
- <title>"SDL_CreateRGBSurface"("3") manual page</title>
- </head>
- <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
- <a href='#toc'>Table of Contents</a><p>
-
- <h2><a name='sect0' href='#toc0'>Name</a></h2>
- SDL_CreateRGBSurface- Create an empty SDL_Surface
- <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
- <p>
- <b>#include "SDL.h"
- <p>
- </b><b>SDL_Surface *<b>SDL_CreateRGBSurface</b></b>(<b>Uint32 flags, int width, int height,
- int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask</b>);
- <h2><a name='sect2' href='#toc2'>Description</a></h2>
- <p>
- Allocate
- an empty surface (must be called after <i>SDL_SetVideoMode</i>) <p>
- If <b>depth</b> is 8
- bits an empty palette is allocated for the surface, otherwise a 'packed-pixel'
- <i><b>SDL_PixelFormat</b></i> is created using the <b>[RGBA]mask</b>'s provided (see <i><b>SDL_PixelFormat</b></i>).
- The <b>flags</b> specifies the type of surface that should be created, it is an
- OR'd combination of the following possible values.
- <dl>
-
- <dt><b>SDL_SWSURFACE</b> </dt>
- <dd>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. </dd>
-
- <dt><b>SDL_HWSURFACE</b> </dt>
- <dd>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). </dd>
-
- <dt><b>SDL_SRCCOLORKEY</b> </dt>
- <dd>This flag turns on colourkeying
- for blits from this surface. If <b>SDL_HWSURFACE</b> is also specified and colourkeyed
- blits are hardware-accelerated, then SDL will attempt to place the surface
- in video memory. Use <i><b>SDL_SetColorKey</b></i> to set or clear this flag after surface
- creation. </dd>
-
- <dt><b>SDL_SRCALPHA</b> </dt>
- <dd>This flag turns on alpha-blending for blits from this
- surface. If <b>SDL_HWSURFACE</b> is also specified and alpha-blending blits are
- hardware-accelerated, then the surface will be placed in video memory if
- possible. Use <i><b>SDL_SetAlpha</b></i> to set or clear this flag after surface creation.
- </dd>
- </dl>
- <p>
- <blockquote><b>Note: <p>
- If an alpha-channel is specified (that is, if <b>Amask</b></b> is nonzero),
- then the <b>SDL_SRCALPHA</b> flag is automatically set. You may remove this flag
- by calling <i><b>SDL_SetAlpha</b></i> after surface creation. </blockquote>
-
- <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
- <p>
- Returns the
- created surface, or <b>NULL</b> upon error.
- <h2><a name='sect4' href='#toc4'>Example</a></h2>
- <p>
- <br>
- <pre>CW /* 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 *surface;
- Uint32 rmask, gmask, bmask, amask;
- /* SDL interprets each pixel as a 32-bit number, so our masks must depend
- on the endianness (byte order) of the machine */
- #if SDL_BYTEORDER == SDL_BIG_ENDIAN
- rmask = 0xff000000;
- gmask = 0x00ff0000;
- bmask = 0x0000ff00;
- amask = 0x000000ff;
- #else
- rmask = 0x000000ff;
- gmask = 0x0000ff00;
- bmask = 0x00ff0000;
- amask = 0xff000000;
- #endif
- surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
- rmask, gmask, bmask, amask);
- if(surface == NULL) {
- fprintf(stderr, "CreateRGBSurface failed: %s
- ", SDL_GetError());
- exit(1);
- }
- </pre><p>
-
- <h2><a name='sect5' href='#toc5'>See Also</a></h2>
- <p>
- <i><b>SDL_CreateRGBSurfaceFrom</b></i>, <i><b>SDL_FreeSurface</b></i>, <i><b>SDL_SetVideoMode</b></i>, <i><b>SDL_LockSurface</b></i>,
- <i><b>SDL_PixelFormat</b></i>, <i><b>SDL_Surface</b></i> <i><b>SDL_SetAlpha</b></i> <i><b>SDL_SetColorKey</b></i>
- <!--
-
- <p>
-
- <hr><p>
- <a name='toc'><b>Table of Contents</b></a><p>
- <ul>
- <li><a name='toc0' href='#sect0'>Name</a></li>
- <li><a name='toc1' href='#sect1'>Synopsis</a></li>
- <li><a name='toc2' href='#sect2'>Description</a></li>
- <li><a name='toc3' href='#sect3'>Return Value</a></li>
- <li><a name='toc4' href='#sect4'>Example</a></li>
- <li><a name='toc5' href='#sect5'>See Also</a></li>
- </ul>
- </body>
- </html>
-