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