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