Mercurial > sdl-ios-xcode
comparison include/SDL_video.h @ 4217:4c4113c2162c SDL-1.2
Fixed bug #706
Ken Bull 2009-02-25 13:22:02 PST
Adds Doxygen support for all headers (except config and boilerplate headers) in
the include folder for SDL-1.2 revision 4446.
While in general SDL is quite thoroughly commented, none of these comments are
correctly formatted for Doxygen and are generally inconsistent in their
formatting.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 21 Sep 2009 09:38:10 +0000 |
parents | 34068be6aa0b |
children |
comparison
equal
deleted
inserted
replaced
4216:5b99971a27b4 | 4217:4c4113c2162c |
---|---|
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* Header file for access to the SDL raw framebuffer window */ | 23 /** @file SDL_video.h |
24 * Header file for access to the SDL raw framebuffer window | |
25 */ | |
24 | 26 |
25 #ifndef _SDL_video_h | 27 #ifndef _SDL_video_h |
26 #define _SDL_video_h | 28 #define _SDL_video_h |
27 | 29 |
28 #include "SDL_stdinc.h" | 30 #include "SDL_stdinc.h" |
33 /* Set up for C function definitions, even when using C++ */ | 35 /* Set up for C function definitions, even when using C++ */ |
34 #ifdef __cplusplus | 36 #ifdef __cplusplus |
35 extern "C" { | 37 extern "C" { |
36 #endif | 38 #endif |
37 | 39 |
38 /* Transparency definitions: These define alpha as the opacity of a surface */ | 40 /** @name Transparency definitions |
41 * These define alpha as the opacity of a surface | |
42 */ | |
43 /*@{*/ | |
39 #define SDL_ALPHA_OPAQUE 255 | 44 #define SDL_ALPHA_OPAQUE 255 |
40 #define SDL_ALPHA_TRANSPARENT 0 | 45 #define SDL_ALPHA_TRANSPARENT 0 |
41 | 46 /*@}*/ |
42 /* Useful data types */ | 47 |
48 /** @name Useful data types */ | |
49 /*@{*/ | |
43 typedef struct SDL_Rect { | 50 typedef struct SDL_Rect { |
44 Sint16 x, y; | 51 Sint16 x, y; |
45 Uint16 w, h; | 52 Uint16 w, h; |
46 } SDL_Rect; | 53 } SDL_Rect; |
47 | 54 |
55 | 62 |
56 typedef struct SDL_Palette { | 63 typedef struct SDL_Palette { |
57 int ncolors; | 64 int ncolors; |
58 SDL_Color *colors; | 65 SDL_Color *colors; |
59 } SDL_Palette; | 66 } SDL_Palette; |
60 | 67 /*@}*/ |
61 /* Everything in the pixel format structure is read-only */ | 68 |
69 /** Everything in the pixel format structure is read-only */ | |
62 typedef struct SDL_PixelFormat { | 70 typedef struct SDL_PixelFormat { |
63 SDL_Palette *palette; | 71 SDL_Palette *palette; |
64 Uint8 BitsPerPixel; | 72 Uint8 BitsPerPixel; |
65 Uint8 BytesPerPixel; | 73 Uint8 BytesPerPixel; |
66 Uint8 Rloss; | 74 Uint8 Rloss; |
74 Uint32 Rmask; | 82 Uint32 Rmask; |
75 Uint32 Gmask; | 83 Uint32 Gmask; |
76 Uint32 Bmask; | 84 Uint32 Bmask; |
77 Uint32 Amask; | 85 Uint32 Amask; |
78 | 86 |
79 /* RGB color key information */ | 87 /** RGB color key information */ |
80 Uint32 colorkey; | 88 Uint32 colorkey; |
81 /* Alpha value information (per-surface alpha) */ | 89 /** Alpha value information (per-surface alpha) */ |
82 Uint8 alpha; | 90 Uint8 alpha; |
83 } SDL_PixelFormat; | 91 } SDL_PixelFormat; |
84 | 92 |
85 /* This structure should be treated as read-only, except for 'pixels', | 93 /** This structure should be treated as read-only, except for 'pixels', |
86 which, if not NULL, contains the raw pixel data for the surface. | 94 * which, if not NULL, contains the raw pixel data for the surface. |
87 */ | 95 */ |
88 typedef struct SDL_Surface { | 96 typedef struct SDL_Surface { |
89 Uint32 flags; /* Read-only */ | 97 Uint32 flags; /**< Read-only */ |
90 SDL_PixelFormat *format; /* Read-only */ | 98 SDL_PixelFormat *format; /**< Read-only */ |
91 int w, h; /* Read-only */ | 99 int w, h; /**< Read-only */ |
92 Uint16 pitch; /* Read-only */ | 100 Uint16 pitch; /**< Read-only */ |
93 void *pixels; /* Read-write */ | 101 void *pixels; /**< Read-write */ |
94 int offset; /* Private */ | 102 int offset; /**< Private */ |
95 | 103 |
96 /* Hardware-specific surface info */ | 104 /** Hardware-specific surface info */ |
97 struct private_hwdata *hwdata; | 105 struct private_hwdata *hwdata; |
98 | 106 |
99 /* clipping information */ | 107 /** clipping information */ |
100 SDL_Rect clip_rect; /* Read-only */ | 108 SDL_Rect clip_rect; /**< Read-only */ |
101 Uint32 unused1; /* for binary compatibility */ | 109 Uint32 unused1; /**< for binary compatibility */ |
102 | 110 |
103 /* Allow recursive locks */ | 111 /** Allow recursive locks */ |
104 Uint32 locked; /* Private */ | 112 Uint32 locked; /**< Private */ |
105 | 113 |
106 /* info for fast blit mapping to other surfaces */ | 114 /** info for fast blit mapping to other surfaces */ |
107 struct SDL_BlitMap *map; /* Private */ | 115 struct SDL_BlitMap *map; /**< Private */ |
108 | 116 |
109 /* format version, bumped at every change to invalidate blit maps */ | 117 /** format version, bumped at every change to invalidate blit maps */ |
110 unsigned int format_version; /* Private */ | 118 unsigned int format_version; /**< Private */ |
111 | 119 |
112 /* Reference count -- used when freeing surface */ | 120 /** Reference count -- used when freeing surface */ |
113 int refcount; /* Read-mostly */ | 121 int refcount; /**< Read-mostly */ |
114 } SDL_Surface; | 122 } SDL_Surface; |
115 | 123 |
116 /* These are the currently supported flags for the SDL_surface */ | 124 /** @name SDL_Surface Flags |
117 /* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ | 125 * These are the currently supported flags for the SDL_surface |
118 #define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ | 126 */ |
119 #define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ | 127 /*@{*/ |
120 #define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ | 128 |
121 /* Available for SDL_SetVideoMode() */ | 129 /** Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ |
122 #define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ | 130 /*@{*/ |
123 #define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ | 131 #define SDL_SWSURFACE 0x00000000 /**< Surface is in system memory */ |
124 #define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ | 132 #define SDL_HWSURFACE 0x00000001 /**< Surface is in video memory */ |
125 #define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ | 133 #define SDL_ASYNCBLIT 0x00000004 /**< Use asynchronous blits if possible */ |
126 #define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ | 134 /*@}*/ |
127 #define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ | 135 |
128 #define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ | 136 /** Available for SDL_SetVideoMode() */ |
129 #define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ | 137 /*@{*/ |
130 /* Used internally (read-only) */ | 138 #define SDL_ANYFORMAT 0x10000000 /**< Allow any video depth/pixel-format */ |
131 #define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ | 139 #define SDL_HWPALETTE 0x20000000 /**< Surface has exclusive palette */ |
132 #define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ | 140 #define SDL_DOUBLEBUF 0x40000000 /**< Set up double-buffered video mode */ |
133 #define SDL_RLEACCELOK 0x00002000 /* Private flag */ | 141 #define SDL_FULLSCREEN 0x80000000 /**< Surface is a full screen display */ |
134 #define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ | 142 #define SDL_OPENGL 0x00000002 /**< Create an OpenGL rendering context */ |
135 #define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ | 143 #define SDL_OPENGLBLIT 0x0000000A /**< Create an OpenGL rendering context and use it for blitting */ |
136 #define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ | 144 #define SDL_RESIZABLE 0x00000010 /**< This video mode may be resized */ |
137 | 145 #define SDL_NOFRAME 0x00000020 /**< No window caption or edge frame */ |
138 /* Evaluates to true if the surface needs to be locked before access */ | 146 /*@}*/ |
147 | |
148 /** Used internally (read-only) */ | |
149 /*@{*/ | |
150 #define SDL_HWACCEL 0x00000100 /**< Blit uses hardware acceleration */ | |
151 #define SDL_SRCCOLORKEY 0x00001000 /**< Blit uses a source color key */ | |
152 #define SDL_RLEACCELOK 0x00002000 /**< Private flag */ | |
153 #define SDL_RLEACCEL 0x00004000 /**< Surface is RLE encoded */ | |
154 #define SDL_SRCALPHA 0x00010000 /**< Blit uses source alpha blending */ | |
155 #define SDL_PREALLOC 0x01000000 /**< Surface uses preallocated memory */ | |
156 /*@}*/ | |
157 | |
158 /*@}*/ | |
159 | |
160 /** Evaluates to true if the surface needs to be locked before access */ | |
139 #define SDL_MUSTLOCK(surface) \ | 161 #define SDL_MUSTLOCK(surface) \ |
140 (surface->offset || \ | 162 (surface->offset || \ |
141 ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) | 163 ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) |
142 | 164 |
143 /* typedef for private surface blitting functions */ | 165 /** typedef for private surface blitting functions */ |
144 typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, | 166 typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, |
145 struct SDL_Surface *dst, SDL_Rect *dstrect); | 167 struct SDL_Surface *dst, SDL_Rect *dstrect); |
146 | 168 |
147 | 169 |
148 /* Useful for determining the video hardware capabilities */ | 170 /** Useful for determining the video hardware capabilities */ |
149 typedef struct SDL_VideoInfo { | 171 typedef struct SDL_VideoInfo { |
150 Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ | 172 Uint32 hw_available :1; /**< Flag: Can you create hardware surfaces? */ |
151 Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ | 173 Uint32 wm_available :1; /**< Flag: Can you talk to a window manager? */ |
152 Uint32 UnusedBits1 :6; | 174 Uint32 UnusedBits1 :6; |
153 Uint32 UnusedBits2 :1; | 175 Uint32 UnusedBits2 :1; |
154 Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ | 176 Uint32 blit_hw :1; /**< Flag: Accelerated blits HW --> HW */ |
155 Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ | 177 Uint32 blit_hw_CC :1; /**< Flag: Accelerated blits with Colorkey */ |
156 Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ | 178 Uint32 blit_hw_A :1; /**< Flag: Accelerated blits with Alpha */ |
157 Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ | 179 Uint32 blit_sw :1; /**< Flag: Accelerated blits SW --> HW */ |
158 Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ | 180 Uint32 blit_sw_CC :1; /**< Flag: Accelerated blits with Colorkey */ |
159 Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ | 181 Uint32 blit_sw_A :1; /**< Flag: Accelerated blits with Alpha */ |
160 Uint32 blit_fill :1; /* Flag: Accelerated color fill */ | 182 Uint32 blit_fill :1; /**< Flag: Accelerated color fill */ |
161 Uint32 UnusedBits3 :16; | 183 Uint32 UnusedBits3 :16; |
162 Uint32 video_mem; /* The total amount of video memory (in K) */ | 184 Uint32 video_mem; /**< The total amount of video memory (in K) */ |
163 SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ | 185 SDL_PixelFormat *vfmt; /**< Value: The format of the video surface */ |
164 int current_w; /* Value: The current video mode width */ | 186 int current_w; /**< Value: The current video mode width */ |
165 int current_h; /* Value: The current video mode height */ | 187 int current_h; /**< Value: The current video mode height */ |
166 } SDL_VideoInfo; | 188 } SDL_VideoInfo; |
167 | 189 |
168 | 190 |
169 /* The most common video overlay formats. | 191 /** @name Overlay Formats |
170 For an explanation of these pixel formats, see: | 192 * The most common video overlay formats. |
171 http://www.webartz.com/fourcc/indexyuv.htm | 193 * For an explanation of these pixel formats, see: |
172 | 194 * http://www.webartz.com/fourcc/indexyuv.htm |
173 For information on the relationship between color spaces, see: | 195 * |
174 http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html | 196 * For information on the relationship between color spaces, see: |
175 */ | 197 * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html |
176 #define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ | 198 */ |
177 #define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ | 199 /*@{*/ |
178 #define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ | 200 #define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */ |
179 #define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ | 201 #define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */ |
180 #define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ | 202 #define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ |
181 | 203 #define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ |
182 /* The YUV hardware video overlay */ | 204 #define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ |
205 /*@}*/ | |
206 | |
207 /** The YUV hardware video overlay */ | |
183 typedef struct SDL_Overlay { | 208 typedef struct SDL_Overlay { |
184 Uint32 format; /* Read-only */ | 209 Uint32 format; /**< Read-only */ |
185 int w, h; /* Read-only */ | 210 int w, h; /**< Read-only */ |
186 int planes; /* Read-only */ | 211 int planes; /**< Read-only */ |
187 Uint16 *pitches; /* Read-only */ | 212 Uint16 *pitches; /**< Read-only */ |
188 Uint8 **pixels; /* Read-write */ | 213 Uint8 **pixels; /**< Read-write */ |
189 | 214 |
190 /* Hardware-specific surface info */ | 215 /** @name Hardware-specific surface info */ |
216 /*@{*/ | |
191 struct private_yuvhwfuncs *hwfuncs; | 217 struct private_yuvhwfuncs *hwfuncs; |
192 struct private_yuvhwdata *hwdata; | 218 struct private_yuvhwdata *hwdata; |
193 | 219 /*@{*/ |
194 /* Special flags */ | 220 |
195 Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ | 221 /** @name Special flags */ |
222 /*@{*/ | |
223 Uint32 hw_overlay :1; /**< Flag: This overlay hardware accelerated? */ | |
196 Uint32 UnusedBits :31; | 224 Uint32 UnusedBits :31; |
225 /*@}*/ | |
197 } SDL_Overlay; | 226 } SDL_Overlay; |
198 | 227 |
199 | 228 |
200 /* Public enumeration for setting the OpenGL window attributes. */ | 229 /** Public enumeration for setting the OpenGL window attributes. */ |
201 typedef enum { | 230 typedef enum { |
202 SDL_GL_RED_SIZE, | 231 SDL_GL_RED_SIZE, |
203 SDL_GL_GREEN_SIZE, | 232 SDL_GL_GREEN_SIZE, |
204 SDL_GL_BLUE_SIZE, | 233 SDL_GL_BLUE_SIZE, |
205 SDL_GL_ALPHA_SIZE, | 234 SDL_GL_ALPHA_SIZE, |
216 SDL_GL_MULTISAMPLESAMPLES, | 245 SDL_GL_MULTISAMPLESAMPLES, |
217 SDL_GL_ACCELERATED_VISUAL, | 246 SDL_GL_ACCELERATED_VISUAL, |
218 SDL_GL_SWAP_CONTROL | 247 SDL_GL_SWAP_CONTROL |
219 } SDL_GLattr; | 248 } SDL_GLattr; |
220 | 249 |
221 /* flags for SDL_SetPalette() */ | 250 /** @name flags for SDL_SetPalette() */ |
251 /*@{*/ | |
222 #define SDL_LOGPAL 0x01 | 252 #define SDL_LOGPAL 0x01 |
223 #define SDL_PHYSPAL 0x02 | 253 #define SDL_PHYSPAL 0x02 |
254 /*@}*/ | |
224 | 255 |
225 /* Function prototypes */ | 256 /* Function prototypes */ |
226 | 257 |
227 /* These functions are used internally, and should not be used unless you | 258 /** |
259 * @name Video Init and Quit | |
260 * These functions are used internally, and should not be used unless you | |
228 * have a specific need to specify the video driver you want to use. | 261 * have a specific need to specify the video driver you want to use. |
229 * You should normally use SDL_Init() or SDL_InitSubSystem(). | 262 * You should normally use SDL_Init() or SDL_InitSubSystem(). |
230 * | 263 */ |
231 * SDL_VideoInit() initializes the video subsystem -- sets up a connection | 264 /*@{*/ |
265 /** | |
266 * Initializes the video subsystem. Sets up a connection | |
232 * to the window manager, etc, and determines the current video mode and | 267 * to the window manager, etc, and determines the current video mode and |
233 * pixel format, but does not initialize a window or graphics mode. | 268 * pixel format, but does not initialize a window or graphics mode. |
234 * Note that event handling is activated by this routine. | 269 * Note that event handling is activated by this routine. |
235 * | 270 * |
236 * If you use both sound and video in your application, you need to call | 271 * If you use both sound and video in your application, you need to call |
237 * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, | 272 * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, |
238 * you won't be able to set full-screen display modes. | 273 * you won't be able to set full-screen display modes. |
239 */ | 274 */ |
240 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); | 275 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); |
241 extern DECLSPEC void SDLCALL SDL_VideoQuit(void); | 276 extern DECLSPEC void SDLCALL SDL_VideoQuit(void); |
242 | 277 /*@}*/ |
243 /* This function fills the given character buffer with the name of the | 278 |
279 /** | |
280 * This function fills the given character buffer with the name of the | |
244 * video driver, and returns a pointer to it if the video driver has | 281 * video driver, and returns a pointer to it if the video driver has |
245 * been initialized. It returns NULL if no driver has been initialized. | 282 * been initialized. It returns NULL if no driver has been initialized. |
246 */ | 283 */ |
247 extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); | 284 extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); |
248 | 285 |
249 /* | 286 /** |
250 * This function returns a pointer to the current display surface. | 287 * This function returns a pointer to the current display surface. |
251 * If SDL is doing format conversion on the display surface, this | 288 * If SDL is doing format conversion on the display surface, this |
252 * function returns the publicly visible surface, not the real video | 289 * function returns the publicly visible surface, not the real video |
253 * surface. | 290 * surface. |
254 */ | 291 */ |
255 extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); | 292 extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); |
256 | 293 |
257 /* | 294 /** |
258 * This function returns a read-only pointer to information about the | 295 * This function returns a read-only pointer to information about the |
259 * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' | 296 * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' |
260 * member of the returned structure will contain the pixel format of the | 297 * member of the returned structure will contain the pixel format of the |
261 * "best" video mode. | 298 * "best" video mode. |
262 */ | 299 */ |
263 extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); | 300 extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); |
264 | 301 |
265 /* | 302 /** |
266 * Check to see if a particular video mode is supported. | 303 * Check to see if a particular video mode is supported. |
267 * It returns 0 if the requested mode is not supported under any bit depth, | 304 * It returns 0 if the requested mode is not supported under any bit depth, |
268 * or returns the bits-per-pixel of the closest available mode with the | 305 * or returns the bits-per-pixel of the closest available mode with the |
269 * given width and height. If this bits-per-pixel is different from the | 306 * given width and height. If this bits-per-pixel is different from the |
270 * one used when setting the video mode, SDL_SetVideoMode() will succeed, | 307 * one used when setting the video mode, SDL_SetVideoMode() will succeed, |
273 * The arguments to SDL_VideoModeOK() are the same ones you would pass to | 310 * The arguments to SDL_VideoModeOK() are the same ones you would pass to |
274 * SDL_SetVideoMode() | 311 * SDL_SetVideoMode() |
275 */ | 312 */ |
276 extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); | 313 extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); |
277 | 314 |
278 /* | 315 /** |
279 * Return a pointer to an array of available screen dimensions for the | 316 * Return a pointer to an array of available screen dimensions for the |
280 * given format and video flags, sorted largest to smallest. Returns | 317 * given format and video flags, sorted largest to smallest. Returns |
281 * NULL if there are no dimensions available for a particular format, | 318 * NULL if there are no dimensions available for a particular format, |
282 * or (SDL_Rect **)-1 if any dimension is okay for the given format. | 319 * or (SDL_Rect **)-1 if any dimension is okay for the given format. |
283 * | 320 * |
284 * If 'format' is NULL, the mode list will be for the format given | 321 * If 'format' is NULL, the mode list will be for the format given |
285 * by SDL_GetVideoInfo()->vfmt | 322 * by SDL_GetVideoInfo()->vfmt |
286 */ | 323 */ |
287 extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); | 324 extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); |
288 | 325 |
289 /* | 326 /** |
290 * Set up a video mode with the specified width, height and bits-per-pixel. | 327 * Set up a video mode with the specified width, height and bits-per-pixel. |
291 * | 328 * |
292 * If 'bpp' is 0, it is treated as the current display bits per pixel. | 329 * If 'bpp' is 0, it is treated as the current display bits per pixel. |
293 * | 330 * |
294 * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the | 331 * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the |
345 * are not available. | 382 * are not available. |
346 */ | 383 */ |
347 extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode | 384 extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode |
348 (int width, int height, int bpp, Uint32 flags); | 385 (int width, int height, int bpp, Uint32 flags); |
349 | 386 |
350 /* | 387 /** @name SDL_Update Functions |
388 * These functions should not be called while 'screen' is locked. | |
389 */ | |
390 /*@{*/ | |
391 /** | |
351 * Makes sure the given list of rectangles is updated on the given screen. | 392 * Makes sure the given list of rectangles is updated on the given screen. |
393 */ | |
394 extern DECLSPEC void SDLCALL SDL_UpdateRects | |
395 (SDL_Surface *screen, int numrects, SDL_Rect *rects); | |
396 /** | |
352 * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire | 397 * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire |
353 * screen. | 398 * screen. |
354 * These functions should not be called while 'screen' is locked. | 399 */ |
355 */ | |
356 extern DECLSPEC void SDLCALL SDL_UpdateRects | |
357 (SDL_Surface *screen, int numrects, SDL_Rect *rects); | |
358 extern DECLSPEC void SDLCALL SDL_UpdateRect | 400 extern DECLSPEC void SDLCALL SDL_UpdateRect |
359 (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); | 401 (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); |
360 | 402 /*@}*/ |
361 /* | 403 |
404 /** | |
362 * On hardware that supports double-buffering, this function sets up a flip | 405 * On hardware that supports double-buffering, this function sets up a flip |
363 * and returns. The hardware will wait for vertical retrace, and then swap | 406 * and returns. The hardware will wait for vertical retrace, and then swap |
364 * video buffers before the next video surface blit or lock will return. | 407 * video buffers before the next video surface blit or lock will return. |
365 * On hardware that doesn not support double-buffering, this is equivalent | 408 * On hardware that doesn not support double-buffering, this is equivalent |
366 * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); | 409 * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); |
368 * setting the video mode for this function to perform hardware flipping. | 411 * setting the video mode for this function to perform hardware flipping. |
369 * This function returns 0 if successful, or -1 if there was an error. | 412 * This function returns 0 if successful, or -1 if there was an error. |
370 */ | 413 */ |
371 extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); | 414 extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); |
372 | 415 |
373 /* | 416 /** |
374 * Set the gamma correction for each of the color channels. | 417 * Set the gamma correction for each of the color channels. |
375 * The gamma values range (approximately) between 0.1 and 10.0 | 418 * The gamma values range (approximately) between 0.1 and 10.0 |
376 * | 419 * |
377 * If this function isn't supported directly by the hardware, it will | 420 * If this function isn't supported directly by the hardware, it will |
378 * be emulated using gamma ramps, if available. If successful, this | 421 * be emulated using gamma ramps, if available. If successful, this |
379 * function returns 0, otherwise it returns -1. | 422 * function returns 0, otherwise it returns -1. |
380 */ | 423 */ |
381 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); | 424 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); |
382 | 425 |
383 /* | 426 /** |
384 * Set the gamma translation table for the red, green, and blue channels | 427 * Set the gamma translation table for the red, green, and blue channels |
385 * of the video hardware. Each table is an array of 256 16-bit quantities, | 428 * of the video hardware. Each table is an array of 256 16-bit quantities, |
386 * representing a mapping between the input and output for that channel. | 429 * representing a mapping between the input and output for that channel. |
387 * The input is the index into the array, and the output is the 16-bit | 430 * The input is the index into the array, and the output is the 16-bit |
388 * gamma value at that index, scaled to the output color precision. | 431 * gamma value at that index, scaled to the output color precision. |
392 * hardware does not support gamma translation, or otherwise fails, | 435 * hardware does not support gamma translation, or otherwise fails, |
393 * this function will return -1. | 436 * this function will return -1. |
394 */ | 437 */ |
395 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); | 438 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); |
396 | 439 |
397 /* | 440 /** |
398 * Retrieve the current values of the gamma translation tables. | 441 * Retrieve the current values of the gamma translation tables. |
399 * | 442 * |
400 * You must pass in valid pointers to arrays of 256 16-bit quantities. | 443 * You must pass in valid pointers to arrays of 256 16-bit quantities. |
401 * Any of the pointers may be NULL to ignore that channel. | 444 * Any of the pointers may be NULL to ignore that channel. |
402 * If the call succeeds, it will return 0. If the display driver or | 445 * If the call succeeds, it will return 0. If the display driver or |
403 * hardware does not support gamma translation, or otherwise fails, | 446 * hardware does not support gamma translation, or otherwise fails, |
404 * this function will return -1. | 447 * this function will return -1. |
405 */ | 448 */ |
406 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); | 449 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); |
407 | 450 |
408 /* | 451 /** |
409 * Sets a portion of the colormap for the given 8-bit surface. If 'surface' | 452 * Sets a portion of the colormap for the given 8-bit surface. If 'surface' |
410 * is not a palettized surface, this function does nothing, returning 0. | 453 * is not a palettized surface, this function does nothing, returning 0. |
411 * If all of the colors were set as passed to SDL_SetColors(), it will | 454 * If all of the colors were set as passed to SDL_SetColors(), it will |
412 * return 1. If not all the color entries were set exactly as given, | 455 * return 1. If not all the color entries were set exactly as given, |
413 * it will return 0, and you should look at the surface palette to | 456 * it will return 0, and you should look at the surface palette to |
421 * emulation. | 464 * emulation. |
422 */ | 465 */ |
423 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, | 466 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, |
424 SDL_Color *colors, int firstcolor, int ncolors); | 467 SDL_Color *colors, int firstcolor, int ncolors); |
425 | 468 |
426 /* | 469 /** |
427 * Sets a portion of the colormap for a given 8-bit surface. | 470 * Sets a portion of the colormap for a given 8-bit surface. |
428 * 'flags' is one or both of: | 471 * 'flags' is one or both of: |
429 * SDL_LOGPAL -- set logical palette, which controls how blits are mapped | 472 * SDL_LOGPAL -- set logical palette, which controls how blits are mapped |
430 * to/from the surface, | 473 * to/from the surface, |
431 * SDL_PHYSPAL -- set physical palette, which controls how pixels look on | 474 * SDL_PHYSPAL -- set physical palette, which controls how pixels look on |
441 */ | 484 */ |
442 extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, | 485 extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, |
443 SDL_Color *colors, int firstcolor, | 486 SDL_Color *colors, int firstcolor, |
444 int ncolors); | 487 int ncolors); |
445 | 488 |
446 /* | 489 /** |
447 * Maps an RGB triple to an opaque pixel value for a given pixel format | 490 * Maps an RGB triple to an opaque pixel value for a given pixel format |
448 */ | 491 */ |
449 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB | 492 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB |
450 (const SDL_PixelFormat * const format, | 493 (const SDL_PixelFormat * const format, |
451 const Uint8 r, const Uint8 g, const Uint8 b); | 494 const Uint8 r, const Uint8 g, const Uint8 b); |
452 | 495 |
453 /* | 496 /** |
454 * Maps an RGBA quadruple to a pixel value for a given pixel format | 497 * Maps an RGBA quadruple to a pixel value for a given pixel format |
455 */ | 498 */ |
456 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA | 499 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA |
457 (const SDL_PixelFormat * const format, | 500 (const SDL_PixelFormat * const format, |
458 const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); | 501 const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); |
459 | 502 |
460 /* | 503 /** |
461 * Maps a pixel value into the RGB components for a given pixel format | 504 * Maps a pixel value into the RGB components for a given pixel format |
462 */ | 505 */ |
463 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, | 506 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, |
464 const SDL_PixelFormat * const fmt, | 507 const SDL_PixelFormat * const fmt, |
465 Uint8 *r, Uint8 *g, Uint8 *b); | 508 Uint8 *r, Uint8 *g, Uint8 *b); |
466 | 509 |
467 /* | 510 /** |
468 * Maps a pixel value into the RGBA components for a given pixel format | 511 * Maps a pixel value into the RGBA components for a given pixel format |
469 */ | 512 */ |
470 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, | 513 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, |
471 const SDL_PixelFormat * const fmt, | 514 const SDL_PixelFormat * const fmt, |
472 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); | 515 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); |
473 | 516 |
474 /* | 517 /** @sa SDL_CreateRGBSurface */ |
518 #define SDL_AllocSurface SDL_CreateRGBSurface | |
519 /** | |
475 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) | 520 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) |
476 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. | 521 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. |
477 * If the depth is greater than 8 bits, the pixel format is set using the | 522 * If the depth is greater than 8 bits, the pixel format is set using the |
478 * flags '[RGB]mask'. | 523 * flags '[RGB]mask'. |
479 * If the function runs out of memory, it will return NULL. | 524 * If the function runs out of memory, it will return NULL. |
503 * If the requested surface actually resides in video memory, SDL_HWSURFACE | 548 * If the requested surface actually resides in video memory, SDL_HWSURFACE |
504 * will be set in the flags member of the returned surface. If for some | 549 * will be set in the flags member of the returned surface. If for some |
505 * reason the surface could not be placed in video memory, it will not have | 550 * reason the surface could not be placed in video memory, it will not have |
506 * the SDL_HWSURFACE flag set, and will be created in system memory instead. | 551 * the SDL_HWSURFACE flag set, and will be created in system memory instead. |
507 */ | 552 */ |
508 #define SDL_AllocSurface SDL_CreateRGBSurface | |
509 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface | 553 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface |
510 (Uint32 flags, int width, int height, int depth, | 554 (Uint32 flags, int width, int height, int depth, |
511 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); | 555 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); |
556 /** @sa SDL_CreateRGBSurface */ | |
512 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, | 557 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, |
513 int width, int height, int depth, int pitch, | 558 int width, int height, int depth, int pitch, |
514 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); | 559 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); |
515 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); | 560 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); |
516 | 561 |
517 /* | 562 /** |
518 * SDL_LockSurface() sets up a surface for directly accessing the pixels. | 563 * SDL_LockSurface() sets up a surface for directly accessing the pixels. |
519 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write | 564 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write |
520 * to and read from 'surface->pixels', using the pixel format stored in | 565 * to and read from 'surface->pixels', using the pixel format stored in |
521 * 'surface->format'. Once you are done accessing the surface, you should | 566 * 'surface->format'. Once you are done accessing the surface, you should |
522 * use SDL_UnlockSurface() to release it. | 567 * use SDL_UnlockSurface() to release it. |
533 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. | 578 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. |
534 */ | 579 */ |
535 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); | 580 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); |
536 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); | 581 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); |
537 | 582 |
538 /* | 583 /** |
539 * Load a surface from a seekable SDL data source (memory or file.) | 584 * Load a surface from a seekable SDL data source (memory or file.) |
540 * If 'freesrc' is non-zero, the source will be closed after being read. | 585 * If 'freesrc' is non-zero, the source will be closed after being read. |
541 * Returns the new surface, or NULL if there was an error. | 586 * Returns the new surface, or NULL if there was an error. |
542 * The new surface should be freed with SDL_FreeSurface(). | 587 * The new surface should be freed with SDL_FreeSurface(). |
543 */ | 588 */ |
544 extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); | 589 extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); |
545 | 590 |
546 /* Convenience macro -- load a surface from a file */ | 591 /** Convenience macro -- load a surface from a file */ |
547 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) | 592 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) |
548 | 593 |
549 /* | 594 /** |
550 * Save a surface to a seekable SDL data source (memory or file.) | 595 * Save a surface to a seekable SDL data source (memory or file.) |
551 * If 'freedst' is non-zero, the source will be closed after being written. | 596 * If 'freedst' is non-zero, the source will be closed after being written. |
552 * Returns 0 if successful or -1 if there was an error. | 597 * Returns 0 if successful or -1 if there was an error. |
553 */ | 598 */ |
554 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW | 599 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW |
555 (SDL_Surface *surface, SDL_RWops *dst, int freedst); | 600 (SDL_Surface *surface, SDL_RWops *dst, int freedst); |
556 | 601 |
557 /* Convenience macro -- save a surface to a file */ | 602 /** Convenience macro -- save a surface to a file */ |
558 #define SDL_SaveBMP(surface, file) \ | 603 #define SDL_SaveBMP(surface, file) \ |
559 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) | 604 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) |
560 | 605 |
561 /* | 606 /** |
562 * Sets the color key (transparent pixel) in a blittable surface. | 607 * Sets the color key (transparent pixel) in a blittable surface. |
563 * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), | 608 * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), |
564 * 'key' will be the transparent pixel in the source image of a blit. | 609 * 'key' will be the transparent pixel in the source image of a blit. |
565 * SDL_RLEACCEL requests RLE acceleration for the surface if present, | 610 * SDL_RLEACCEL requests RLE acceleration for the surface if present, |
566 * and removes RLE acceleration if absent. | 611 * and removes RLE acceleration if absent. |
568 * This function returns 0, or -1 if there was an error. | 613 * This function returns 0, or -1 if there was an error. |
569 */ | 614 */ |
570 extern DECLSPEC int SDLCALL SDL_SetColorKey | 615 extern DECLSPEC int SDLCALL SDL_SetColorKey |
571 (SDL_Surface *surface, Uint32 flag, Uint32 key); | 616 (SDL_Surface *surface, Uint32 flag, Uint32 key); |
572 | 617 |
573 /* | 618 /** |
574 * This function sets the alpha value for the entire surface, as opposed to | 619 * This function sets the alpha value for the entire surface, as opposed to |
575 * using the alpha component of each pixel. This value measures the range | 620 * using the alpha component of each pixel. This value measures the range |
576 * of transparency of the surface, 0 being completely transparent to 255 | 621 * of transparency of the surface, 0 being completely transparent to 255 |
577 * being completely opaque. An 'alpha' value of 255 causes blits to be | 622 * being completely opaque. An 'alpha' value of 255 causes blits to be |
578 * opaque, the source pixels copied to the destination (the default). Note | 623 * opaque, the source pixels copied to the destination (the default). Note |
585 * | 630 * |
586 * The 'alpha' parameter is ignored for surfaces that have an alpha channel. | 631 * The 'alpha' parameter is ignored for surfaces that have an alpha channel. |
587 */ | 632 */ |
588 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); | 633 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); |
589 | 634 |
590 /* | 635 /** |
591 * Sets the clipping rectangle for the destination surface in a blit. | 636 * Sets the clipping rectangle for the destination surface in a blit. |
592 * | 637 * |
593 * If the clip rectangle is NULL, clipping will be disabled. | 638 * If the clip rectangle is NULL, clipping will be disabled. |
594 * If the clip rectangle doesn't intersect the surface, the function will | 639 * If the clip rectangle doesn't intersect the surface, the function will |
595 * return SDL_FALSE and blits will be completely clipped. Otherwise the | 640 * return SDL_FALSE and blits will be completely clipped. Otherwise the |
599 * Note that blits are automatically clipped to the edges of the source | 644 * Note that blits are automatically clipped to the edges of the source |
600 * and destination surfaces. | 645 * and destination surfaces. |
601 */ | 646 */ |
602 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); | 647 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); |
603 | 648 |
604 /* | 649 /** |
605 * Gets the clipping rectangle for the destination surface in a blit. | 650 * Gets the clipping rectangle for the destination surface in a blit. |
606 * 'rect' must be a pointer to a valid rectangle which will be filled | 651 * 'rect' must be a pointer to a valid rectangle which will be filled |
607 * with the correct values. | 652 * with the correct values. |
608 */ | 653 */ |
609 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); | 654 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); |
610 | 655 |
611 /* | 656 /** |
612 * Creates a new surface of the specified format, and then copies and maps | 657 * Creates a new surface of the specified format, and then copies and maps |
613 * the given surface to it so the blit of the converted surface will be as | 658 * the given surface to it so the blit of the converted surface will be as |
614 * fast as possible. If this function fails, it returns NULL. | 659 * fast as possible. If this function fails, it returns NULL. |
615 * | 660 * |
616 * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those | 661 * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those |
621 * This function is used internally by SDL_DisplayFormat(). | 666 * This function is used internally by SDL_DisplayFormat(). |
622 */ | 667 */ |
623 extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface | 668 extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface |
624 (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); | 669 (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); |
625 | 670 |
626 /* | 671 /** |
627 * This performs a fast blit from the source surface to the destination | 672 * This performs a fast blit from the source surface to the destination |
628 * surface. It assumes that the source and destination rectangles are | 673 * surface. It assumes that the source and destination rectangles are |
629 * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire | 674 * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire |
630 * surface (src or dst) is copied. The final blit rectangles are saved | 675 * surface (src or dst) is copied. The final blit rectangles are saved |
631 * in 'srcrect' and 'dstrect' after all clipping is performed. | 676 * in 'srcrect' and 'dstrect' after all clipping is performed. |
677 * source colour key. | 722 * source colour key. |
678 * | 723 * |
679 * If either of the surfaces were in video memory, and the blit returns -2, | 724 * If either of the surfaces were in video memory, and the blit returns -2, |
680 * the video memory was lost, so it should be reloaded with artwork and | 725 * the video memory was lost, so it should be reloaded with artwork and |
681 * re-blitted: | 726 * re-blitted: |
682 while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { | 727 * @code |
683 while ( SDL_LockSurface(image) < 0 ) | 728 * while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { |
684 Sleep(10); | 729 * while ( SDL_LockSurface(image) < 0 ) |
685 -- Write image pixels to image->pixels -- | 730 * Sleep(10); |
686 SDL_UnlockSurface(image); | 731 * -- Write image pixels to image->pixels -- |
687 } | 732 * SDL_UnlockSurface(image); |
733 * } | |
734 * @endcode | |
735 * | |
688 * This happens under DirectX 5.0 when the system switches away from your | 736 * This happens under DirectX 5.0 when the system switches away from your |
689 * fullscreen application. The lock will also fail until you have access | 737 * fullscreen application. The lock will also fail until you have access |
690 * to the video memory again. | 738 * to the video memory again. |
691 */ | 739 * |
692 /* You should call SDL_BlitSurface() unless you know exactly how SDL | 740 * You should call SDL_BlitSurface() unless you know exactly how SDL |
693 blitting works internally and how to use the other blit functions. | 741 * blitting works internally and how to use the other blit functions. |
694 */ | 742 */ |
695 #define SDL_BlitSurface SDL_UpperBlit | 743 #define SDL_BlitSurface SDL_UpperBlit |
696 | 744 |
697 /* This is the public blit function, SDL_BlitSurface(), and it performs | 745 /** This is the public blit function, SDL_BlitSurface(), and it performs |
698 rectangle validation and clipping before passing it to SDL_LowerBlit() | 746 * rectangle validation and clipping before passing it to SDL_LowerBlit() |
699 */ | 747 */ |
700 extern DECLSPEC int SDLCALL SDL_UpperBlit | 748 extern DECLSPEC int SDLCALL SDL_UpperBlit |
701 (SDL_Surface *src, SDL_Rect *srcrect, | 749 (SDL_Surface *src, SDL_Rect *srcrect, |
702 SDL_Surface *dst, SDL_Rect *dstrect); | 750 SDL_Surface *dst, SDL_Rect *dstrect); |
703 /* This is a semi-private blit function and it performs low-level surface | 751 /** This is a semi-private blit function and it performs low-level surface |
704 blitting only. | 752 * blitting only. |
705 */ | 753 */ |
706 extern DECLSPEC int SDLCALL SDL_LowerBlit | 754 extern DECLSPEC int SDLCALL SDL_LowerBlit |
707 (SDL_Surface *src, SDL_Rect *srcrect, | 755 (SDL_Surface *src, SDL_Rect *srcrect, |
708 SDL_Surface *dst, SDL_Rect *dstrect); | 756 SDL_Surface *dst, SDL_Rect *dstrect); |
709 | 757 |
710 /* | 758 /** |
711 * This function performs a fast fill of the given rectangle with 'color' | 759 * This function performs a fast fill of the given rectangle with 'color' |
712 * The given rectangle is clipped to the destination surface clip area | 760 * The given rectangle is clipped to the destination surface clip area |
713 * and the final fill rectangle is saved in the passed in pointer. | 761 * and the final fill rectangle is saved in the passed in pointer. |
714 * If 'dstrect' is NULL, the whole surface will be filled with 'color' | 762 * If 'dstrect' is NULL, the whole surface will be filled with 'color' |
715 * The color should be a pixel of the format used by the surface, and | 763 * The color should be a pixel of the format used by the surface, and |
717 * This function returns 0 on success, or -1 on error. | 765 * This function returns 0 on success, or -1 on error. |
718 */ | 766 */ |
719 extern DECLSPEC int SDLCALL SDL_FillRect | 767 extern DECLSPEC int SDLCALL SDL_FillRect |
720 (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); | 768 (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); |
721 | 769 |
722 /* | 770 /** |
723 * This function takes a surface and copies it to a new surface of the | 771 * This function takes a surface and copies it to a new surface of the |
724 * pixel format and colors of the video framebuffer, suitable for fast | 772 * pixel format and colors of the video framebuffer, suitable for fast |
725 * blitting onto the display surface. It calls SDL_ConvertSurface() | 773 * blitting onto the display surface. It calls SDL_ConvertSurface() |
726 * | 774 * |
727 * If you want to take advantage of hardware colorkey or alpha blit | 775 * If you want to take advantage of hardware colorkey or alpha blit |
730 * | 778 * |
731 * If the conversion fails or runs out of memory, it returns NULL | 779 * If the conversion fails or runs out of memory, it returns NULL |
732 */ | 780 */ |
733 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); | 781 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); |
734 | 782 |
735 /* | 783 /** |
736 * This function takes a surface and copies it to a new surface of the | 784 * This function takes a surface and copies it to a new surface of the |
737 * pixel format and colors of the video framebuffer (if possible), | 785 * pixel format and colors of the video framebuffer (if possible), |
738 * suitable for fast alpha blitting onto the display surface. | 786 * suitable for fast alpha blitting onto the display surface. |
739 * The new surface will always have an alpha channel. | 787 * The new surface will always have an alpha channel. |
740 * | 788 * |
746 */ | 794 */ |
747 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); | 795 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); |
748 | 796 |
749 | 797 |
750 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 798 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
751 /* YUV video surface overlay functions */ | 799 /** @name YUV video surface overlay functions */ /*@{*/ |
752 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 800 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
753 | 801 |
754 /* This function creates a video output overlay | 802 /** This function creates a video output overlay |
755 Calling the returned surface an overlay is something of a misnomer because | 803 * Calling the returned surface an overlay is something of a misnomer because |
756 the contents of the display surface underneath the area where the overlay | 804 * the contents of the display surface underneath the area where the overlay |
757 is shown is undefined - it may be overwritten with the converted YUV data. | 805 * is shown is undefined - it may be overwritten with the converted YUV data. |
758 */ | 806 */ |
759 extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, | 807 extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, |
760 Uint32 format, SDL_Surface *display); | 808 Uint32 format, SDL_Surface *display); |
761 | 809 |
762 /* Lock an overlay for direct access, and unlock it when you are done */ | 810 /** Lock an overlay for direct access, and unlock it when you are done */ |
763 extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); | 811 extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); |
764 extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); | 812 extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); |
765 | 813 |
766 /* Blit a video overlay to the display surface. | 814 /** Blit a video overlay to the display surface. |
767 The contents of the video surface underneath the blit destination are | 815 * The contents of the video surface underneath the blit destination are |
768 not defined. | 816 * not defined. |
769 The width and height of the destination rectangle may be different from | 817 * The width and height of the destination rectangle may be different from |
770 that of the overlay, but currently only 2x scaling is supported. | 818 * that of the overlay, but currently only 2x scaling is supported. |
771 */ | 819 */ |
772 extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); | 820 extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); |
773 | 821 |
774 /* Free a video overlay */ | 822 /** Free a video overlay */ |
775 extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); | 823 extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); |
776 | 824 |
825 /*@}*/ | |
777 | 826 |
778 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 827 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
779 /* OpenGL support functions. */ | 828 /** @name OpenGL support functions. */ /*@{*/ |
780 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 829 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
781 | 830 |
782 /* | 831 /** |
783 * Dynamically load an OpenGL library, or the default one if path is NULL | 832 * Dynamically load an OpenGL library, or the default one if path is NULL |
784 * | 833 * |
785 * If you do this, you need to retrieve all of the GL functions used in | 834 * If you do this, you need to retrieve all of the GL functions used in |
786 * your program from the dynamic library using SDL_GL_GetProcAddress(). | 835 * your program from the dynamic library using SDL_GL_GetProcAddress(). |
787 */ | 836 */ |
788 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); | 837 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); |
789 | 838 |
790 /* | 839 /** |
791 * Get the address of a GL function | 840 * Get the address of a GL function |
792 */ | 841 */ |
793 extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); | 842 extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); |
794 | 843 |
795 /* | 844 /** |
796 * Set an attribute of the OpenGL subsystem before intialization. | 845 * Set an attribute of the OpenGL subsystem before intialization. |
797 */ | 846 */ |
798 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); | 847 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); |
799 | 848 |
800 /* | 849 /** |
801 * Get an attribute of the OpenGL subsystem from the windowing | 850 * Get an attribute of the OpenGL subsystem from the windowing |
802 * interface, such as glX. This is of course different from getting | 851 * interface, such as glX. This is of course different from getting |
803 * the values from SDL's internal OpenGL subsystem, which only | 852 * the values from SDL's internal OpenGL subsystem, which only |
804 * stores the values you request before initialization. | 853 * stores the values you request before initialization. |
805 * | 854 * |
806 * Developers should track the values they pass into SDL_GL_SetAttribute | 855 * Developers should track the values they pass into SDL_GL_SetAttribute |
807 * themselves if they want to retrieve these values. | 856 * themselves if they want to retrieve these values. |
808 */ | 857 */ |
809 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); | 858 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); |
810 | 859 |
811 /* | 860 /** |
812 * Swap the OpenGL buffers, if double-buffering is supported. | 861 * Swap the OpenGL buffers, if double-buffering is supported. |
813 */ | 862 */ |
814 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); | 863 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); |
815 | 864 |
816 /* | 865 /** @name OpenGL Internal Functions |
817 * Internal functions that should not be called unless you have read | 866 * Internal functions that should not be called unless you have read |
818 * and understood the source code for these functions. | 867 * and understood the source code for these functions. |
819 */ | 868 */ |
869 /*@{*/ | |
820 extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); | 870 extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); |
821 extern DECLSPEC void SDLCALL SDL_GL_Lock(void); | 871 extern DECLSPEC void SDLCALL SDL_GL_Lock(void); |
822 extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); | 872 extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); |
873 /*@}*/ | |
874 | |
875 /*@}*/ | |
823 | 876 |
824 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 877 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
825 /* These functions allow interaction with the window manager, if any. */ | 878 /** @name Window Manager Functions */ |
879 /** These functions allow interaction with the window manager, if any. */ /*@{*/ | |
826 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 880 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
827 | 881 |
828 /* | 882 /** |
829 * Sets/Gets the title and icon text of the display window (UTF-8 encoded) | 883 * Sets the title and icon text of the display window (UTF-8 encoded) |
830 */ | 884 */ |
831 extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); | 885 extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); |
886 /** | |
887 * Gets the title and icon text of the display window (UTF-8 encoded) | |
888 */ | |
832 extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); | 889 extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); |
833 | 890 |
834 /* | 891 /** |
835 * Sets the icon for the display window. | 892 * Sets the icon for the display window. |
836 * This function must be called before the first call to SDL_SetVideoMode(). | 893 * This function must be called before the first call to SDL_SetVideoMode(). |
837 * It takes an icon surface, and a mask in MSB format. | 894 * It takes an icon surface, and a mask in MSB format. |
838 * If 'mask' is NULL, the entire icon surface will be used as the icon. | 895 * If 'mask' is NULL, the entire icon surface will be used as the icon. |
839 */ | 896 */ |
840 extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); | 897 extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); |
841 | 898 |
842 /* | 899 /** |
843 * This function iconifies the window, and returns 1 if it succeeded. | 900 * This function iconifies the window, and returns 1 if it succeeded. |
844 * If the function succeeds, it generates an SDL_APPACTIVE loss event. | 901 * If the function succeeds, it generates an SDL_APPACTIVE loss event. |
845 * This function is a noop and returns 0 in non-windowed environments. | 902 * This function is a noop and returns 0 in non-windowed environments. |
846 */ | 903 */ |
847 extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); | 904 extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); |
848 | 905 |
849 /* | 906 /** |
850 * Toggle fullscreen mode without changing the contents of the screen. | 907 * Toggle fullscreen mode without changing the contents of the screen. |
851 * If the display surface does not require locking before accessing | 908 * If the display surface does not require locking before accessing |
852 * the pixel information, then the memory pointers will not change. | 909 * the pixel information, then the memory pointers will not change. |
853 * | 910 * |
854 * If this function was able to toggle fullscreen mode (change from | 911 * If this function was able to toggle fullscreen mode (change from |
861 * | 918 * |
862 * This is currently only implemented in the X11 video driver. | 919 * This is currently only implemented in the X11 video driver. |
863 */ | 920 */ |
864 extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); | 921 extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); |
865 | 922 |
866 /* | |
867 * This function allows you to set and query the input grab state of | |
868 * the application. It returns the new input grab state. | |
869 */ | |
870 typedef enum { | 923 typedef enum { |
871 SDL_GRAB_QUERY = -1, | 924 SDL_GRAB_QUERY = -1, |
872 SDL_GRAB_OFF = 0, | 925 SDL_GRAB_OFF = 0, |
873 SDL_GRAB_ON = 1, | 926 SDL_GRAB_ON = 1, |
874 SDL_GRAB_FULLSCREEN /* Used internally */ | 927 SDL_GRAB_FULLSCREEN /**< Used internally */ |
875 } SDL_GrabMode; | 928 } SDL_GrabMode; |
876 /* | 929 /** |
930 * This function allows you to set and query the input grab state of | |
931 * the application. It returns the new input grab state. | |
932 * | |
877 * Grabbing means that the mouse is confined to the application window, | 933 * Grabbing means that the mouse is confined to the application window, |
878 * and nearly all keyboard input is passed directly to the application, | 934 * and nearly all keyboard input is passed directly to the application, |
879 * and not interpreted by a window manager, if any. | 935 * and not interpreted by a window manager, if any. |
880 */ | 936 */ |
881 extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); | 937 extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); |
882 | 938 |
883 /* Not in public API at the moment - do not use! */ | 939 /*@}*/ |
940 | |
941 /** @internal Not in public API at the moment - do not use! */ | |
884 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, | 942 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, |
885 SDL_Surface *dst, SDL_Rect *dstrect); | 943 SDL_Surface *dst, SDL_Rect *dstrect); |
886 | 944 |
887 /* Ends C function definitions when using C++ */ | 945 /* Ends C function definitions when using C++ */ |
888 #ifdef __cplusplus | 946 #ifdef __cplusplus |