docs/html/sdlcreatergbsurface.html
changeset 3352 6dc250ebdd80
parent 3351 8e0182c236d8
child 3353 6b14223dd5c7
     1.1 --- a/docs/html/sdlcreatergbsurface.html	Wed Oct 07 06:11:53 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,458 +0,0 @@
     1.4 -<HTML
     1.5 -><HEAD
     1.6 -><TITLE
     1.7 ->SDL_CreateRGBSurface</TITLE
     1.8 -><META
     1.9 -NAME="GENERATOR"
    1.10 -CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
    1.11 -"><LINK
    1.12 -REL="HOME"
    1.13 -TITLE="SDL Library Documentation"
    1.14 -HREF="index.html"><LINK
    1.15 -REL="UP"
    1.16 -TITLE="Video"
    1.17 -HREF="video.html"><LINK
    1.18 -REL="PREVIOUS"
    1.19 -TITLE="SDL_GetRGBA"
    1.20 -HREF="sdlgetrgba.html"><LINK
    1.21 -REL="NEXT"
    1.22 -TITLE="SDL_CreateRGBSurfaceFrom"
    1.23 -HREF="sdlcreatergbsurfacefrom.html"></HEAD
    1.24 -><BODY
    1.25 -CLASS="REFENTRY"
    1.26 -BGCOLOR="#FFF8DC"
    1.27 -TEXT="#000000"
    1.28 -LINK="#0000ee"
    1.29 -VLINK="#551a8b"
    1.30 -ALINK="#ff0000"
    1.31 -><DIV
    1.32 -CLASS="NAVHEADER"
    1.33 -><TABLE
    1.34 -SUMMARY="Header navigation table"
    1.35 -WIDTH="100%"
    1.36 -BORDER="0"
    1.37 -CELLPADDING="0"
    1.38 -CELLSPACING="0"
    1.39 -><TR
    1.40 -><TH
    1.41 -COLSPAN="3"
    1.42 -ALIGN="center"
    1.43 ->SDL Library Documentation</TH
    1.44 -></TR
    1.45 -><TR
    1.46 -><TD
    1.47 -WIDTH="10%"
    1.48 -ALIGN="left"
    1.49 -VALIGN="bottom"
    1.50 -><A
    1.51 -HREF="sdlgetrgba.html"
    1.52 -ACCESSKEY="P"
    1.53 ->Prev</A
    1.54 -></TD
    1.55 -><TD
    1.56 -WIDTH="80%"
    1.57 -ALIGN="center"
    1.58 -VALIGN="bottom"
    1.59 -></TD
    1.60 -><TD
    1.61 -WIDTH="10%"
    1.62 -ALIGN="right"
    1.63 -VALIGN="bottom"
    1.64 -><A
    1.65 -HREF="sdlcreatergbsurfacefrom.html"
    1.66 -ACCESSKEY="N"
    1.67 ->Next</A
    1.68 -></TD
    1.69 -></TR
    1.70 -></TABLE
    1.71 -><HR
    1.72 -ALIGN="LEFT"
    1.73 -WIDTH="100%"></DIV
    1.74 -><H1
    1.75 -><A
    1.76 -NAME="SDLCREATERGBSURFACE"
    1.77 -></A
    1.78 ->SDL_CreateRGBSurface</H1
    1.79 -><DIV
    1.80 -CLASS="REFNAMEDIV"
    1.81 -><A
    1.82 -NAME="AEN1773"
    1.83 -></A
    1.84 -><H2
    1.85 ->Name</H2
    1.86 ->SDL_CreateRGBSurface&nbsp;--&nbsp;Create an empty SDL_Surface</DIV
    1.87 -><DIV
    1.88 -CLASS="REFSYNOPSISDIV"
    1.89 -><A
    1.90 -NAME="AEN1776"
    1.91 -></A
    1.92 -><H2
    1.93 ->Synopsis</H2
    1.94 -><DIV
    1.95 -CLASS="FUNCSYNOPSIS"
    1.96 -><A
    1.97 -NAME="AEN1777"
    1.98 -></A
    1.99 -><P
   1.100 -></P
   1.101 -><PRE
   1.102 -CLASS="FUNCSYNOPSISINFO"
   1.103 ->#include "SDL.h"</PRE
   1.104 -><P
   1.105 -><CODE
   1.106 -><CODE
   1.107 -CLASS="FUNCDEF"
   1.108 ->SDL_Surface *<B
   1.109 -CLASS="FSFUNC"
   1.110 ->SDL_CreateRGBSurface</B
   1.111 -></CODE
   1.112 ->(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);</CODE
   1.113 -></P
   1.114 -><P
   1.115 -></P
   1.116 -></DIV
   1.117 -></DIV
   1.118 -><DIV
   1.119 -CLASS="REFSECT1"
   1.120 -><A
   1.121 -NAME="AEN1783"
   1.122 -></A
   1.123 -><H2
   1.124 ->Description</H2
   1.125 -><P
   1.126 ->Allocate an empty surface (must be called after <A
   1.127 -HREF="sdlsetvideomode.html"
   1.128 ->SDL_SetVideoMode</A
   1.129 ->)</P
   1.130 -><P
   1.131 ->If <TT
   1.132 -CLASS="PARAMETER"
   1.133 -><I
   1.134 ->depth</I
   1.135 -></TT
   1.136 -> is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' <A
   1.137 -HREF="sdlpixelformat.html"
   1.138 -><SPAN
   1.139 -CLASS="STRUCTNAME"
   1.140 ->SDL_PixelFormat</SPAN
   1.141 -></A
   1.142 -> is created using the <TT
   1.143 -CLASS="PARAMETER"
   1.144 -><I
   1.145 ->[RGBA]mask</I
   1.146 -></TT
   1.147 ->'s provided (see <A
   1.148 -HREF="sdlpixelformat.html"
   1.149 -><SPAN
   1.150 -CLASS="STRUCTNAME"
   1.151 ->SDL_PixelFormat</SPAN
   1.152 -></A
   1.153 ->). The <TT
   1.154 -CLASS="PARAMETER"
   1.155 -><I
   1.156 ->flags</I
   1.157 -></TT
   1.158 -> specifies the type of surface that should be created, it is an OR'd combination of the following possible values.</P
   1.159 -><DIV
   1.160 -CLASS="INFORMALTABLE"
   1.161 -><A
   1.162 -NAME="AEN1795"
   1.163 -></A
   1.164 -><P
   1.165 -></P
   1.166 -><TABLE
   1.167 -BORDER="1"
   1.168 -CLASS="CALSTABLE"
   1.169 -><TBODY
   1.170 -><TR
   1.171 -><TD
   1.172 -ALIGN="LEFT"
   1.173 -VALIGN="TOP"
   1.174 -><TT
   1.175 -CLASS="LITERAL"
   1.176 ->SDL_SWSURFACE</TT
   1.177 -></TD
   1.178 -><TD
   1.179 -ALIGN="LEFT"
   1.180 -VALIGN="TOP"
   1.181 ->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.</TD
   1.182 -></TR
   1.183 -><TR
   1.184 -><TD
   1.185 -ALIGN="LEFT"
   1.186 -VALIGN="TOP"
   1.187 -><TT
   1.188 -CLASS="LITERAL"
   1.189 ->SDL_HWSURFACE</TT
   1.190 -></TD
   1.191 -><TD
   1.192 -ALIGN="LEFT"
   1.193 -VALIGN="TOP"
   1.194 ->SDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video-&#62;Video blits (which are often accelerated).</TD
   1.195 -></TR
   1.196 -><TR
   1.197 -><TD
   1.198 -ALIGN="LEFT"
   1.199 -VALIGN="TOP"
   1.200 -><TT
   1.201 -CLASS="LITERAL"
   1.202 ->SDL_SRCCOLORKEY</TT
   1.203 -></TD
   1.204 -><TD
   1.205 -ALIGN="LEFT"
   1.206 -VALIGN="TOP"
   1.207 ->This flag turns on colourkeying for blits from this surface. If
   1.208 -<TT
   1.209 -CLASS="LITERAL"
   1.210 ->SDL_HWSURFACE</TT
   1.211 -> is also specified and colourkeyed blits
   1.212 -are hardware-accelerated, then SDL will attempt to place the surface in
   1.213 -video memory.
   1.214 -Use <A
   1.215 -HREF="sdlsetcolorkey.html"
   1.216 -><TT
   1.217 -CLASS="FUNCTION"
   1.218 ->SDL_SetColorKey</TT
   1.219 -></A
   1.220 ->
   1.221 -to set or clear this flag after surface creation.</TD
   1.222 -></TR
   1.223 -><TR
   1.224 -><TD
   1.225 -ALIGN="LEFT"
   1.226 -VALIGN="TOP"
   1.227 -><TT
   1.228 -CLASS="LITERAL"
   1.229 ->SDL_SRCALPHA</TT
   1.230 -></TD
   1.231 -><TD
   1.232 -ALIGN="LEFT"
   1.233 -VALIGN="TOP"
   1.234 ->This flag turns on alpha-blending for blits from this surface. If
   1.235 -<TT
   1.236 -CLASS="LITERAL"
   1.237 ->SDL_HWSURFACE</TT
   1.238 -> is also specified and alpha-blending blits
   1.239 -are hardware-accelerated, then the surface will be placed in video memory if
   1.240 -possible.
   1.241 -Use <A
   1.242 -HREF="sdlsetalpha.html"
   1.243 -><TT
   1.244 -CLASS="FUNCTION"
   1.245 ->SDL_SetAlpha</TT
   1.246 -></A
   1.247 -> to
   1.248 -set or clear this flag after surface creation.</TD
   1.249 -></TR
   1.250 -></TBODY
   1.251 -></TABLE
   1.252 -><P
   1.253 -></P
   1.254 -></DIV
   1.255 -><DIV
   1.256 -CLASS="NOTE"
   1.257 -><BLOCKQUOTE
   1.258 -CLASS="NOTE"
   1.259 -><P
   1.260 -><B
   1.261 ->Note: </B
   1.262 ->If an alpha-channel is specified (that is, if <TT
   1.263 -CLASS="PARAMETER"
   1.264 -><I
   1.265 ->Amask</I
   1.266 -></TT
   1.267 -> is
   1.268 -nonzero), then the <TT
   1.269 -CLASS="LITERAL"
   1.270 ->SDL_SRCALPHA</TT
   1.271 -> flag is automatically
   1.272 -set. You may remove this flag by calling 
   1.273 -<A
   1.274 -HREF="sdlsetalpha.html"
   1.275 -><TT
   1.276 -CLASS="FUNCTION"
   1.277 ->SDL_SetAlpha</TT
   1.278 -></A
   1.279 ->
   1.280 -after surface creation.</P
   1.281 -></BLOCKQUOTE
   1.282 -></DIV
   1.283 -></DIV
   1.284 -><DIV
   1.285 -CLASS="REFSECT1"
   1.286 -><A
   1.287 -NAME="AEN1826"
   1.288 -></A
   1.289 -><H2
   1.290 ->Return Value</H2
   1.291 -><P
   1.292 ->Returns the created surface, or <SPAN
   1.293 -CLASS="RETURNVALUE"
   1.294 ->NULL</SPAN
   1.295 -> upon error.</P
   1.296 -></DIV
   1.297 -><DIV
   1.298 -CLASS="REFSECT1"
   1.299 -><A
   1.300 -NAME="AEN1830"
   1.301 -></A
   1.302 -><H2
   1.303 ->Example</H2
   1.304 -><PRE
   1.305 -CLASS="PROGRAMLISTING"
   1.306 ->    /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order,
   1.307 -       as expected by OpenGL for textures */
   1.308 -    SDL_Surface *surface;
   1.309 -    Uint32 rmask, gmask, bmask, amask;
   1.310 -
   1.311 -    /* SDL interprets each pixel as a 32-bit number, so our masks must depend
   1.312 -       on the endianness (byte order) of the machine */
   1.313 -#if SDL_BYTEORDER == SDL_BIG_ENDIAN
   1.314 -    rmask = 0xff000000;
   1.315 -    gmask = 0x00ff0000;
   1.316 -    bmask = 0x0000ff00;
   1.317 -    amask = 0x000000ff;
   1.318 -#else
   1.319 -    rmask = 0x000000ff;
   1.320 -    gmask = 0x0000ff00;
   1.321 -    bmask = 0x00ff0000;
   1.322 -    amask = 0xff000000;
   1.323 -#endif
   1.324 -
   1.325 -    surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
   1.326 -                                   rmask, gmask, bmask, amask);
   1.327 -    if(surface == NULL) {
   1.328 -        fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError());
   1.329 -        exit(1);
   1.330 -    }</PRE
   1.331 -></DIV
   1.332 -><DIV
   1.333 -CLASS="REFSECT1"
   1.334 -><A
   1.335 -NAME="AEN1833"
   1.336 -></A
   1.337 -><H2
   1.338 ->See Also</H2
   1.339 -><P
   1.340 -><A
   1.341 -HREF="sdlcreatergbsurfacefrom.html"
   1.342 -><TT
   1.343 -CLASS="FUNCTION"
   1.344 ->SDL_CreateRGBSurfaceFrom</TT
   1.345 -></A
   1.346 ->,
   1.347 -<A
   1.348 -HREF="sdlfreesurface.html"
   1.349 -><TT
   1.350 -CLASS="FUNCTION"
   1.351 ->SDL_FreeSurface</TT
   1.352 -></A
   1.353 ->,
   1.354 -<A
   1.355 -HREF="sdlsetvideomode.html"
   1.356 -><TT
   1.357 -CLASS="FUNCTION"
   1.358 ->SDL_SetVideoMode</TT
   1.359 -></A
   1.360 ->,
   1.361 -<A
   1.362 -HREF="sdllocksurface.html"
   1.363 -><TT
   1.364 -CLASS="FUNCTION"
   1.365 ->SDL_LockSurface</TT
   1.366 -></A
   1.367 ->,
   1.368 -<A
   1.369 -HREF="sdlpixelformat.html"
   1.370 -><SPAN
   1.371 -CLASS="STRUCTNAME"
   1.372 ->SDL_PixelFormat</SPAN
   1.373 -></A
   1.374 ->,
   1.375 -<A
   1.376 -HREF="sdlsurface.html"
   1.377 -><SPAN
   1.378 -CLASS="STRUCTNAME"
   1.379 ->SDL_Surface</SPAN
   1.380 -></A
   1.381 ->
   1.382 -<A
   1.383 -HREF="sdlsetalpha.html"
   1.384 -><TT
   1.385 -CLASS="FUNCTION"
   1.386 ->SDL_SetAlpha</TT
   1.387 -></A
   1.388 ->
   1.389 -<A
   1.390 -HREF="sdlsetcolorkey.html"
   1.391 -><TT
   1.392 -CLASS="FUNCTION"
   1.393 ->SDL_SetColorKey</TT
   1.394 -></A
   1.395 -></P
   1.396 -></DIV
   1.397 -><DIV
   1.398 -CLASS="NAVFOOTER"
   1.399 -><HR
   1.400 -ALIGN="LEFT"
   1.401 -WIDTH="100%"><TABLE
   1.402 -SUMMARY="Footer navigation table"
   1.403 -WIDTH="100%"
   1.404 -BORDER="0"
   1.405 -CELLPADDING="0"
   1.406 -CELLSPACING="0"
   1.407 -><TR
   1.408 -><TD
   1.409 -WIDTH="33%"
   1.410 -ALIGN="left"
   1.411 -VALIGN="top"
   1.412 -><A
   1.413 -HREF="sdlgetrgba.html"
   1.414 -ACCESSKEY="P"
   1.415 ->Prev</A
   1.416 -></TD
   1.417 -><TD
   1.418 -WIDTH="34%"
   1.419 -ALIGN="center"
   1.420 -VALIGN="top"
   1.421 -><A
   1.422 -HREF="index.html"
   1.423 -ACCESSKEY="H"
   1.424 ->Home</A
   1.425 -></TD
   1.426 -><TD
   1.427 -WIDTH="33%"
   1.428 -ALIGN="right"
   1.429 -VALIGN="top"
   1.430 -><A
   1.431 -HREF="sdlcreatergbsurfacefrom.html"
   1.432 -ACCESSKEY="N"
   1.433 ->Next</A
   1.434 -></TD
   1.435 -></TR
   1.436 -><TR
   1.437 -><TD
   1.438 -WIDTH="33%"
   1.439 -ALIGN="left"
   1.440 -VALIGN="top"
   1.441 ->SDL_GetRGBA</TD
   1.442 -><TD
   1.443 -WIDTH="34%"
   1.444 -ALIGN="center"
   1.445 -VALIGN="top"
   1.446 -><A
   1.447 -HREF="video.html"
   1.448 -ACCESSKEY="U"
   1.449 ->Up</A
   1.450 -></TD
   1.451 -><TD
   1.452 -WIDTH="33%"
   1.453 -ALIGN="right"
   1.454 -VALIGN="top"
   1.455 ->SDL_CreateRGBSurfaceFrom</TD
   1.456 -></TR
   1.457 -></TABLE
   1.458 -></DIV
   1.459 -></BODY
   1.460 -></HTML
   1.461 ->
   1.462 \ No newline at end of file