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