Mercurial > sdl-ios-xcode
comparison docs/man3/SDL_CreateRGBSurface.3 @ 55:55f1f1b3e27d
Added new docs for SDL 1.2.1
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Sun, 10 Jun 2001 19:31:57 +0000 |
parents | 74212992fb08 |
children | e5bc29de3f0a |
comparison
equal
deleted
inserted
replaced
54:028447a8a758 | 55:55f1f1b3e27d |
---|---|
1 .TH "SDL_CreateRGBSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" | 1 .TH "SDL_CreateRGBSurface" "3" "Sun 10 Jun 2001, 19:41" "SDL" "SDL API Reference" |
2 .SH "NAME" | 2 .SH "NAME" |
3 SDL_CreateRGBSurface\- Create an empty SDL_Surface | 3 SDL_CreateRGBSurface\- Create an empty SDL_Surface |
4 .SH "SYNOPSIS" | 4 .SH "SYNOPSIS" |
5 .PP | 5 .PP |
6 \fB#include "SDL\&.h" | 6 \fB#include "SDL\&.h" |
17 .TP 20 | 17 .TP 20 |
18 \fBSDL_HWSURFACE\fP | 18 \fBSDL_HWSURFACE\fP |
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)\&. | 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)\&. |
20 .TP 20 | 20 .TP 20 |
21 \fBSDL_SRCCOLORKEY\fP | 21 \fBSDL_SRCCOLORKEY\fP |
22 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\&. | 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\&. |
23 .TP 20 | 23 .TP 20 |
24 \fBSDL_SRCALPHA\fP | 24 \fBSDL_SRCALPHA\fP |
25 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 | 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\&. |
26 .PP | |
27 .RS | |
28 \fBNote: | |
29 .PP | |
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\&. | |
31 .RE | |
32 .SH "RETURN VALUE" | |
33 .PP | |
34 Returns the created surface, or \fBNULL\fR upon error\&. | |
35 .SH "EXAMPLE" | |
36 .PP | |
37 .nf | |
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 */ | |
40 SDL_Surface *surface; | |
41 Uint32 rmask, gmask, bmask, amask; | |
42 | |
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 | |
46 rmask = 0xff000000; | |
47 gmask = 0x00ff0000; | |
48 bmask = 0x0000ff00; | |
49 amask = 0x000000ff; | |
50 #else | |
51 rmask = 0x000000ff; | |
52 gmask = 0x0000ff00; | |
53 bmask = 0x00ff0000; | |
54 amask = 0xff000000; | |
55 #endif | |
56 | |
57 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, | |
58 rmask, gmask, bmask, amask); | |
59 if(surface == NULL) { | |
60 fprintf(stderr, "CreateRGBSurface failed: %s | |
61 ", SDL_GetError()); | |
62 exit(1); | |
63 }\fR | |
64 .fi | |
65 .PP | |
26 .SH "SEE ALSO" | 66 .SH "SEE ALSO" |
27 .PP | 67 .PP |
28 \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 | 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 |
29 ...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 | 69 ...\" created by instant / docbook-to-man, Sun 10 Jun 2001, 19:41 |