146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL - Simple DirectMedia Layer 346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Copyright (C) 1997-2006 Sam Lantinga 446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner This library is free software; you can redistribute it and/or 646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner modify it under the terms of the GNU Lesser General Public 746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner License as published by the Free Software Foundation; either 846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner version 2.1 of the License, or (at your option) any later version. 946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 1046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner This library is distributed in the hope that it will be useful, 1146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner but WITHOUT ANY WARRANTY; without even the implied warranty of 1246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Lesser General Public License for more details. 1446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 1546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner You should have received a copy of the GNU Lesser General Public 1646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner License along with this library; if not, write to the Free Software 1746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 1846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 1946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Sam Lantinga 2046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner slouken@libsdl.org 2146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 2246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 2346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Header file for access to the SDL raw framebuffer window */ 2446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 2546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#ifndef _SDL_video_h 2646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define _SDL_video_h 2746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 2846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#include "SDL_stdinc.h" 2946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#include "SDL_error.h" 3046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#include "SDL_rwops.h" 3146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 3246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#include "begin_code.h" 3346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Set up for C function definitions, even when using C++ */ 3446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#ifdef __cplusplus 3546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern "C" { 3646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#endif 3746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 3846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Transparency definitions: These define alpha as the opacity of a surface */ 3946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_ALPHA_OPAQUE 255 4046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_ALPHA_TRANSPARENT 0 4146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 4246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Useful data types */ 4346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_Rect { 4446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Sint16 x, y; 4546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint16 w, h; 4646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_Rect; 4746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 4846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_Color { 4946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 r; 5046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 g; 5146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 b; 5246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 unused; 5346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_Color; 5446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_Colour SDL_Color 5546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 5646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_Palette { 5746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int ncolors; 5846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Color *colors; 5946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_Palette; 6046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 6146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Everything in the pixel format structure is read-only */ 6246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_PixelFormat { 6346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Palette *palette; 6446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 BitsPerPixel; 6546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 BytesPerPixel; 6646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Rloss; 6746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Gloss; 6846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Bloss; 6946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Aloss; 7046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Rshift; 7146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Gshift; 7246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Bshift; 7346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 Ashift; 7446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Rmask; 7546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Gmask; 7646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Bmask; 7746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Amask; 7846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 7946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* RGB color key information */ 8046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 colorkey; 8146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Alpha value information (per-surface alpha) */ 8246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 alpha; 8346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_PixelFormat; 8446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 8546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* This structure should be treated as read-only, except for 'pixels', 8646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner which, if not NULL, contains the raw pixel data for the surface. 8746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 8846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_Surface { 8946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 flags; /* Read-only */ 9046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_PixelFormat *format; /* Read-only */ 9146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int w, h; /* Read-only */ 9246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint16 pitch; /* Read-only */ 9346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner void *pixels; /* Read-write */ 9446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int offset; /* Private */ 9546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 9646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Hardware-specific surface info */ 9746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner struct private_hwdata *hwdata; 9846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 9946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* clipping information */ 10046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Rect clip_rect; /* Read-only */ 10146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 unused1; /* for binary compatibility */ 10246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 10346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Allow recursive locks */ 10446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 locked; /* Private */ 10546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 10646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* info for fast blit mapping to other surfaces */ 10746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner struct SDL_BlitMap *map; /* Private */ 10846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 10946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* format version, bumped at every change to invalidate blit maps */ 11046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner unsigned int format_version; /* Private */ 11146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 11246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Reference count -- used when freeing surface */ 11346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int refcount; /* Read-mostly */ 11446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_Surface; 11546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 11646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* These are the currently supported flags for the SDL_surface */ 11746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ 11846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ 11946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ 12046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ 12146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Available for SDL_SetVideoMode() */ 12246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ 12346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ 12446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ 12546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ 12646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ 12746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ 12846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ 12946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ 13046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Used internally (read-only) */ 13146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ 13246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ 13346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_RLEACCELOK 0x00002000 /* Private flag */ 13446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ 13546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ 13646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ 13746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 13846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Evaluates to true if the surface needs to be locked before access */ 13946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_MUSTLOCK(surface) \ 14046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (surface->offset || \ 14146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) 14246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 14346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* typedef for private surface blitting functions */ 14446be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, 14546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner struct SDL_Surface *dst, SDL_Rect *dstrect); 14646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 14746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 14846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Useful for determining the video hardware capabilities */ 14946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_VideoInfo { 15046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ 15146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ 15246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 UnusedBits1 :6; 15346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 UnusedBits2 :1; 15446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ 15546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ 15646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ 15746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ 15846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ 15946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ 16046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 blit_fill :1; /* Flag: Accelerated color fill */ 16146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 UnusedBits3 :16; 16246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 video_mem; /* The total amount of video memory (in K) */ 16346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ 16446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int current_w; /* Value: The current video mode width */ 16546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int current_h; /* Value: The current video mode height */ 16646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_VideoInfo; 16746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 16846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 16946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* The most common video overlay formats. 17046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner For an explanation of these pixel formats, see: 17146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner http://www.webartz.com/fourcc/indexyuv.htm 17246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 17346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner For information on the relationship between color spaces, see: 17446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html 17546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 17646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ 17746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ 17846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ 17946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ 18046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ 18146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 18246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* The YUV hardware video overlay */ 18346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef struct SDL_Overlay { 18446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 format; /* Read-only */ 18546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int w, h; /* Read-only */ 18646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int planes; /* Read-only */ 18746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint16 *pitches; /* Read-only */ 18846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 **pixels; /* Read-write */ 18946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 19046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Hardware-specific surface info */ 19146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner struct private_yuvhwfuncs *hwfuncs; 19246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner struct private_yuvhwdata *hwdata; 19346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 19446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner /* Special flags */ 19546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ 19646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 UnusedBits :31; 19746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_Overlay; 19846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 19946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 20046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Public enumeration for setting the OpenGL window attributes. */ 20146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef enum { 20246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_RED_SIZE, 20346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_GREEN_SIZE, 20446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_BLUE_SIZE, 20546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ALPHA_SIZE, 20646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_BUFFER_SIZE, 20746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_DOUBLEBUFFER, 20846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_DEPTH_SIZE, 20946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_STENCIL_SIZE, 21046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ACCUM_RED_SIZE, 21146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ACCUM_GREEN_SIZE, 21246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ACCUM_BLUE_SIZE, 21346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ACCUM_ALPHA_SIZE, 21446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_STEREO, 21546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_MULTISAMPLEBUFFERS, 21646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_MULTISAMPLESAMPLES, 21746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_ACCELERATED_VISUAL, 21846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GL_SWAP_CONTROL 21946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_GLattr; 22046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 22146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* flags for SDL_SetPalette() */ 22246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_LOGPAL 0x01 22346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_PHYSPAL 0x02 22446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 22546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Function prototypes */ 22646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 22746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* These functions are used internally, and should not be used unless you 22846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * have a specific need to specify the video driver you want to use. 22946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * You should normally use SDL_Init() or SDL_InitSubSystem(). 23046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 23146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_VideoInit() initializes the video subsystem -- sets up a connection 23246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to the window manager, etc, and determines the current video mode and 23346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * pixel format, but does not initialize a window or graphics mode. 23446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Note that event handling is activated by this routine. 23546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 23646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If you use both sound and video in your application, you need to call 23746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, 23846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * you won't be able to set full-screen display modes. 23946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 24046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); 24146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_VideoQuit(void); 24246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 24346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* This function fills the given character buffer with the name of the 24446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * video driver, and returns a pointer to it if the video driver has 24546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * been initialized. It returns NULL if no driver has been initialized. 24646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 24746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); 24846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 24946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 25046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns a pointer to the current display surface. 25146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL is doing format conversion on the display surface, this 25246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * function returns the publicly visible surface, not the real video 25346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * surface. 25446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 25546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); 25646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 25746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 25846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns a read-only pointer to information about the 25946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' 26046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * member of the returned structure will contain the pixel format of the 26146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * "best" video mode. 26246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 26346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); 26446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 26546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 26646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Check to see if a particular video mode is supported. 26746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * It returns 0 if the requested mode is not supported under any bit depth, 26846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * or returns the bits-per-pixel of the closest available mode with the 26946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * given width and height. If this bits-per-pixel is different from the 27046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * one used when setting the video mode, SDL_SetVideoMode() will succeed, 27146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * but will emulate the requested bits-per-pixel with a shadow surface. 27246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 27346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The arguments to SDL_VideoModeOK() are the same ones you would pass to 27446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SetVideoMode() 27546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 27646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); 27746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 27846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 27946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Return a pointer to an array of available screen dimensions for the 28046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * given format and video flags, sorted largest to smallest. Returns 28146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * NULL if there are no dimensions available for a particular format, 28246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * or (SDL_Rect **)-1 if any dimension is okay for the given format. 28346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 28446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'format' is NULL, the mode list will be for the format given 28546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * by SDL_GetVideoInfo()->vfmt 28646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 28746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); 28846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 28946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 29046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Set up a video mode with the specified width, height and bits-per-pixel. 29146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 29246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'bpp' is 0, it is treated as the current display bits per pixel. 29346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 29446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the 29546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * requested bits-per-pixel, but will return whatever video pixel format is 29646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * available. The default is to emulate the requested pixel format if it 29746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * is not natively available. 29846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 29946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in 30046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * video memory, if possible, and you may have to call SDL_LockSurface() 30146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * in order to access the raw framebuffer. Otherwise, the video surface 30246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * will be created in system memory. 30346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 30446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle 30546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * updates asynchronously, but you must always lock before accessing pixels. 30646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL will wait for updates to complete before returning from the lock. 30746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 30846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee 30946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * that the colors set by SDL_SetColors() will be the colors you get. 31046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all 31146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * of the colors exactly the way they are requested, and you should look 31246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * at the video surface structure to determine the actual palette. 31346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL cannot guarantee that the colors you request can be set, 31446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * i.e. if the colormap is shared, then the video surface may be created 31546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * under emulation in system memory, overriding the SDL_HWSURFACE flag. 31646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 31746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set 31846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * a fullscreen video mode. The default is to create a windowed mode 31946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if the current graphics system has a window manager. 32046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the SDL library is able to set a fullscreen video mode, this flag 32146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * will be set in the surface that is returned. 32246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 32346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up 32446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * two surfaces in video memory and swap between them when you call 32546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_Flip(). This is usually slower than the normal single-buffering 32646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * scheme, but prevents "tearing" artifacts caused by modifying video 32746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * memory while the monitor is refreshing. It should only be used by 32846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * applications that redraw the entire screen on every update. 32946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 33046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the 33146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * window manager, if any, to resize the window at runtime. When this 33246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * occurs, SDL will send a SDL_VIDEORESIZE event to you application, 33346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and you must respond to the event by re-calling SDL_SetVideoMode() 33446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * with the requested size (or another size that suits the application). 33546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 33646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If SDL_NOFRAME is set in 'flags', the SDL library will create a window 33746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * without any title bar or frame decoration. Fullscreen video modes have 33846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * this flag set automatically. 33946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 34046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns the video framebuffer surface, or NULL if it fails. 34146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 34246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If you rely on functionality provided by certain video flags, check the 34346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * flags of the returned surface to make sure that functionality is available. 34446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL will fall back to reduced functionality if the exact flags you wanted 34546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * are not available. 34646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 34746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode 34846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (int width, int height, int bpp, Uint32 flags); 34946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 35046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 35146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Makes sure the given list of rectangles is updated on the given screen. 35246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire 35346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * screen. 35446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * These functions should not be called while 'screen' is locked. 35546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 35646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_UpdateRects 35746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *screen, int numrects, SDL_Rect *rects); 35846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_UpdateRect 35946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); 36046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 36146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 36246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * On hardware that supports double-buffering, this function sets up a flip 36346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and returns. The hardware will wait for vertical retrace, and then swap 36446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * video buffers before the next video surface blit or lock will return. 36546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * On hardware that doesn not support double-buffering, this is equivalent 36646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); 36746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when 36846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * setting the video mode for this function to perform hardware flipping. 36946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns 0 if successful, or -1 if there was an error. 37046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 37146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); 37246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 37346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 37446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Set the gamma correction for each of the color channels. 37546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The gamma values range (approximately) between 0.1 and 10.0 37646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 37746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If this function isn't supported directly by the hardware, it will 37846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * be emulated using gamma ramps, if available. If successful, this 37946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * function returns 0, otherwise it returns -1. 38046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 38146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); 38246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 38346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 38446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Set the gamma translation table for the red, green, and blue channels 38546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * of the video hardware. Each table is an array of 256 16-bit quantities, 38646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * representing a mapping between the input and output for that channel. 38746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The input is the index into the array, and the output is the 16-bit 38846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * gamma value at that index, scaled to the output color precision. 38946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 39046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * You may pass NULL for any of the channels to leave it unchanged. 39146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the call succeeds, it will return 0. If the display driver or 39246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * hardware does not support gamma translation, or otherwise fails, 39346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * this function will return -1. 39446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 39546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); 39646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 39746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 39846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Retrieve the current values of the gamma translation tables. 39946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 40046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * You must pass in valid pointers to arrays of 256 16-bit quantities. 40146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Any of the pointers may be NULL to ignore that channel. 40246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the call succeeds, it will return 0. If the display driver or 40346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * hardware does not support gamma translation, or otherwise fails, 40446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * this function will return -1. 40546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 40646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); 40746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 40846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 40946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets a portion of the colormap for the given 8-bit surface. If 'surface' 41046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * is not a palettized surface, this function does nothing, returning 0. 41146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If all of the colors were set as passed to SDL_SetColors(), it will 41246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * return 1. If not all the color entries were set exactly as given, 41346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * it will return 0, and you should look at the surface palette to 41446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * determine the actual color palette. 41546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 41646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * When 'surface' is the surface associated with the current display, the 41746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * display colormap will be updated with the requested colors. If 41846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() 41946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * will always return 1, and the palette is guaranteed to be set the way 42046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * you desire, even if the window colormap has to be warped or run under 42146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * emulation. 42246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 42346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, 42446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Color *colors, int firstcolor, int ncolors); 42546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 42646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 42746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets a portion of the colormap for a given 8-bit surface. 42846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 'flags' is one or both of: 42946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_LOGPAL -- set logical palette, which controls how blits are mapped 43046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to/from the surface, 43146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_PHYSPAL -- set physical palette, which controls how pixels look on 43246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the screen 43346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Only screens have physical palettes. Separate change of physical/logical 43446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * palettes is only possible if the screen has SDL_HWPALETTE set. 43546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 43646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The return value is 1 if all colours could be set as requested, and 0 43746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * otherwise. 43846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 43946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SetColors() is equivalent to calling this function with 44046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * flags = (SDL_LOGPAL|SDL_PHYSPAL). 44146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 44246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, 44346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Color *colors, int firstcolor, 44446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int ncolors); 44546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 44646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 44746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Maps an RGB triple to an opaque pixel value for a given pixel format 44846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 44946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC Uint32 SDLCALL SDL_MapRGB 45046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner(const SDL_PixelFormat * const format, 45146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner const Uint8 r, const Uint8 g, const Uint8 b); 45246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 45346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 45446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Maps an RGBA quadruple to a pixel value for a given pixel format 45546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 45646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC Uint32 SDLCALL SDL_MapRGBA 45746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner(const SDL_PixelFormat * const format, 45846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); 45946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 46046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 46146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Maps a pixel value into the RGB components for a given pixel format 46246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 46346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, 46446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 *r, Uint8 *g, Uint8 *b); 46546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 46646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 46746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Maps a pixel value into the RGBA components for a given pixel format 46846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 46946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, 47046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); 47146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 47246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 47346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) 47446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. 47546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the depth is greater than 8 bits, the pixel format is set using the 47646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * flags '[RGB]mask'. 47746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the function runs out of memory, it will return NULL. 47846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 47946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The 'flags' tell what kind of surface to create. 48046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SWSURFACE means that the surface should be created in system memory. 48146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_HWSURFACE means that the surface should be created in video memory, 48246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * with the same format as the display surface. This is useful for surfaces 48346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * that will not change much, to take advantage of hardware acceleration 48446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * when being blitted to the display surface. 48546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with 48646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * this surface, but you must always lock it before accessing the pixels. 48746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL will wait for current blits to finish before returning from the lock. 48846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. 48946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the hardware supports acceleration of colorkey blits between 49046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * two surfaces in video memory, SDL will try to place the surface in 49146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * video memory. If this isn't possible or if there is no hardware 49246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * acceleration available, the surface will be placed in system memory. 49346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA means that the surface will be used for alpha blits and 49446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if the hardware supports hardware acceleration of alpha blits between 49546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * two surfaces in video memory, to place the surface in video memory 49646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if possible, otherwise it will be placed in system memory. 49746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the surface is created in video memory, blits will be _much_ faster, 49846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * but the surface format must be identical to the video surface format, 49946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and the only way to access the pixels member of the surface is to use 50046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the SDL_LockSurface() and SDL_UnlockSurface() calls. 50146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the requested surface actually resides in video memory, SDL_HWSURFACE 50246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * will be set in the flags member of the returned surface. If for some 50346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * reason the surface could not be placed in video memory, it will not have 50446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the SDL_HWSURFACE flag set, and will be created in system memory instead. 50546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 50646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_AllocSurface SDL_CreateRGBSurface 50746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface 50846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (Uint32 flags, int width, int height, int depth, 50946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); 51046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, 51146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner int width, int height, int depth, int pitch, 51246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); 51346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); 51446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 51546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 51646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_LockSurface() sets up a surface for directly accessing the pixels. 51746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write 51846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to and read from 'surface->pixels', using the pixel format stored in 51946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 'surface->format'. Once you are done accessing the surface, you should 52046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * use SDL_UnlockSurface() to release it. 52146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 52246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates 52346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to 0, then you can read and write to the surface at any time, and the 52446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * pixel format of the surface will not change. In particular, if the 52546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you 52646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * will not need to lock the display surface before accessing it. 52746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 52846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * No operating system or library calls should be made between lock/unlock 52946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * pairs, as critical system locks may be held during this time. 53046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 53146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. 53246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 53346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); 53446be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); 53546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 53646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 53746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Load a surface from a seekable SDL data source (memory or file.) 53846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'freesrc' is non-zero, the source will be closed after being read. 53946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Returns the new surface, or NULL if there was an error. 54046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The new surface should be freed with SDL_FreeSurface(). 54146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 54246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); 54346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 54446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Convenience macro -- load a surface from a file */ 54546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) 54646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 54746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 54846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Save a surface to a seekable SDL data source (memory or file.) 54946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'freedst' is non-zero, the source will be closed after being written. 55046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Returns 0 if successful or -1 if there was an error. 55146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 55246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SaveBMP_RW 55346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *surface, SDL_RWops *dst, int freedst); 55446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 55546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Convenience macro -- save a surface to a file */ 55646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_SaveBMP(surface, file) \ 55746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) 55846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 55946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 56046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets the color key (transparent pixel) in a blittable surface. 56146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 56246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 'key' will be the transparent pixel in the source image of a blit. 56346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_RLEACCEL requests RLE acceleration for the surface if present, 56446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and removes RLE acceleration if absent. 56546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'flag' is 0, this function clears any current color key. 56646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns 0, or -1 if there was an error. 56746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 56846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetColorKey 56946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *surface, Uint32 flag, Uint32 key); 57046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 57146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 57246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function sets the alpha value for the entire surface, as opposed to 57346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * using the alpha component of each pixel. This value measures the range 57446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * of transparency of the surface, 0 being completely transparent to 255 57546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * being completely opaque. An 'alpha' value of 255 causes blits to be 57646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * opaque, the source pixels copied to the destination (the default). Note 57746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * that per-surface alpha can be combined with colorkey transparency. 57846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 57946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'flag' is 0, alpha blending is disabled for the surface. 58046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. 58146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the 58246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. 58346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 58446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The 'alpha' parameter is ignored for surfaces that have an alpha channel. 58546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 58646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); 58746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 58846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 58946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets the clipping rectangle for the destination surface in a blit. 59046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 59146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the clip rectangle is NULL, clipping will be disabled. 59246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the clip rectangle doesn't intersect the surface, the function will 59346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * return SDL_FALSE and blits will be completely clipped. Otherwise the 59446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * function returns SDL_TRUE and blits to the surface will be clipped to 59546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the intersection of the surface area and the clipping rectangle. 59646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 59746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Note that blits are automatically clipped to the edges of the source 59846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and destination surfaces. 59946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 60046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); 60146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 60246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 60346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Gets the clipping rectangle for the destination surface in a blit. 60446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 'rect' must be a pointer to a valid rectangle which will be filled 60546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * with the correct values. 60646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 60746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); 60846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 60946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 61046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Creates a new surface of the specified format, and then copies and maps 61146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the given surface to it so the blit of the converted surface will be as 61246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * fast as possible. If this function fails, it returns NULL. 61346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 61446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 61546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * semantics. You can also pass SDL_RLEACCEL in the flags parameter and 61646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL will try to RLE accelerate colorkey and alpha blits in the resulting 61746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * surface. 61846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 61946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function is used internally by SDL_DisplayFormat(). 62046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 62146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface 62246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); 62346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 62446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 62546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This performs a fast blit from the source surface to the destination 62646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * surface. It assumes that the source and destination rectangles are 62746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire 62846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * surface (src or dst) is copied. The final blit rectangles are saved 62946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * in 'srcrect' and 'dstrect' after all clipping is performed. 63046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the blit is successful, it returns 0, otherwise it returns -1. 63146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 63246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The blit function should not be called on a locked surface. 63346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 63446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The blit semantics for surfaces with and without alpha and colorkey 63546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * are defined as follows: 63646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 63746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGBA->RGB: 63846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA set: 63946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * alpha-blend (using alpha-channel). 64046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCCOLORKEY ignored. 64146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA not set: 64246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * copy RGB. 64346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if SDL_SRCCOLORKEY set, only copy the pixels matching the 64446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGB values of the source colour key, ignoring alpha in the 64546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * comparison. 64646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 64746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGB->RGBA: 64846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA set: 64946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * alpha-blend (using the source per-surface alpha value); 65046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * set destination alpha to opaque. 65146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA not set: 65246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * copy RGB, set destination alpha to source per-surface alpha value. 65346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * both: 65446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if SDL_SRCCOLORKEY set, only copy the pixels matching the 65546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * source colour key. 65646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 65746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGBA->RGBA: 65846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA set: 65946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * alpha-blend (using the source alpha channel) the RGB values; 66046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * leave destination alpha untouched. [Note: is this correct?] 66146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCCOLORKEY ignored. 66246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA not set: 66346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * copy all of RGBA to the destination. 66446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if SDL_SRCCOLORKEY set, only copy the pixels matching the 66546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGB values of the source colour key, ignoring alpha in the 66646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * comparison. 66746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 66846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * RGB->RGB: 66946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA set: 67046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * alpha-blend (using the source per-surface alpha value). 67146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * SDL_SRCALPHA not set: 67246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * copy RGB. 67346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * both: 67446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if SDL_SRCCOLORKEY set, only copy the pixels matching the 67546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * source colour key. 67646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 67746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If either of the surfaces were in video memory, and the blit returns -2, 67846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the video memory was lost, so it should be reloaded with artwork and 67946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * re-blitted: 68046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { 68146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner while ( SDL_LockSurface(image) < 0 ) 68246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Sleep(10); 68346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner -- Write image pixels to image->pixels -- 68446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_UnlockSurface(image); 68546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner } 68646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This happens under DirectX 5.0 when the system switches away from your 68746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * fullscreen application. The lock will also fail until you have access 68846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * to the video memory again. 68946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 69046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* You should call SDL_BlitSurface() unless you know exactly how SDL 69146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner blitting works internally and how to use the other blit functions. 69246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 69346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#define SDL_BlitSurface SDL_UpperBlit 69446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 69546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* This is the public blit function, SDL_BlitSurface(), and it performs 69646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner rectangle validation and clipping before passing it to SDL_LowerBlit() 69746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 69846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_UpperBlit 69946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *src, SDL_Rect *srcrect, 70046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Surface *dst, SDL_Rect *dstrect); 70146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* This is a semi-private blit function and it performs low-level surface 70246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner blitting only. 70346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 70446be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_LowerBlit 70546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *src, SDL_Rect *srcrect, 70646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Surface *dst, SDL_Rect *dstrect); 70746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 70846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 70946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function performs a fast fill of the given rectangle with 'color' 71046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The given rectangle is clipped to the destination surface clip area 71146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and the final fill rectangle is saved in the passed in pointer. 71246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'dstrect' is NULL, the whole surface will be filled with 'color' 71346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The color should be a pixel of the format used by the surface, and 71446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * can be generated by the SDL_MapRGB() function. 71546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function returns 0 on success, or -1 on error. 71646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 71746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_FillRect 71846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); 71946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 72046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 72146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function takes a surface and copies it to a new surface of the 72246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * pixel format and colors of the video framebuffer, suitable for fast 72346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * blitting onto the display surface. It calls SDL_ConvertSurface() 72446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 72546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If you want to take advantage of hardware colorkey or alpha blit 72646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * acceleration, you should set the colorkey and alpha value before 72746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * calling this function. 72846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 72946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the conversion fails or runs out of memory, it returns NULL 73046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 73146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); 73246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 73346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 73446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function takes a surface and copies it to a new surface of the 73546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * pixel format and colors of the video framebuffer (if possible), 73646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * suitable for fast alpha blitting onto the display surface. 73746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The new surface will always have an alpha channel. 73846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 73946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If you want to take advantage of hardware colorkey or alpha blit 74046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * acceleration, you should set the colorkey and alpha value before 74146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * calling this function. 74246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 74346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the conversion fails or runs out of memory, it returns NULL 74446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 74546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); 74646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 74746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 74846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 74946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* YUV video surface overlay functions */ 75046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 75146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 75246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* This function creates a video output overlay 75346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Calling the returned surface an overlay is something of a misnomer because 75446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner the contents of the display surface underneath the area where the overlay 75546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner is shown is undefined - it may be overwritten with the converted YUV data. 75646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 75746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, 75846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner Uint32 format, SDL_Surface *display); 75946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 76046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Lock an overlay for direct access, and unlock it when you are done */ 76146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); 76246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); 76346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 76446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Blit a video overlay to the display surface. 76546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner The contents of the video surface underneath the blit destination are 76646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner not defined. 76746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner The width and height of the destination rectangle may be different from 76846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner that of the overlay, but currently only 2x scaling is supported. 76946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner*/ 77046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); 77146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 77246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Free a video overlay */ 77346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); 77446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 77546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 77646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 77746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* OpenGL support functions. */ 77846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 77946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 78046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 78146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Dynamically load an OpenGL library, or the default one if path is NULL 78246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 78346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If you do this, you need to retrieve all of the GL functions used in 78446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * your program from the dynamic library using SDL_GL_GetProcAddress(). 78546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 78646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); 78746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 78846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 78946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Get the address of a GL function 79046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 79146be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); 79246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 79346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 79446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Set an attribute of the OpenGL subsystem before intialization. 79546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 79646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); 79746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 79846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 79946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Get an attribute of the OpenGL subsystem from the windowing 80046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * interface, such as glX. This is of course different from getting 80146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the values from SDL's internal OpenGL subsystem, which only 80246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * stores the values you request before initialization. 80346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 80446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Developers should track the values they pass into SDL_GL_SetAttribute 80546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * themselves if they want to retrieve these values. 80646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 80746be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); 80846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 80946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 81046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Swap the OpenGL buffers, if double-buffering is supported. 81146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 81246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); 81346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 81446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 81546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Internal functions that should not be called unless you have read 81646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and understood the source code for these functions. 81746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 81846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); 81946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GL_Lock(void); 82046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_GL_Unlock(void); 82146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 82246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 82346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* These functions allow interaction with the window manager, if any. */ 82446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 82546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 82646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 82746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets/Gets the title and icon text of the display window (UTF-8 encoded) 82846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 82946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); 83046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); 83146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 83246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 83346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Sets the icon for the display window. 83446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function must be called before the first call to SDL_SetVideoMode(). 83546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * It takes an icon surface, and a mask in MSB format. 83646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If 'mask' is NULL, the entire icon surface will be used as the icon. 83746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 83846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 83946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 84046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 84146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function iconifies the window, and returns 1 if it succeeded. 84246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the function succeeds, it generates an SDL_APPACTIVE loss event. 84346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function is a noop and returns 0 in non-windowed environments. 84446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 84546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); 84646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 84746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 84846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Toggle fullscreen mode without changing the contents of the screen. 84946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the display surface does not require locking before accessing 85046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the pixel information, then the memory pointers will not change. 85146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 85246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If this function was able to toggle fullscreen mode (change from 85346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * running in a window to fullscreen, or vice-versa), it will return 1. 85446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If it is not implemented, or fails, it returns 0. 85546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 85646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * The next call to SDL_SetVideoMode() will set the mode fullscreen 85746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * attribute based on the flags parameter - if SDL_FULLSCREEN is not 85846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * set, then the display will be windowed by default where supported. 85946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 86046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This is currently only implemented in the X11 video driver. 86146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 86246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); 86346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 86446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 86546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * This function allows you to set and query the input grab state of 86646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the application. It returns the new input grab state. 86746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 86846be48730333120a7b939116cef075e61c12c703David 'Digit' Turnertypedef enum { 86946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GRAB_QUERY = -1, 87046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GRAB_OFF = 0, 87146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GRAB_ON = 1, 87246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_GRAB_FULLSCREEN /* Used internally */ 87346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} SDL_GrabMode; 87446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 87546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Grabbing means that the mouse is confined to the application window, 87646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and nearly all keyboard input is passed directly to the application, 87746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * and not interpreted by a window manager, if any. 87846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 87946be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); 88046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 88146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 88246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Move the SDL Window to a specify position. does nothing in fullscreen mode 88346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * 88446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 88546be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDL_WM_SetPos(int x, int y); 88646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 88746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 88846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Get the current SDL window position. returns (0,0) in fullscreen mode 88946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 89046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC void SDL_WM_GetPos(int *px, int *py); 89146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 89246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 89346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * If the window is fully visible, return TRUE; otherwise, recenter the window 89446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * if the 'recenter' parameter is non-0, and return FALSE. 89546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 89646be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDL_WM_IsFullyVisible( int recenter ); 89746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 89846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 89946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Get the resolution of the main monitor in DPIs, if available. 90046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Return 0 on success, or -1 if the data is not available 90146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 90246be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDL_WM_GetMonitorDPI( int *xDpi, int *yDpi ); 90346be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 90446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* 90546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Get the coordinates of the monitor in virtual desktop space. 90646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * In the case of multi-monitor systems, returns the rectangle of 90746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * the 'nearest' monitor relative to the main SDL_window. 90846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner * Returns 0 on success, or -1 if the data is not available. 90946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner */ 91046be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDL_WM_GetMonitorRect( SDL_Rect *rect ); 91146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 91246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Not in public API at the moment - do not use! */ 91346be48730333120a7b939116cef075e61c12c703David 'Digit' Turnerextern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, 91446be48730333120a7b939116cef075e61c12c703David 'Digit' Turner SDL_Surface *dst, SDL_Rect *dstrect); 91546be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 91646be48730333120a7b939116cef075e61c12c703David 'Digit' Turner/* Ends C function definitions when using C++ */ 91746be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#ifdef __cplusplus 91846be48730333120a7b939116cef075e61c12c703David 'Digit' Turner} 91946be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#endif 92046be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#include "close_code.h" 92146be48730333120a7b939116cef075e61c12c703David 'Digit' Turner 92246be48730333120a7b939116cef075e61c12c703David 'Digit' Turner#endif /* _SDL_video_h */ 923