SDL_video.h revision e4c5d95ed37611acc6a186522315195b4ebfb9ef
19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Lesser General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2.1 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Lesser General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Lesser General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free Software 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @file SDL_video.h 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Header file for access to the SDL raw framebuffer window 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifndef _SDL_video_h 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define _SDL_video_h 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_stdinc.h" 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_error.h" 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_rwops.h" 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "begin_code.h" 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Set up for C function definitions, even when using C++ */ 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern "C" { 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name Transparency definitions 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * These define alpha as the opacity of a surface 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_ALPHA_OPAQUE 255 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_ALPHA_TRANSPARENT 0 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name Useful data types */ 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_Rect { 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sint16 x, y; 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 w, h; 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_Rect; 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_Color { 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 r; 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 g; 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 b; 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 unused; 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_Color; 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_Colour SDL_Color 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_Palette { 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int ncolors; 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Color *colors; 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_Palette; 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Everything in the pixel format structure is read-only */ 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_PixelFormat { 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Palette *palette; 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 BitsPerPixel; 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 BytesPerPixel; 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Rloss; 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Gloss; 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Bloss; 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Aloss; 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Rshift; 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Gshift; 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Bshift; 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 Ashift; 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Rmask; 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Gmask; 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Bmask; 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Amask; 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** RGB color key information */ 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 colorkey; 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** Alpha value information (per-surface alpha) */ 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 alpha; 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_PixelFormat; 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This structure should be treated as read-only, except for 'pixels', 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * which, if not NULL, contains the raw pixel data for the surface. 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_Surface { 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 flags; /**< Read-only */ 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *format; /**< Read-only */ 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int w, h; /**< Read-only */ 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 pitch; /**< Read-only */ 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall void *pixels; /**< Read-write */ 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int offset; /**< Private */ 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** Hardware-specific surface info */ 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct private_hwdata *hwdata; 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** clipping information */ 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Rect clip_rect; /**< Read-only */ 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 unused1; /**< for binary compatibility */ 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** Allow recursive locks */ 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 locked; /**< Private */ 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** info for fast blit mapping to other surfaces */ 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct SDL_BlitMap *map; /**< Private */ 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** format version, bumped at every change to invalidate blit maps */ 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned int format_version; /**< Private */ 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** Reference count -- used when freeing surface */ 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int refcount; /**< Read-mostly */ 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_Surface; 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name SDL_Surface Flags 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * These are the currently supported flags for the SDL_surface 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_SWSURFACE 0x00000000 /**< Surface is in system memory */ 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_HWSURFACE 0x00000001 /**< Surface is in video memory */ 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_ASYNCBLIT 0x00000004 /**< Use asynchronous blits if possible */ 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Available for SDL_SetVideoMode() */ 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_ANYFORMAT 0x10000000 /**< Allow any video depth/pixel-format */ 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_HWPALETTE 0x20000000 /**< Surface has exclusive palette */ 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_DOUBLEBUF 0x40000000 /**< Set up double-buffered video mode */ 1419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_FULLSCREEN 0x80000000 /**< Surface is a full screen display */ 1429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_OPENGL 0x00000002 /**< Create an OpenGL rendering context */ 1439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_OPENGLBLIT 0x0000000A /**< Create an OpenGL rendering context and use it for blitting */ 1449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_RESIZABLE 0x00000010 /**< This video mode may be resized */ 1459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_NOFRAME 0x00000020 /**< No window caption or edge frame */ 1469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 1479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Used internally (read-only) */ 1499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 1509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_HWACCEL 0x00000100 /**< Blit uses hardware acceleration */ 1519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_SRCCOLORKEY 0x00001000 /**< Blit uses a source color key */ 1529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_RLEACCELOK 0x00002000 /**< Private flag */ 1539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_RLEACCEL 0x00004000 /**< Surface is RLE encoded */ 1549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_SRCALPHA 0x00010000 /**< Blit uses source alpha blending */ 1559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_PREALLOC 0x01000000 /**< Surface uses preallocated memory */ 1569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 1579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 1599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Evaluates to true if the surface needs to be locked before access */ 1619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_MUSTLOCK(surface) \ 1629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (surface->offset || \ 1639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) 1649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** typedef for private surface blitting functions */ 1669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, 1679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct SDL_Surface *dst, SDL_Rect *dstrect); 1689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Useful for determining the video hardware capabilities */ 1719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_VideoInfo { 1729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 hw_available :1; /**< Flag: Can you create hardware surfaces? */ 1739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 wm_available :1; /**< Flag: Can you talk to a window manager? */ 1749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 UnusedBits1 :6; 1759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 UnusedBits2 :1; 1769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_hw :1; /**< Flag: Accelerated blits HW --> HW */ 1779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_hw_CC :1; /**< Flag: Accelerated blits with Colorkey */ 1789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_hw_A :1; /**< Flag: Accelerated blits with Alpha */ 1799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_sw :1; /**< Flag: Accelerated blits SW --> HW */ 1809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_sw_CC :1; /**< Flag: Accelerated blits with Colorkey */ 1819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_sw_A :1; /**< Flag: Accelerated blits with Alpha */ 1829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 blit_fill :1; /**< Flag: Accelerated color fill */ 1839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 UnusedBits3 :16; 1849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 video_mem; /**< The total amount of video memory (in K) */ 1859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_PixelFormat *vfmt; /**< Value: The format of the video surface */ 1869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int current_w; /**< Value: The current video mode width */ 1879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int current_h; /**< Value: The current video mode height */ 1889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_VideoInfo; 1899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name Overlay Formats 1929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The most common video overlay formats. 1939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * For an explanation of these pixel formats, see: 1949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * http://www.webartz.com/fourcc/indexyuv.htm 1959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 1969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * For information on the relationship between color spaces, see: 1979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html 1989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 1999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 2009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_YV12_OVERLAY 0x32315659 /**< Planar mode: Y + V + U (3 planes) */ 2019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_IYUV_OVERLAY 0x56555949 /**< Planar mode: Y + U + V (3 planes) */ 2029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_YUY2_OVERLAY 0x32595559 /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ 2039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_UYVY_OVERLAY 0x59565955 /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ 2049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_YVYU_OVERLAY 0x55595659 /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ 2059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 2069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** The YUV hardware video overlay */ 2089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct SDL_Overlay { 2099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 format; /**< Read-only */ 2109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int w, h; /**< Read-only */ 2119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int planes; /**< Read-only */ 2129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint16 *pitches; /**< Read-only */ 2139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 **pixels; /**< Read-write */ 2149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** @name Hardware-specific surface info */ 2169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /*@{*/ 2179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct private_yuvhwfuncs *hwfuncs; 2189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct private_yuvhwdata *hwdata; 2199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /*@{*/ 2209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /** @name Special flags */ 2229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /*@{*/ 2239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 hw_overlay :1; /**< Flag: This overlay hardware accelerated? */ 2249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 UnusedBits :31; 2259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall /*@}*/ 2269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_Overlay; 2279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Public enumeration for setting the OpenGL window attributes. */ 2309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef enum { 2319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_RED_SIZE, 2329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_GREEN_SIZE, 2339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_BLUE_SIZE, 2349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ALPHA_SIZE, 2359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_BUFFER_SIZE, 2369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_DOUBLEBUFFER, 2379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_DEPTH_SIZE, 2389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_STENCIL_SIZE, 2399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ACCUM_RED_SIZE, 2409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ACCUM_GREEN_SIZE, 2419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ACCUM_BLUE_SIZE, 2429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ACCUM_ALPHA_SIZE, 2439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_STEREO, 2449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_MULTISAMPLEBUFFERS, 2459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_MULTISAMPLESAMPLES, 2469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_ACCELERATED_VISUAL, 2479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GL_SWAP_CONTROL 2489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_GLattr; 2499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name flags for SDL_SetPalette() */ 2519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 2529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_LOGPAL 0x01 2539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_PHYSPAL 0x02 2549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 2559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Function prototypes */ 2579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 2599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * @name Video Init and Quit 2609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * These functions are used internally, and should not be used unless you 2619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * have a specific need to specify the video driver you want to use. 2629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * You should normally use SDL_Init() or SDL_InitSubSystem(). 2639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 2659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 2669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Initializes the video subsystem. Sets up a connection 2679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to the window manager, etc, and determines the current video mode and 2689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * pixel format, but does not initialize a window or graphics mode. 2699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Note that event handling is activated by this routine. 2709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 2719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If you use both sound and video in your application, you need to call 2729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, 2739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * you won't be able to set full-screen display modes. 2749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); 2769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_VideoQuit(void); 2779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 2789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 2809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function fills the given character buffer with the name of the 2819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * video driver, and returns a pointer to it if the video driver has 2829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * been initialized. It returns NULL if no driver has been initialized. 2839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); 2859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 2879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns a pointer to the current display surface. 2889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL is doing format conversion on the display surface, this 2899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * function returns the publicly visible surface, not the real video 2909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * surface. 2919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 2929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); 2939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 2949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 2959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns a read-only pointer to information about the 2969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' 2979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * member of the returned structure will contain the pixel format of the 2989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * "best" video mode. 2999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); 3019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 3039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Check to see if a particular video mode is supported. 3049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * It returns 0 if the requested mode is not supported under any bit depth, 3059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * or returns the bits-per-pixel of the closest available mode with the 3069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * given width and height. If this bits-per-pixel is different from the 3079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * one used when setting the video mode, SDL_SetVideoMode() will succeed, 3089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * but will emulate the requested bits-per-pixel with a shadow surface. 3099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The arguments to SDL_VideoModeOK() are the same ones you would pass to 3119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SetVideoMode() 3129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); 3149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 3169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Return a pointer to an array of available screen dimensions for the 3179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * given format and video flags, sorted largest to smallest. Returns 3189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * NULL if there are no dimensions available for a particular format, 3199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * or (SDL_Rect **)-1 if any dimension is okay for the given format. 3209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'format' is NULL, the mode list will be for the format given 3229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * by SDL_GetVideoInfo()->vfmt 3239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); 3259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 3279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Set up a video mode with the specified width, height and bits-per-pixel. 3289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'bpp' is 0, it is treated as the current display bits per pixel. 3309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the 3329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * requested bits-per-pixel, but will return whatever video pixel format is 3339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * available. The default is to emulate the requested pixel format if it 3349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * is not natively available. 3359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in 3379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * video memory, if possible, and you may have to call SDL_LockSurface() 3389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * in order to access the raw framebuffer. Otherwise, the video surface 3399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * will be created in system memory. 3409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle 3429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * updates asynchronously, but you must always lock before accessing pixels. 3439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL will wait for updates to complete before returning from the lock. 3449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee 3469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * that the colors set by SDL_SetColors() will be the colors you get. 3479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all 3489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * of the colors exactly the way they are requested, and you should look 3499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * at the video surface structure to determine the actual palette. 3509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL cannot guarantee that the colors you request can be set, 3519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * i.e. if the colormap is shared, then the video surface may be created 3529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * under emulation in system memory, overriding the SDL_HWSURFACE flag. 3539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set 3559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * a fullscreen video mode. The default is to create a windowed mode 3569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if the current graphics system has a window manager. 3579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the SDL library is able to set a fullscreen video mode, this flag 3589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * will be set in the surface that is returned. 3599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up 3619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * two surfaces in video memory and swap between them when you call 3629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_Flip(). This is usually slower than the normal single-buffering 3639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * scheme, but prevents "tearing" artifacts caused by modifying video 3649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * memory while the monitor is refreshing. It should only be used by 3659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * applications that redraw the entire screen on every update. 3669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the 3689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * window manager, if any, to resize the window at runtime. When this 3699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * occurs, SDL will send a SDL_VIDEORESIZE event to you application, 3709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and you must respond to the event by re-calling SDL_SetVideoMode() 3719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * with the requested size (or another size that suits the application). 3729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If SDL_NOFRAME is set in 'flags', the SDL library will create a window 3749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * without any title bar or frame decoration. Fullscreen video modes have 3759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * this flag set automatically. 3769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns the video framebuffer surface, or NULL if it fails. 3789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 3799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If you rely on functionality provided by certain video flags, check the 3809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * flags of the returned surface to make sure that functionality is available. 3819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL will fall back to reduced functionality if the exact flags you wanted 3829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * are not available. 3839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode 3859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (int width, int height, int bpp, Uint32 flags); 3869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 3879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name SDL_Update Functions 3889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * These functions should not be called while 'screen' is locked. 3899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 3919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 3929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Makes sure the given list of rectangles is updated on the given screen. 3939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 3949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_UpdateRects 3959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *screen, int numrects, SDL_Rect *rects); 3969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 3979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire 3989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * screen. 3999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_UpdateRect 4019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); 4029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 4039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * On hardware that supports double-buffering, this function sets up a flip 4069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and returns. The hardware will wait for vertical retrace, and then swap 4079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * video buffers before the next video surface blit or lock will return. 4089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * On hardware that doesn not support double-buffering, this is equivalent 4099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); 4109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when 4119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * setting the video mode for this function to perform hardware flipping. 4129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns 0 if successful, or -1 if there was an error. 4139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); 4159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Set the gamma correction for each of the color channels. 4189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The gamma values range (approximately) between 0.1 and 10.0 4199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If this function isn't supported directly by the hardware, it will 4219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * be emulated using gamma ramps, if available. If successful, this 4229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * function returns 0, otherwise it returns -1. 4239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); 4259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Set the gamma translation table for the red, green, and blue channels 4289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * of the video hardware. Each table is an array of 256 16-bit quantities, 4299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * representing a mapping between the input and output for that channel. 4309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The input is the index into the array, and the output is the 16-bit 4319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * gamma value at that index, scaled to the output color precision. 4329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * You may pass NULL for any of the channels to leave it unchanged. 4349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the call succeeds, it will return 0. If the display driver or 4359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * hardware does not support gamma translation, or otherwise fails, 4369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * this function will return -1. 4379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue); 4399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Retrieve the current values of the gamma translation tables. 4429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * You must pass in valid pointers to arrays of 256 16-bit quantities. 4449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Any of the pointers may be NULL to ignore that channel. 4459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the call succeeds, it will return 0. If the display driver or 4469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * hardware does not support gamma translation, or otherwise fails, 4479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * this function will return -1. 4489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); 4509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets a portion of the colormap for the given 8-bit surface. If 'surface' 4539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * is not a palettized surface, this function does nothing, returning 0. 4549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If all of the colors were set as passed to SDL_SetColors(), it will 4559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * return 1. If not all the color entries were set exactly as given, 4569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * it will return 0, and you should look at the surface palette to 4579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * determine the actual color palette. 4589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * When 'surface' is the surface associated with the current display, the 4609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * display colormap will be updated with the requested colors. If 4619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() 4629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * will always return 1, and the palette is guaranteed to be set the way 4639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * you desire, even if the window colormap has to be warped or run under 4649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * emulation. 4659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, 4679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Color *colors, int firstcolor, int ncolors); 4689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets a portion of the colormap for a given 8-bit surface. 4719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 'flags' is one or both of: 4729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_LOGPAL -- set logical palette, which controls how blits are mapped 4739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to/from the surface, 4749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_PHYSPAL -- set physical palette, which controls how pixels look on 4759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the screen 4769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Only screens have physical palettes. Separate change of physical/logical 4779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * palettes is only possible if the screen has SDL_HWPALETTE set. 4789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The return value is 1 if all colours could be set as requested, and 0 4809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * otherwise. 4819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 4829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SetColors() is equivalent to calling this function with 4839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * flags = (SDL_LOGPAL|SDL_PHYSPAL). 4849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, 4869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Color *colors, int firstcolor, 4879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int ncolors); 4889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Maps an RGB triple to an opaque pixel value for a given pixel format 4919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC Uint32 SDLCALL SDL_MapRGB 4939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall(const SDL_PixelFormat * const format, 4949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 r, const Uint8 g, const Uint8 b); 4959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 4969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 4979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Maps an RGBA quadruple to a pixel value for a given pixel format 4989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 4999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC Uint32 SDLCALL SDL_MapRGBA 5009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall(const SDL_PixelFormat * const format, 5019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a); 5029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Maps a pixel value into the RGB components for a given pixel format 5059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, 5079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const SDL_PixelFormat * const fmt, 5089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *r, Uint8 *g, Uint8 *b); 5099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Maps a pixel value into the RGBA components for a given pixel format 5129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, 5149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall const SDL_PixelFormat * const fmt, 5159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); 5169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @sa SDL_CreateRGBSurface */ 5189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_AllocSurface SDL_CreateRGBSurface 5199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) 5219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. 5229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the depth is greater than 8 bits, the pixel format is set using the 5239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * flags '[RGB]mask'. 5249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the function runs out of memory, it will return NULL. 5259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 5269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The 'flags' tell what kind of surface to create. 5279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SWSURFACE means that the surface should be created in system memory. 5289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_HWSURFACE means that the surface should be created in video memory, 5299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * with the same format as the display surface. This is useful for surfaces 5309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * that will not change much, to take advantage of hardware acceleration 5319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * when being blitted to the display surface. 5329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with 5339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * this surface, but you must always lock it before accessing the pixels. 5349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL will wait for current blits to finish before returning from the lock. 5359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. 5369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the hardware supports acceleration of colorkey blits between 5379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * two surfaces in video memory, SDL will try to place the surface in 5389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * video memory. If this isn't possible or if there is no hardware 5399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * acceleration available, the surface will be placed in system memory. 5409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA means that the surface will be used for alpha blits and 5419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if the hardware supports hardware acceleration of alpha blits between 5429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * two surfaces in video memory, to place the surface in video memory 5439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if possible, otherwise it will be placed in system memory. 5449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the surface is created in video memory, blits will be _much_ faster, 5459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * but the surface format must be identical to the video surface format, 5469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and the only way to access the pixels member of the surface is to use 5479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the SDL_LockSurface() and SDL_UnlockSurface() calls. 5489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the requested surface actually resides in video memory, SDL_HWSURFACE 5499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * will be set in the flags member of the returned surface. If for some 5509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * reason the surface could not be placed in video memory, it will not have 5519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the SDL_HWSURFACE flag set, and will be created in system memory instead. 5529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface 5549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (Uint32 flags, int width, int height, int depth, 5559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); 5569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @sa SDL_CreateRGBSurface */ 5579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, 5589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall int width, int height, int depth, int pitch, 5599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); 5609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); 5619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_LockSurface() sets up a surface for directly accessing the pixels. 5649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write 5659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to and read from 'surface->pixels', using the pixel format stored in 5669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 'surface->format'. Once you are done accessing the surface, you should 5679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * use SDL_UnlockSurface() to release it. 5689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 5699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates 5709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to 0, then you can read and write to the surface at any time, and the 5719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * pixel format of the surface will not change. In particular, if the 5729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you 5739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * will not need to lock the display surface before accessing it. 5749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 5759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * No operating system or library calls should be made between lock/unlock 5769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * pairs, as critical system locks may be held during this time. 5779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 5789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. 5799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); 5819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); 5829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Load a surface from a seekable SDL data source (memory or file.) 5859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'freesrc' is non-zero, the source will be closed after being read. 5869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Returns the new surface, or NULL if there was an error. 5879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The new surface should be freed with SDL_FreeSurface(). 5889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); 5909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Convenience macro -- load a surface from a file */ 5929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) 5939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 5949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 5959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Save a surface to a seekable SDL data source (memory or file.) 5969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'freedst' is non-zero, the source will be closed after being written. 5979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Returns 0 if successful or -1 if there was an error. 5989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 5999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SaveBMP_RW 6009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *surface, SDL_RWops *dst, int freedst); 6019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Convenience macro -- save a surface to a file */ 6039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_SaveBMP(surface, file) \ 6049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) 6059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets the color key (transparent pixel) in a blittable surface. 6089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 6099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 'key' will be the transparent pixel in the source image of a blit. 6109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_RLEACCEL requests RLE acceleration for the surface if present, 6119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and removes RLE acceleration if absent. 6129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'flag' is 0, this function clears any current color key. 6139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns 0, or -1 if there was an error. 6149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 6159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetColorKey 6169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *surface, Uint32 flag, Uint32 key); 6179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function sets the alpha value for the entire surface, as opposed to 6209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * using the alpha component of each pixel. This value measures the range 6219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * of transparency of the surface, 0 being completely transparent to 255 6229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * being completely opaque. An 'alpha' value of 255 causes blits to be 6239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * opaque, the source pixels copied to the destination (the default). Note 6249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * that per-surface alpha can be combined with colorkey transparency. 6259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'flag' is 0, alpha blending is disabled for the surface. 6279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. 6289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the 6299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. 6309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The 'alpha' parameter is ignored for surfaces that have an alpha channel. 6329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 6339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); 6349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets the clipping rectangle for the destination surface in a blit. 6379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the clip rectangle is NULL, clipping will be disabled. 6399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the clip rectangle doesn't intersect the surface, the function will 6409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * return SDL_FALSE and blits will be completely clipped. Otherwise the 6419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * function returns SDL_TRUE and blits to the surface will be clipped to 6429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the intersection of the surface area and the clipping rectangle. 6439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Note that blits are automatically clipped to the edges of the source 6459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and destination surfaces. 6469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 6479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); 6489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Gets the clipping rectangle for the destination surface in a blit. 6519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 'rect' must be a pointer to a valid rectangle which will be filled 6529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * with the correct values. 6539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 6549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); 6559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Creates a new surface of the specified format, and then copies and maps 6589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the given surface to it so the blit of the converted surface will be as 6599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * fast as possible. If this function fails, it returns NULL. 6609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 6629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * semantics. You can also pass SDL_RLEACCEL in the flags parameter and 6639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL will try to RLE accelerate colorkey and alpha blits in the resulting 6649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * surface. 6659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function is used internally by SDL_DisplayFormat(). 6679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 6689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface 6699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); 6709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 6719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 6729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This performs a fast blit from the source surface to the destination 6739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * surface. It assumes that the source and destination rectangles are 6749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire 6759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * surface (src or dst) is copied. The final blit rectangles are saved 6769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * in 'srcrect' and 'dstrect' after all clipping is performed. 6779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the blit is successful, it returns 0, otherwise it returns -1. 6789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The blit function should not be called on a locked surface. 6809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The blit semantics for surfaces with and without alpha and colorkey 6829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * are defined as follows: 6839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGBA->RGB: 6859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA set: 6869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * alpha-blend (using alpha-channel). 6879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCCOLORKEY ignored. 6889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA not set: 6899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * copy RGB. 6909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if SDL_SRCCOLORKEY set, only copy the pixels matching the 6919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGB values of the source colour key, ignoring alpha in the 6929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * comparison. 6939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 6949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGB->RGBA: 6959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA set: 6969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * alpha-blend (using the source per-surface alpha value); 6979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * set destination alpha to opaque. 6989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA not set: 6999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * copy RGB, set destination alpha to source per-surface alpha value. 7009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * both: 7019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if SDL_SRCCOLORKEY set, only copy the pixels matching the 7029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * source colour key. 7039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGBA->RGBA: 7059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA set: 7069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * alpha-blend (using the source alpha channel) the RGB values; 7079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * leave destination alpha untouched. [Note: is this correct?] 7089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCCOLORKEY ignored. 7099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA not set: 7109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * copy all of RGBA to the destination. 7119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if SDL_SRCCOLORKEY set, only copy the pixels matching the 7129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGB values of the source colour key, ignoring alpha in the 7139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * comparison. 7149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * RGB->RGB: 7169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA set: 7179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * alpha-blend (using the source per-surface alpha value). 7189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_SRCALPHA not set: 7199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * copy RGB. 7209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * both: 7219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * if SDL_SRCCOLORKEY set, only copy the pixels matching the 7229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * source colour key. 7239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If either of the surfaces were in video memory, and the blit returns -2, 7259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the video memory was lost, so it should be reloaded with artwork and 7269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * re-blitted: 7279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * @code 7289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { 7299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * while ( SDL_LockSurface(image) < 0 ) 7309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sleep(10); 7319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * -- Write image pixels to image->pixels -- 7329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * SDL_UnlockSurface(image); 7339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * } 7349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * @endcode 7359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This happens under DirectX 5.0 when the system switches away from your 7379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * fullscreen application. The lock will also fail until you have access 7389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * to the video memory again. 7399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * You should call SDL_BlitSurface() unless you know exactly how SDL 7419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * blitting works internally and how to use the other blit functions. 7429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define SDL_BlitSurface SDL_UpperBlit 7449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This is the public blit function, SDL_BlitSurface(), and it performs 7469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * rectangle validation and clipping before passing it to SDL_LowerBlit() 7479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_UpperBlit 7499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *src, SDL_Rect *srcrect, 7509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Surface *dst, SDL_Rect *dstrect); 7519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This is a semi-private blit function and it performs low-level surface 7529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * blitting only. 7539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_LowerBlit 7559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *src, SDL_Rect *srcrect, 7569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Surface *dst, SDL_Rect *dstrect); 7579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 7599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function performs a fast fill of the given rectangle with 'color' 7609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The given rectangle is clipped to the destination surface clip area 7619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and the final fill rectangle is saved in the passed in pointer. 7629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'dstrect' is NULL, the whole surface will be filled with 'color' 7639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The color should be a pixel of the format used by the surface, and 7649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * can be generated by the SDL_MapRGB() function. 7659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function returns 0 on success, or -1 on error. 7669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_FillRect 7689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); 7699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 7719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function takes a surface and copies it to a new surface of the 7729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * pixel format and colors of the video framebuffer, suitable for fast 7739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * blitting onto the display surface. It calls SDL_ConvertSurface() 7749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If you want to take advantage of hardware colorkey or alpha blit 7769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * acceleration, you should set the colorkey and alpha value before 7779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * calling this function. 7789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the conversion fails or runs out of memory, it returns NULL 7809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); 7829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 7849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function takes a surface and copies it to a new surface of the 7859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * pixel format and colors of the video framebuffer (if possible), 7869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * suitable for fast alpha blitting onto the display surface. 7879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The new surface will always have an alpha channel. 7889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If you want to take advantage of hardware colorkey or alpha blit 7909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * acceleration, you should set the colorkey and alpha value before 7919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * calling this function. 7929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 7939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the conversion fails or runs out of memory, it returns NULL 7949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 7959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); 7969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 7989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 7999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name YUV video surface overlay functions */ /*@{*/ 8009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** This function creates a video output overlay 8039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Calling the returned surface an overlay is something of a misnomer because 8049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the contents of the display surface underneath the area where the overlay 8059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * is shown is undefined - it may be overwritten with the converted YUV data. 8069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, 8089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Uint32 format, SDL_Surface *display); 8099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Lock an overlay for direct access, and unlock it when you are done */ 8119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); 8129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); 8139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Blit a video overlay to the display surface. 8159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The contents of the video surface underneath the blit destination are 8169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * not defined. 8179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The width and height of the destination rectangle may be different from 8189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * that of the overlay, but currently only 2x scaling is supported. 8199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); 8219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** Free a video overlay */ 8239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); 8249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 8269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name OpenGL support functions. */ /*@{*/ 8299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Dynamically load an OpenGL library, or the default one if path is NULL 8339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 8349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If you do this, you need to retrieve all of the GL functions used in 8359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * your program from the dynamic library using SDL_GL_GetProcAddress(). 8369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); 8389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Get the address of a GL function 8419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); 8439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Set an attribute of the OpenGL subsystem before intialization. 8469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); 8489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Get an attribute of the OpenGL subsystem from the windowing 8519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * interface, such as glX. This is of course different from getting 8529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the values from SDL's internal OpenGL subsystem, which only 8539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * stores the values you request before initialization. 8549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 8559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Developers should track the values they pass into SDL_GL_SetAttribute 8569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * themselves if they want to retrieve these values. 8579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); 8599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Swap the OpenGL buffers, if double-buffering is supported. 8629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); 8649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name OpenGL Internal Functions 8669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Internal functions that should not be called unless you have read 8679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and understood the source code for these functions. 8689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@{*/ 8709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); 8719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GL_Lock(void); 8729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_GL_Unlock(void); 8739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 8749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 8769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @name Window Manager Functions */ 8799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** These functions allow interaction with the window manager, if any. */ /*@{*/ 8809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 8819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets the title and icon text of the display window (UTF-8 encoded) 8849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); 8869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Gets the title and icon text of the display window (UTF-8 encoded) 8889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); 8909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 8929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Sets the icon for the display window. 8939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function must be called before the first call to SDL_SetVideoMode(). 8949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * It takes an icon surface, and a mask in MSB format. 8959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If 'mask' is NULL, the entire icon surface will be used as the icon. 8969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 8979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 8989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 8999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 9009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function iconifies the window, and returns 1 if it succeeded. 9019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the function succeeds, it generates an SDL_APPACTIVE loss event. 9029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function is a noop and returns 0 in non-windowed environments. 9039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 9049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); 9059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 9079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Toggle fullscreen mode without changing the contents of the screen. 9089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If the display surface does not require locking before accessing 9099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the pixel information, then the memory pointers will not change. 9109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 9119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If this function was able to toggle fullscreen mode (change from 9129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * running in a window to fullscreen, or vice-versa), it will return 1. 9139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * If it is not implemented, or fails, it returns 0. 9149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 9159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * The next call to SDL_SetVideoMode() will set the mode fullscreen 9169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * attribute based on the flags parameter - if SDL_FULLSCREEN is not 9179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * set, then the display will be windowed by default where supported. 9189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 9199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This is currently only implemented in the X11 video driver. 9209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 9219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); 9229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef enum { 9249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GRAB_QUERY = -1, 9259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GRAB_OFF = 0, 9269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GRAB_ON = 1, 9279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_GRAB_FULLSCREEN /**< Used internally */ 9289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} SDL_GrabMode; 9299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** 9309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * This function allows you to set and query the input grab state of 9319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * the application. It returns the new input grab state. 9329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * 9339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * Grabbing means that the mouse is confined to the application window, 9349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and nearly all keyboard input is passed directly to the application, 9359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall * and not interpreted by a window manager, if any. 9369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 9379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); 9389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 939e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall/* 940e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * Move the SDL Window to a specific position. Does nothing in fullscreen mode. 941e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall */ 942e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallextern DECLSPEC void SDL_WM_SetPos(int x, int y); 943e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 944e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall/* 945e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * Get the current SDL window position. Returns (0,0) in fullscreen mode. 946e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall */ 947e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallextern DECLSPEC void SDL_WM_GetPos(int *px, int *py); 948e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 949e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall/* 950e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * If the window is fully visible, return TRUE; otherwise, recenter the window 951e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * if the 'recenter' parameter is non-0, and return FALSE. 952e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall */ 953e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallextern DECLSPEC int SDL_WM_IsFullyVisible(int recenter); 954e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 955e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall/* 956e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * Get the resolution of the main monitor in DPIs, if available. 957e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * Return 0 on success, or -1 if the data is not available. 958e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall */ 959e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallextern DECLSPEC int SDL_WM_GetMonitorDPI(int *xDPI, int *yDPI); 960e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 961e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall/* 962e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * Get the coordinates of the monitor in virtual desktop space. 963e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * In the case of multi-monitor systems, returns the rectangle of 964e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * the 'nearest' monitor relative to the main SDL_window. Returns 965e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall * 0 on success, or -1 if the data is not available. 966e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall */ 967e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hallextern DECLSPEC int SDL_WM_GetMonitorRect(SDL_Rect *rect); 968e4c5d95ed37611acc6a186522315195b4ebfb9efJesse Hall 9699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/*@}*/ 9709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/** @internal Not in public API at the moment - do not use! */ 9729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallextern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, 9739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL_Surface *dst, SDL_Rect *dstrect); 9749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Ends C function definitions when using C++ */ 9769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#ifdef __cplusplus 9779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall} 9789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 9799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "close_code.h" 9809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 9819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif /* _SDL_video_h */ 982