include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 16 Jun 2006 06:00:31 +0000
branchSDL-1.3
changeset 1682 7ae8018b2e5d
parent 1681 80a5e6a4e1e2
child 1683 396a35389351
permissions -rw-r--r--
Default palette entries to white, instead of black.
More palettized video mode support...
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  * \file SDL_video.h
    25  *
    26  * Header file for access to the SDL raw framebuffer window
    27  */
    28 
    29 #ifndef _SDL_video_h
    30 #define _SDL_video_h
    31 
    32 #include "SDL_stdinc.h"
    33 #include "SDL_error.h"
    34 #include "SDL_pixels.h"
    35 #include "SDL_rwops.h"
    36 
    37 #include "begin_code.h"
    38 /* Set up for C function definitions, even when using C++ */
    39 #ifdef __cplusplus
    40 /* *INDENT-OFF* */
    41 extern "C" {
    42 /* *INDENT-ON* */
    43 #endif
    44 
    45 /* Transparency definitions: These define alpha as the opacity of a surface */
    46 #define SDL_ALPHA_OPAQUE 255
    47 #define SDL_ALPHA_TRANSPARENT 0
    48 
    49 /**
    50  * \struct SDL_Rect
    51  *
    52  * \brief A rectangle, with the origin at the upper left.
    53  */
    54 typedef struct SDL_Rect
    55 {
    56     Sint16 x, y;
    57     Uint16 w, h;
    58 } SDL_Rect;
    59 
    60 /**
    61  * \struct SDL_DisplayMode
    62  *
    63  * \brief  The structure that defines a display mode
    64  *
    65  * \sa SDL_GetNumDisplayModes()
    66  * \sa SDL_GetDisplayMode()
    67  * \sa SDL_GetDesktopDisplayMode()
    68  * \sa SDL_GetCurrentDisplayMode()
    69  * \sa SDL_GetClosestDisplayMode()
    70  * \sa SDL_SetDisplayMode()
    71  */
    72 typedef struct
    73 {
    74     Uint32 format;              /**< pixel format */
    75     int w;                      /**< width */
    76     int h;                      /**< height */
    77     int refresh_rate;           /**< refresh rate (or zero for unspecified) */
    78 } SDL_DisplayMode;
    79 
    80 /**
    81  * \typedef SDL_WindowID
    82  *
    83  * \brief The type used to identify a window
    84  *
    85  * \sa SDL_CreateWindow()
    86  * \sa SDL_CreateWindowFrom()
    87  * \sa SDL_DestroyWindow()
    88  * \sa SDL_GetWindowData()
    89  * \sa SDL_GetWindowFlags()
    90  * \sa SDL_GetWindowGrab()
    91  * \sa SDL_GetWindowPosition()
    92  * \sa SDL_GetWindowSize()
    93  * \sa SDL_GetWindowTitle()
    94  * \sa SDL_HideWindow()
    95  * \sa SDL_MaximizeWindow()
    96  * \sa SDL_MinimizeWindow()
    97  * \sa SDL_RaiseWindow()
    98  * \sa SDL_RestoreWindow()
    99  * \sa SDL_SetWindowData()
   100  * \sa SDL_SetWindowGrab()
   101  * \sa SDL_SetWindowIcon()
   102  * \sa SDL_SetWindowPosition()
   103  * \sa SDL_SetWindowSize()
   104  * \sa SDL_SetWindowTitle()
   105  * \sa SDL_ShowWindow()
   106  */
   107 typedef Uint32 SDL_WindowID;
   108 
   109 /**
   110  * \enum SDL_WindowFlags
   111  *
   112  * \brief The flags on a window
   113  *
   114  * \sa SDL_GetWindowFlags()
   115  */
   116 typedef enum
   117 {
   118     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
   119     SDL_WINDOW_BORDERLESS = 0x00000002,         /**< no window decoration */
   120     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
   121     SDL_WINDOW_OPENGL = 0x00000008,             /**< window usable with OpenGL context */
   122     SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
   123     SDL_WINDOW_MAXIMIZED = 0x00000020,          /**< maximized */
   124     SDL_WINDOW_MINIMIZED = 0x00000040,          /**< minimized */
   125     SDL_WINDOW_INPUT_GRABBED = 0x00000080,      /**< window has grabbed input focus */
   126     SDL_WINDOW_KEYBOARD_FOCUS = 0x00000100,     /**< window has keyboard focus */
   127     SDL_WINDOW_MOUSE_FOCUS = 0x00000200,        /**< window has mouse focus */
   128 } SDL_WindowFlags;
   129 
   130 /**
   131  * \enum SDL_WindowEventID
   132  *
   133  * \brief Event subtype for window events
   134  */
   135 typedef enum
   136 {
   137     SDL_WINDOWEVENT_NONE,               /**< Never used */
   138     SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
   139     SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
   140     SDL_WINDOWEVENT_MOVED,              /**< Window has been moved to data1,data2 */
   141     SDL_WINDOWEVENT_RESIZED,            /**< Window size changed to data1xdata2 */
   142     SDL_WINDOWEVENT_MINIMIZED,          /**< Window has been minimized */
   143     SDL_WINDOWEVENT_MAXIMIZED,          /**< Window has been maximized */
   144     SDL_WINDOWEVENT_RESTORED,           /**< Window has been restored to normal size and position */
   145     SDL_WINDOWEVENT_ENTER,              /**< The window has gained mouse focus */
   146     SDL_WINDOWEVENT_LEAVE,              /**< The window has lost mouse focus */
   147     SDL_WINDOWEVENT_FOCUS_GAINED,       /**< The window has gained keyboard focus */
   148     SDL_WINDOWEVENT_FOCUS_LOST,         /**< The window has lost keyboard focus */
   149 } SDL_WindowEventID;
   150 
   151 /**
   152  * \enum SDL_RendererFlags
   153  *
   154  * \brief Flags used when initializing a render manager.
   155  */
   156 typedef enum
   157 {
   158     SDL_Renderer_PresentDiscard = 0x00000001,   /**< Present leaves the contents of the backbuffer undefined */
   159     SDL_Renderer_PresentCopy = 0x00000002,      /**< Present uses a copy from back buffer to the front buffer */
   160     SDL_Renderer_PresentFlip2 = 0x00000004,     /**< Present uses a flip, swapping back buffer and front buffer */
   161     SDL_Renderer_PresentFlip3 = 0x00000008,     /**< Present uses a flip, rotating between two back buffers and a front buffer */
   162     SDL_Renderer_PresentVSync = 0x00000010,     /**< Present is synchronized with the refresh rate */
   163     SDL_Renderer_RenderTarget = 0x00000020,     /**< The renderer can create texture render targets */
   164     SDL_Renderer_Accelerated = 0x00000040,      /**< The renderer uses hardware acceleration */
   165     SDL_Renderer_Minimal = 0x00000080,          /**< The renderer only supports the read/write pixel and present functions */
   166 } SDL_RendererFlags;
   167 
   168 /**
   169  * \struct SDL_RendererInfo
   170  *
   171  * \brief Information on the capabilities of a render manager.
   172  */
   173 typedef struct SDL_RendererInfo
   174 {
   175     const char *name;           /**< The name of the renderer */
   176     Uint32 flags;               /**< Supported SDL_RendererFlags */
   177     Uint32 blend_modes;         /**< A mask of supported blend modes */
   178     Uint32 scale_modes;         /**< A mask of supported scale modes */
   179     Uint32 num_texture_formats; /**< The number of available texture formats */
   180     Uint32 texture_formats[32]; /**< The available texture formats */
   181     int max_texture_width;      /**< The maximimum texture width */
   182     int max_texture_height;     /**< The maximimum texture height */
   183 } SDL_RendererInfo;
   184 
   185 /**
   186  * \enum SDL_TextureAccess
   187  *
   188  * \brief The access pattern allowed for a texture
   189  */
   190 typedef enum
   191 {
   192     SDL_TextureAccess_Render,   /**< Unlockable video memory, rendering allowed */
   193     SDL_TextureAccess_Remote,   /**< Unlockable video memory */
   194     SDL_TextureAccess_Local,    /**< Lockable system memory */
   195 } SDL_TextureAccess;
   196 
   197 /**
   198  * \enum SDL_TextureBlendMode
   199  *
   200  * \brief The blend mode used in SDL_RenderCopy()
   201  */
   202 typedef enum
   203 {
   204     SDL_TextureBlendMode_None = 0x00000000,     /**< No blending */
   205     SDL_TextureBlendMode_Mask = 0x00000001,     /**< dst = A ? src : dst (alpha is mask) */
   206     SDL_TextureBlendMode_Blend = 0x00000002,    /**< dst = (src * A) + (dst * (1-A)) */
   207     SDL_TextureBlendMode_Add = 0x00000004,      /**< dst = (src * A) + dst */
   208     SDL_TextureBlendMode_Mod = 0x00000008,      /**< dst = src * dst */
   209 } SDL_TextureBlendMode;
   210 
   211 /**
   212  * \enum SDL_TextureScaleMode
   213  *
   214  * \brief The scale mode used in SDL_RenderCopy()
   215  */
   216 typedef enum
   217 {
   218     SDL_TextureScaleMode_None = 0x00000000,     /**< No scaling, rectangles must match dimensions */
   219     SDL_TextureScaleMode_Fast = 0x00000001,     /**< Point sampling or equivalent algorithm */
   220     SDL_TextureScaleMode_Slow = 0x00000002,     /**< Linear filtering or equivalent algorithm */
   221     SDL_TextureScaleMode_Best = 0x00000004,     /**< Bicubic filtering or equivalent algorithm */
   222 } SDL_TextureScaleMode;
   223 
   224 /**
   225  * \typedef SDL_TextureID
   226  *
   227  * \brief An efficient driver-specific representation of pixel data
   228  */
   229 typedef Uint32 SDL_TextureID;
   230 
   231 
   232 /* These are the currently supported flags for the SDL_surface */
   233 /* Used internally (read-only) */
   234 #define SDL_HWSURFACE       0x00000001  /* Surface represents a texture */
   235 #define SDL_PREALLOC        0x00000002  /* Surface uses preallocated memory */
   236 #define SDL_SRCALPHA        0x00000004  /* Blit uses source alpha blending */
   237 #define SDL_SRCCOLORKEY     0x00000008  /* Blit uses a source color key */
   238 #define SDL_RLEACCELOK      0x00000010  /* Private flag */
   239 #define SDL_RLEACCEL        0x00000020  /* Surface is RLE encoded */
   240 
   241 /* Evaluates to true if the surface needs to be locked before access */
   242 #define SDL_MUSTLOCK(S)	(((S)->flags & (SDL_HWSURFACE|SDL_RLEACCEL)) != 0)
   243 
   244 /* This structure should be treated as read-only, except for 'pixels',
   245    which, if not NULL, contains the raw pixel data for the surface.
   246 */
   247 typedef struct SDL_Surface
   248 {
   249     Uint32 flags;               /* Read-only */
   250     SDL_PixelFormat *format;    /* Read-only */
   251     int w, h;                   /* Read-only */
   252     int pitch;                  /* Read-only */
   253     void *pixels;               /* Read-write */
   254 
   255     /* information needed for surfaces requiring locks */
   256     int locked;
   257     void *lock_data;
   258 
   259     /* clipping information */
   260     SDL_Rect clip_rect;         /* Read-only */
   261 
   262     /* info for fast blit mapping to other surfaces */
   263     struct SDL_BlitMap *map;    /* Private */
   264 
   265     /* format version, bumped at every change to invalidate blit maps */
   266     unsigned int format_version;        /* Private */
   267 
   268     /* Reference count -- used when freeing surface */
   269     int refcount;               /* Read-mostly */
   270 } SDL_Surface;
   271 
   272 /* typedef for private surface blitting functions */
   273 typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
   274                          struct SDL_Surface * dst, SDL_Rect * dstrect);
   275 
   276 
   277 /**
   278  * \enum SDL_GLattr
   279  *
   280  * \brief OpenGL configuration attributes
   281  */
   282 typedef enum
   283 {
   284     SDL_GL_RED_SIZE,
   285     SDL_GL_GREEN_SIZE,
   286     SDL_GL_BLUE_SIZE,
   287     SDL_GL_ALPHA_SIZE,
   288     SDL_GL_BUFFER_SIZE,
   289     SDL_GL_DOUBLEBUFFER,
   290     SDL_GL_DEPTH_SIZE,
   291     SDL_GL_STENCIL_SIZE,
   292     SDL_GL_ACCUM_RED_SIZE,
   293     SDL_GL_ACCUM_GREEN_SIZE,
   294     SDL_GL_ACCUM_BLUE_SIZE,
   295     SDL_GL_ACCUM_ALPHA_SIZE,
   296     SDL_GL_STEREO,
   297     SDL_GL_MULTISAMPLEBUFFERS,
   298     SDL_GL_MULTISAMPLESAMPLES,
   299     SDL_GL_ACCELERATED_VISUAL,
   300     SDL_GL_SWAP_CONTROL
   301 } SDL_GLattr;
   302 
   303 
   304 /* Function prototypes */
   305 
   306 /**
   307  * \fn int SDL_GetNumVideoDrivers(void)
   308  *
   309  * \brief Get the number of video drivers compiled into SDL
   310  *
   311  * \sa SDL_GetVideoDriver()
   312  */
   313 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
   314 
   315 /**
   316  * \fn const char *SDL_GetVideoDriver(int index)
   317  *
   318  * \brief Get the name of a built in video driver.
   319  *
   320  * \note The video drivers are presented in the order in which they are
   321  * normally checked during initialization.
   322  *
   323  * \sa SDL_GetNumVideoDrivers()
   324  */
   325 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
   326 
   327 /**
   328  * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
   329  *
   330  * \brief Initialize the video subsystem, optionally specifying a video driver.
   331  *
   332  * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
   333  * \param flags FIXME: Still needed?
   334  *
   335  * \return 0 on success, -1 on error
   336  *
   337  * This function initializes the video subsystem; setting up a connection
   338  * to the window manager, etc, and determines the available display modes
   339  * and pixel formats, but does not initialize a window or graphics mode.
   340  *
   341  * \sa SDL_VideoQuit()
   342  */
   343 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
   344                                           Uint32 flags);
   345 
   346 /**
   347  * \fn void SDL_VideoQuit(void)
   348  *
   349  * \brief Shuts down the video subsystem.
   350  *
   351  * This function closes all windows, and restores the original video mode.
   352  *
   353  * \sa SDL_VideoInit()
   354  */
   355 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
   356 
   357 /**
   358  * \fn const char *SDL_GetCurrentVideoDriver(void)
   359  *
   360  * \brief Returns the name of the currently initialized video driver.
   361  *
   362  * \return The name of the current video driver or NULL if no driver
   363  *         has been initialized
   364  *
   365  * \sa SDL_GetNumVideoDrivers()
   366  * \sa SDL_GetVideoDriver()
   367  */
   368 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
   369 
   370 /**
   371  * \fn int SDL_GetNumVideoDisplays(void)
   372  *
   373  * \brief Returns the number of available video displays.
   374  *
   375  * \sa SDL_SelectVideoDisplay()
   376  */
   377 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
   378 
   379 /**
   380  * \fn int SDL_SelectVideoDisplay(int index)
   381  *
   382  * \brief Set the index of the currently selected display.
   383  *
   384  * \return The index of the currently selected display.
   385  *
   386  * \note You can query the currently selected display by passing an index of -1.
   387  *
   388  * \sa SDL_GetNumVideoDisplays()
   389  */
   390 extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
   391 
   392 /**
   393  * \fn int SDL_GetNumDisplayModes(void)
   394  *
   395  * \brief Returns the number of available display modes for the current display.
   396  *
   397  * \sa SDL_GetDisplayMode()
   398  */
   399 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
   400 
   401 /**
   402  * \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index)
   403  *
   404  * \brief Retrieve information about a specific display mode.
   405  *
   406  * \note The display modes are sorted in this priority:
   407  *       \li bits per pixel -> more colors to fewer colors
   408  *       \li width -> largest to smallest
   409  *       \li height -> largest to smallest
   410  *       \li refresh rate -> highest to lowest
   411  *
   412  * \sa SDL_GetNumDisplayModes()
   413  */
   414 extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index);
   415 
   416 /**
   417  * \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void)
   418  *
   419  * \brief Retrieve information about the desktop display mode for the current display.
   420  */
   421 extern DECLSPEC const SDL_DisplayMode *SDLCALL
   422 SDL_GetDesktopDisplayMode(void);
   423 
   424 /**
   425  * \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void)
   426  *
   427  * \brief Retrieve information about the current display mode.
   428  */
   429 extern DECLSPEC const SDL_DisplayMode *SDLCALL
   430 SDL_GetCurrentDisplayMode(void);
   431 
   432 /**
   433  * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
   434  *
   435  * \brief Get the closest match to the requested display mode.
   436  *
   437  * \param mode The desired display mode
   438  * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
   439  *
   440  * \return The passed in value 'closest', or NULL if no matching video mode was available.
   441  *
   442  * The available display modes are scanned, and 'closest' is filled in with the closest mode matching the requested mode and returned.  The mode format and refresh_rate default to the desktop mode if they are 0.  The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate.  If all the available modes are too small, then NULL is returned.
   443  *
   444  * \sa SDL_GetNumDisplayModes()
   445  * \sa SDL_GetDisplayMode()
   446  */
   447 extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
   448                                                                    SDL_DisplayMode
   449                                                                    * mode,
   450                                                                    SDL_DisplayMode
   451                                                                    * closest);
   452 
   453 /**
   454  * \fn int SDL_SetDisplayMode(const SDL_DisplayMode *mode)
   455  *
   456  * \brief Set up the closest available mode on the current display.
   457  *
   458  * \param mode The desired display mode
   459  *
   460  * \return 0 on success, or -1 if setting the display mode failed.
   461  */
   462 extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode);
   463 
   464 /**
   465  * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
   466  *
   467  * \brief Set the palette entries for indexed display modes.
   468  *
   469  * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
   470  */
   471 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
   472                                                   int firstcolor,
   473                                                   int ncolors);
   474 
   475 /**
   476  * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
   477  *
   478  * \brief Gets the palette entries for indexed display modes.
   479  *
   480  * \return 0 on success, or -1 if the display mode isn't palettized
   481  */
   482 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
   483                                                   int firstcolor,
   484                                                   int ncolors);
   485 
   486 /**
   487  * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
   488  *
   489  * \brief Create a window with the specified position, dimensions, and flags.
   490  *
   491  * \param title The title of the window
   492  * \param x The x position of the window
   493  * \param y The y position of the window
   494  * \param w The width of the window
   495  * \param h The height of the window
   496  * \param flags The flags for the window
   497  *
   498  * \return The id of the window created, or zero if window creation failed.
   499  *
   500  * \note Setting the position to -1, -1, indicates any position is fine.
   501  *
   502  * \sa SDL_DestroyWindow()
   503  */
   504 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
   505                                                       int x, int y, int w,
   506                                                       int h, Uint32 flags);
   507 
   508 /**
   509  * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
   510  *
   511  * \brief Create an SDL window struct from an existing native window.
   512  *
   513  * \param data A pointer to driver-dependent window creation data
   514  *
   515  * \return The id of the window created, or zero if window creation failed.
   516  *
   517  * \warning This function is NOT SUPPORTED, use at your own risk!
   518  *
   519  * \sa SDL_DestroyWindow()
   520  */
   521 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
   522 
   523 /**
   524  * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
   525  *
   526  * \brief Get the window flags.
   527  */
   528 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
   529 
   530 /**
   531  * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
   532  *
   533  * \brief Set the title of the window, in UTF-8 format.
   534  *
   535  * \sa SDL_GetWindowTitle()
   536  */
   537 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
   538                                                 const char *title);
   539 
   540 /**
   541  * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
   542  *
   543  * \brief Get the title of the window, in UTF-8 format.
   544  *
   545  * \sa SDL_SetWindowTitle()
   546  */
   547 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
   548 
   549 /**
   550  * \fn void SDL_SetWindowIcon(SDL_Surface *icon)
   551  *
   552  * \brief Set the icon of the window.
   553  *
   554  * \param icon The icon for the window
   555  *
   556  * FIXME: The icon needs to be set before the window is first shown.  Should some icon representation be part of the window creation data?
   557  */
   558 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon);
   559 
   560 /**
   561  * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
   562  *
   563  * \brief Associate an arbitrary pointer with the window.
   564  *
   565  * \sa SDL_GetWindowData()
   566  */
   567 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
   568                                                void *userdata);
   569 
   570 /**
   571  * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
   572  *
   573  * \brief Retrieve the data pointer associated with the window.
   574  *
   575  * \sa SDL_SetWindowData()
   576  */
   577 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
   578 
   579 /**
   580  * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
   581  *
   582  * \brief Set the position of the window.
   583  *
   584  * \sa SDL_GetWindowPosition()
   585  */
   586 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
   587                                                    int x, int y);
   588 
   589 /**
   590  * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
   591  *
   592  * \brief Get the position of the window.
   593  *
   594  * \sa SDL_SetWindowPosition()
   595  */
   596 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
   597                                                    int *x, int *y);
   598 
   599 /**
   600  * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
   601  *
   602  * \brief Set the size of the window's client area.
   603  *
   604  * \note You can't change the size of a fullscreen window, it automatically
   605  * matches the size of the display mode.
   606  *
   607  * \sa SDL_GetWindowSize()
   608  */
   609 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
   610                                                int h);
   611 
   612 /**
   613  * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w)
   614  *
   615  * \brief Get the size of the window's client area.
   616  *
   617  * \sa SDL_SetWindowSize()
   618  */
   619 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
   620                                                int *h);
   621 
   622 /**
   623  * \fn void SDL_ShowWindow(SDL_WindowID windowID)
   624  *
   625  * \brief Show the window
   626  *
   627  * \sa SDL_HideWindow()
   628  */
   629 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
   630 
   631 /**
   632  * \fn void SDL_HideWindow(SDL_WindowID windowID)
   633  *
   634  * \brief Hide the window
   635  *
   636  * \sa SDL_ShowWindow()
   637  */
   638 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
   639 
   640 /**
   641  * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
   642  *
   643  * \brief Raise the window so it's above other windows.
   644  */
   645 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
   646 
   647 /**
   648  * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
   649  *
   650  * \brief Make the window as large as possible.
   651  *
   652  * \sa SDL_RestoreWindow()
   653  */
   654 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
   655 
   656 /**
   657  * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
   658  *
   659  * \brief Minimize the window to an iconic representation.
   660  *
   661  * \sa SDL_RestoreWindow()
   662  */
   663 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
   664 
   665 /**
   666  * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
   667  *
   668  * \brief Restore the size and position of a minimized or maximized window.
   669  *
   670  * \sa SDL_MaximizeWindow()
   671  * \sa SDL_MinimizeWindow()
   672  */
   673 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
   674 
   675 /**
   676  * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
   677  *
   678  * \brief Set the window's input grab mode.
   679  *
   680  * \param mode This is 1 to grab input, and 0 to release input.
   681  *
   682  * \sa SDL_GrabMode
   683  * \sa SDL_GetWindowGrab()
   684  */
   685 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
   686                                                int mode);
   687 
   688 /**
   689  * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
   690  *
   691  * \brief Get the window's input grab mode.
   692  *
   693  * \return This returns 1 if input is grabbed, and 0 otherwise.
   694  *
   695  * \sa SDL_GrabMode
   696  * \sa SDL_SetWindowGrab()
   697  */
   698 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
   699 
   700 /**
   701  * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
   702  *
   703  * \brief Destroy a window.
   704  */
   705 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
   706 
   707 /**
   708  * \fn int SDL_GetNumRenderers(void)
   709  *
   710  * \brief Get the number of render managers on the current display.
   711  *
   712  * A render manager is a set of code that handles rendering and texture
   713  * management on a particular display.  Normally there is only one, but
   714  * some drivers may have several available with different capabilities.
   715  *
   716  * \sa SDL_GetRendererInfo()
   717  * \sa SDL_CreateRenderer()
   718  */
   719 extern DECLSPEC int SDLCALL SDL_GetNumRenderers(void);
   720 
   721 /**
   722  * \fn SDL_RendererInfo *SDL_GetRendererInfo(int index)
   723  *
   724  * \brief Get information about a specific render manager on the current
   725  *        display.
   726  *
   727  * \sa SDL_CreateRenderer()
   728  */
   729 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(int index,
   730                                                 SDL_RendererInfo * info);
   731 
   732 /**
   733  * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags)
   734  *
   735  * \brief Create and make active a 2D rendering context for a window.
   736  *
   737  * \param windowID The window used for rendering.
   738  * \param index The index of the render manager to initialize, or -1 to initialize the first one supporting the requested flags.
   739  * \param flags SDL_RendererFlags
   740  *
   741  * \return 0 on success, -1 if the flags were not supported, or -2 if
   742  *         there isn't enough memory to support the requested flags
   743  *
   744  * \sa SDL_SelectRenderer()
   745  * \sa SDL_DestroyRenderer()
   746  */
   747 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
   748                                                int index, Uint32 flags);
   749 
   750 /**
   751  * \fn int SDL_SelectRenderer(SDL_WindowID windowID)
   752  *
   753  * \brief Select the rendering context for a particular window.
   754  *
   755  * \return 0 on success, -1 if the selected window doesn't have a
   756  *         rendering context.
   757  */
   758 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
   759 
   760 /**
   761  * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h)
   762  *
   763  * \brief Create a texture
   764  *
   765  * \param format The format of the texture
   766  * \param access One of the enumerated values in SDL_TextureAccess
   767  * \param w The width of the texture in pixels
   768  * \param h The height of the texture in pixels
   769  *
   770  * \return The created texture is returned, or 0 if no render manager was active,  the format was unsupported, or the width or height were out of range.
   771  *
   772  * \sa SDL_QueryTexture()
   773  * \sa SDL_DestroyTexture()
   774  */
   775 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
   776                                                         int access, int w,
   777                                                         int h);
   778 
   779 /**
   780  * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface *surface)
   781  *
   782  * \brief Create a texture from an existing surface.
   783  *
   784  * \param format The format of the texture, or 0 to pick an appropriate format
   785  * \param access One of the enumerated values in SDL_TextureAccess
   786  * \param surface The surface containing pixel data used to fill the texture
   787  *
   788  * \return The created texture is returned, or 0 if no render manager was active,  the format was unsupported, or the surface width or height were out of range.
   789  *
   790  * \note The surface is not modified or freed by this function.
   791  *
   792  * \sa SDL_QueryTexture()
   793  * \sa SDL_DestroyTexture()
   794  */
   795 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
   796                                                                    format,
   797                                                                    int access,
   798                                                                    SDL_Surface
   799                                                                    * surface);
   800 
   801 /**
   802  * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
   803  *
   804  * \brief Query the attributes of a texture
   805  *
   806  * \param texture A texture to be queried
   807  * \param format A pointer filled in with the raw format of the texture.  The actual format may differ, but pixel transfers will use this format.
   808  * \param access A pointer filled in with the actual access to the texture.
   809  * \param w A pointer filled in with the width of the texture in pixels
   810  * \param h A pointer filled in with the height of the texture in pixels
   811  *
   812  * \return 0 on success, or -1 if the texture is not valid
   813  */
   814 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
   815                                              Uint32 * format, int *access,
   816                                              int *w, int *h);
   817 
   818 /**
   819  * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch)
   820  *
   821  * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access.
   822  *
   823  * \param texture A texture to be queried, which was created with SDL_TextureAccess_Local
   824  * \param pixels A pointer filled with a pointer to the pixels for the texture 
   825  * \param pitch A pointer filled in with the pitch of the pixel data
   826  *
   827  * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access.
   828  */
   829 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
   830                                                    void **pixels, int *pitch);
   831 
   832 /**
   833  * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
   834  *
   835  * \brief Update an indexed texture with a color palette
   836  *
   837  * \param texture The texture to update
   838  * \param colors The array of RGB color data
   839  * \param firstcolor The first index to update
   840  * \param ncolors The number of palette entries to fill with the color data
   841  *
   842  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   843  */
   844 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
   845                                                   const SDL_Color * colors,
   846                                                   int firstcolor,
   847                                                   int ncolors);
   848 
   849 /**
   850  * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
   851  *
   852  * \brief Update an indexed texture with a color palette
   853  *
   854  * \param texture The texture to update
   855  * \param colors The array to fill with RGB color data
   856  * \param firstcolor The first index to retrieve
   857  * \param ncolors The number of palette entries to retrieve
   858  *
   859  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   860  */
   861 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
   862                                                   SDL_Color * colors,
   863                                                   int firstcolor,
   864                                                   int ncolors);
   865 
   866 /**
   867  * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
   868  *
   869  * \brief Update the given texture rectangle with new pixel data.
   870  *
   871  * \param texture The texture to update
   872  * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
   873  * \param pixels The raw pixel data
   874  * \param pitch The number of bytes between rows of pixel data
   875  *
   876  * \return 0 on success, or -1 if the texture is not valid
   877  *
   878  * \note This is a very slow function for textures not created with SDL_TextureAccess_Local.
   879  */
   880 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
   881                                               const SDL_Rect * rect,
   882                                               const void *pixels, int pitch);
   883 
   884 /**
   885  * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
   886  *
   887  * \brief Lock a portion of the texture for pixel access.
   888  *
   889  * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local.
   890  * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
   891  * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
   892  * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
   893  * \param pitch This is filled in with the pitch of the locked pixels.
   894  *
   895  * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TextureAccess_Remote
   896  *
   897  * \sa SDL_DirtyTexture()
   898  * \sa SDL_UnlockTexture()
   899  */
   900 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
   901                                             const SDL_Rect * rect,
   902                                             int markDirty, void **pixels,
   903                                             int *pitch);
   904 
   905 /**
   906  * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
   907  *
   908  * \brief Unlock a texture, uploading the changes to video memory, if needed.
   909  *
   910  * \sa SDL_LockTexture()
   911  * \sa SDL_DirtyTexture()
   912  */
   913 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
   914 
   915 /**
   916  * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
   917  *
   918  * \brief Mark the specified rectangles of the texture as dirty.
   919  *
   920  * \note The texture must have been created with SDL_TextureAccess_Local.
   921  *
   922  * \sa SDL_LockTexture()
   923  * \sa SDL_UnlockTexture()
   924  */
   925 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
   926                                               int numrects,
   927                                               const SDL_Rect * rects);
   928 
   929 /**
   930  * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID)
   931  *
   932  * \brief Select a texture as the rendering target, or 0 to reselect the current window.
   933  *
   934  * \note The texture must have been created with SDL_TextureAccess_Render.
   935  */
   936 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID);
   937 
   938 /**
   939  * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color)
   940  *
   941  * \brief Fill the current rendering target with the specified color.
   942  *
   943  * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
   944  * \param color An ARGB color value.
   945  *
   946  * \return 0 on success, or -1 if there is no renderer current
   947  */
   948 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect,
   949                                            Uint32 color);
   950 
   951 /**
   952  * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode)
   953  *
   954  * \brief Copy a portion of the texture to the current rendering target.
   955  *
   956  * \param texture The source texture.
   957  * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
   958  * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
   959  * \param blendMode SDL_TextureBlendMode to be used if the source texture has an alpha channel.
   960  * \param scaleMode SDL_TextureScaleMode to be used if the source and destination rectangles don't have the same width and height.
   961  *
   962  * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation.
   963  *
   964  * \note You can check the video driver info to see what operations are supported.
   965  */
   966 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
   967                                            const SDL_Rect * srcrect,
   968                                            const SDL_Rect * dstrect,
   969                                            int blendMode, int scaleMode);
   970 
   971 /**
   972  * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
   973  *
   974  * \brief Read pixels from the current rendering target.
   975  *
   976  * \param rect A pointer to the rectangle to read, or NULL for the entire render target
   977  * \param pixels A pointer to be filled in with the pixel data
   978  * \param pitch The pitch of the pixels parameter
   979  *
   980  * \return 0 on success, or -1 if pixel reading is not supported.
   981  *
   982  * \warning This is a very slow operation, and should not be used frequently.
   983  */
   984 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
   985                                                  void *pixels, int pitch);
   986 
   987 /**
   988  * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
   989  *
   990  * \brief Write pixels to the current rendering target.
   991  *
   992  * \param rect A pointer to the rectangle to write, or NULL for the entire render target
   993  * \param pixels A pointer to the pixel data to write
   994  * \param pitch The pitch of the pixels parameter
   995  *
   996  * \return 0 on success, or -1 if pixel writing is not supported.
   997  *
   998  * \warning This is a very slow operation, and should not be used frequently.
   999  */
  1000 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
  1001                                                   const void *pixels,
  1002                                                   int pitch);
  1003 
  1004 /**
  1005  * \fn void SDL_RenderPresent(void)
  1006  *
  1007  * \brief Update the screen with rendering performed.
  1008  */
  1009 extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
  1010 
  1011 /**
  1012  * \fn void SDL_DestroyTexture(SDL_TextureID textureID);
  1013  *
  1014  * \brief Destroy the specified texture.
  1015  *
  1016  * \sa SDL_CreateTexture()
  1017  * \sa SDL_CreateTextureFromSurface()
  1018  */
  1019 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
  1020 
  1021 /**
  1022  * \fn void SDL_DestroyRenderer(SDL_WindowID windowID);
  1023  *
  1024  * \brief Destroy the rendering context for a window and free associated
  1025  *        textures.
  1026  *
  1027  * \sa SDL_CreateRenderer()
  1028  */
  1029 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
  1030 
  1031 /*
  1032  * Set the gamma correction for each of the color channels.
  1033  * The gamma values range (approximately) between 0.1 and 10.0
  1034  * 
  1035  * If this function isn't supported directly by the hardware, it will
  1036  * be emulated using gamma ramps, if available.  If successful, this
  1037  * function returns 0, otherwise it returns -1.
  1038  */
  1039 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
  1040 
  1041 /*
  1042  * Set the gamma translation table for the red, green, and blue channels
  1043  * of the video hardware.  Each table is an array of 256 16-bit quantities,
  1044  * representing a mapping between the input and output for that channel.
  1045  * The input is the index into the array, and the output is the 16-bit
  1046  * gamma value at that index, scaled to the output color precision.
  1047  * 
  1048  * You may pass NULL for any of the channels to leave it unchanged.
  1049  * If the call succeeds, it will return 0.  If the display driver or
  1050  * hardware does not support gamma translation, or otherwise fails,
  1051  * this function will return -1.
  1052  */
  1053 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
  1054                                              const Uint16 * green,
  1055                                              const Uint16 * blue);
  1056 
  1057 /*
  1058  * Retrieve the current values of the gamma translation tables.
  1059  * 
  1060  * You must pass in valid pointers to arrays of 256 16-bit quantities.
  1061  * Any of the pointers may be NULL to ignore that channel.
  1062  * If the call succeeds, it will return 0.  If the display driver or
  1063  * hardware does not support gamma translation, or otherwise fails,
  1064  * this function will return -1.
  1065  */
  1066 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
  1067                                              Uint16 * blue);
  1068 
  1069 /*
  1070  * Sets a portion of the colormap for the given 8-bit surface.  If 'surface'
  1071  * is not a palettized surface, this function does nothing, returning 0.
  1072  * If all of the colors were set as passed to SDL_SetColors(), it will
  1073  * return 1.  If not all the color entries were set exactly as given,
  1074  * it will return 0, and you should look at the surface palette to
  1075  * determine the actual color palette.
  1076  *
  1077  * When 'surface' is the surface associated with the current display, the
  1078  * display colormap will be updated with the requested colors.  If 
  1079  * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
  1080  * will always return 1, and the palette is guaranteed to be set the way
  1081  * you desire, even if the window colormap has to be warped or run under
  1082  * emulation.
  1083  */
  1084 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
  1085                                           const SDL_Color * colors,
  1086                                           int firstcolor, int ncolors);
  1087 
  1088 /*
  1089  * Maps an RGB triple to an opaque pixel value for a given pixel format
  1090  */
  1091 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
  1092     (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b);
  1093 
  1094 /*
  1095  * Maps an RGBA quadruple to a pixel value for a given pixel format
  1096  */
  1097 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat * format,
  1098                                            Uint8 r, Uint8 g, Uint8 b,
  1099                                            Uint8 a);
  1100 
  1101 /*
  1102  * Maps a pixel value into the RGB components for a given pixel format
  1103  */
  1104 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
  1105                                         Uint8 * r, Uint8 * g, Uint8 * b);
  1106 
  1107 /*
  1108  * Maps a pixel value into the RGBA components for a given pixel format
  1109  */
  1110 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
  1111                                          Uint8 * r, Uint8 * g, Uint8 * b,
  1112                                          Uint8 * a);
  1113 
  1114 /*
  1115  * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
  1116  * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  1117  * If the depth is greater than 8 bits, the pixel format is set using the
  1118  * flags '[RGB]mask'.
  1119  * If the function runs out of memory, it will return NULL.
  1120  *
  1121  * The 'flags' tell what kind of surface to create.
  1122  * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
  1123  * SDL_SRCALPHA means that the surface will be used for alpha blits.
  1124  */
  1125 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
  1126     (Uint32 flags, int width, int height, int depth,
  1127      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
  1128 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
  1129                                                               int width,
  1130                                                               int height,
  1131                                                               int depth,
  1132                                                               int pitch,
  1133                                                               Uint32 Rmask,
  1134                                                               Uint32 Gmask,
  1135                                                               Uint32 Bmask,
  1136                                                               Uint32 Amask);
  1137 extern DECLSPEC SDL_Surface *SDLCALL
  1138 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID);
  1139 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
  1140 
  1141 /*
  1142  * SDL_LockSurface() sets up a surface for directly accessing the pixels.
  1143  * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
  1144  * to and read from 'surface->pixels', using the pixel format stored in 
  1145  * 'surface->format'.  Once you are done accessing the surface, you should 
  1146  * use SDL_UnlockSurface() to release it.
  1147  *
  1148  * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
  1149  * to 0, then you can read and write to the surface at any time, and the
  1150  * pixel format of the surface will not change.
  1151  * 
  1152  * No operating system or library calls should be made between lock/unlock
  1153  * pairs, as critical system locks may be held during this time.
  1154  *
  1155  * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
  1156  */
  1157 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
  1158 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
  1159 
  1160 /*
  1161  * Load a surface from a seekable SDL data source (memory or file.)
  1162  * If 'freesrc' is non-zero, the source will be closed after being read.
  1163  * Returns the new surface, or NULL if there was an error.
  1164  * The new surface should be freed with SDL_FreeSurface().
  1165  */
  1166 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
  1167                                                     int freesrc);
  1168 
  1169 /* Convenience macro -- load a surface from a file */
  1170 #define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
  1171 
  1172 /*
  1173  * Save a surface to a seekable SDL data source (memory or file.)
  1174  * If 'freedst' is non-zero, the source will be closed after being written.
  1175  * Returns 0 if successful or -1 if there was an error.
  1176  */
  1177 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
  1178     (SDL_Surface * surface, SDL_RWops * dst, int freedst);
  1179 
  1180 /* Convenience macro -- save a surface to a file */
  1181 #define SDL_SaveBMP(surface, file) \
  1182 		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
  1183 
  1184 /*
  1185  * Sets the color key (transparent pixel) in a blittable surface.
  1186  * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 
  1187  * 'key' will be the transparent pixel in the source image of a blit.
  1188  * SDL_RLEACCEL requests RLE acceleration for the surface if present,
  1189  * and removes RLE acceleration if absent.
  1190  * If 'flag' is 0, this function clears any current color key.
  1191  * This function returns 0, or -1 if there was an error.
  1192  */
  1193 extern DECLSPEC int SDLCALL SDL_SetColorKey
  1194     (SDL_Surface * surface, Uint32 flag, Uint32 key);
  1195 
  1196 /*
  1197  * This function sets the alpha value for the entire surface, as opposed to
  1198  * using the alpha component of each pixel. This value measures the range
  1199  * of transparency of the surface, 0 being completely transparent to 255
  1200  * being completely opaque. An 'alpha' value of 255 causes blits to be
  1201  * opaque, the source pixels copied to the destination (the default). Note
  1202  * that per-surface alpha can be combined with colorkey transparency.
  1203  *
  1204  * If 'flag' is 0, alpha blending is disabled for the surface.
  1205  * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
  1206  * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
  1207  * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
  1208  *
  1209  * The 'alpha' parameter is ignored for surfaces that have an alpha channel.
  1210  */
  1211 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag,
  1212                                          Uint8 alpha);
  1213 
  1214 /*
  1215  * Sets the clipping rectangle for the destination surface in a blit.
  1216  *
  1217  * If the clip rectangle is NULL, clipping will be disabled.
  1218  * If the clip rectangle doesn't intersect the surface, the function will
  1219  * return SDL_FALSE and blits will be completely clipped.  Otherwise the
  1220  * function returns SDL_TRUE and blits to the surface will be clipped to
  1221  * the intersection of the surface area and the clipping rectangle.
  1222  *
  1223  * Note that blits are automatically clipped to the edges of the source
  1224  * and destination surfaces.
  1225  */
  1226 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
  1227                                                  const SDL_Rect * rect);
  1228 
  1229 /*
  1230  * Gets the clipping rectangle for the destination surface in a blit.
  1231  * 'rect' must be a pointer to a valid rectangle which will be filled
  1232  * with the correct values.
  1233  */
  1234 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
  1235                                              SDL_Rect * rect);
  1236 
  1237 /*
  1238  * Creates a new surface of the specified format, and then copies and maps 
  1239  * the given surface to it so the blit of the converted surface will be as 
  1240  * fast as possible.  If this function fails, it returns NULL.
  1241  *
  1242  * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
  1243  * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
  1244  * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  1245  * surface.
  1246  *
  1247  * This function is used internally by SDL_DisplayFormat().
  1248  */
  1249 extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
  1250     (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
  1251 
  1252 /*
  1253  * This function performs a fast fill of the given rectangle with 'color'
  1254  * The given rectangle is clipped to the destination surface clip area
  1255  * and the final fill rectangle is saved in the passed in pointer.
  1256  * If 'dstrect' is NULL, the whole surface will be filled with 'color'
  1257  * The color should be a pixel of the format used by the surface, and 
  1258  * can be generated by the SDL_MapRGB() function.
  1259  * This function returns 0 on success, or -1 on error.
  1260  */
  1261 extern DECLSPEC int SDLCALL SDL_FillRect
  1262     (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
  1263 
  1264 /*
  1265  * This performs a fast blit from the source surface to the destination
  1266  * surface.  It assumes that the source and destination rectangles are
  1267  * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
  1268  * surface (src or dst) is copied.  The final blit rectangles are saved
  1269  * in 'srcrect' and 'dstrect' after all clipping is performed.
  1270  * If the blit is successful, it returns 0, otherwise it returns -1.
  1271  *
  1272  * The blit function should not be called on a locked surface.
  1273  *
  1274  * The blit semantics for surfaces with and without alpha and colorkey
  1275  * are defined as follows:
  1276  *
  1277  * RGBA->RGB:
  1278  *     SDL_SRCALPHA set:
  1279  * 	alpha-blend (using alpha-channel).
  1280  * 	SDL_SRCCOLORKEY ignored.
  1281  *     SDL_SRCALPHA not set:
  1282  * 	copy RGB.
  1283  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1284  * 	RGB values of the source colour key, ignoring alpha in the
  1285  * 	comparison.
  1286  * 
  1287  * RGB->RGBA:
  1288  *     SDL_SRCALPHA set:
  1289  * 	alpha-blend (using the source per-surface alpha value);
  1290  * 	set destination alpha to opaque.
  1291  *     SDL_SRCALPHA not set:
  1292  * 	copy RGB, set destination alpha to source per-surface alpha value.
  1293  *     both:
  1294  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1295  * 	source colour key.
  1296  * 
  1297  * RGBA->RGBA:
  1298  *     SDL_SRCALPHA set:
  1299  * 	alpha-blend (using the source alpha channel) the RGB values;
  1300  * 	leave destination alpha untouched. [Note: is this correct?]
  1301  * 	SDL_SRCCOLORKEY ignored.
  1302  *     SDL_SRCALPHA not set:
  1303  * 	copy all of RGBA to the destination.
  1304  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1305  * 	RGB values of the source colour key, ignoring alpha in the
  1306  * 	comparison.
  1307  * 
  1308  * RGB->RGB: 
  1309  *     SDL_SRCALPHA set:
  1310  * 	alpha-blend (using the source per-surface alpha value).
  1311  *     SDL_SRCALPHA not set:
  1312  * 	copy RGB.
  1313  *     both:
  1314  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1315  * 	source colour key.
  1316  *
  1317  * If either of the surfaces were in video memory, and the blit returns -2,
  1318  * the video memory was lost, so it should be reloaded with artwork and 
  1319  * re-blitted:
  1320 	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
  1321 		while ( SDL_LockSurface(image) < 0 )
  1322 			Sleep(10);
  1323 		-- Write image pixels to image->pixels --
  1324 		SDL_UnlockSurface(image);
  1325 	}
  1326  * This happens under DirectX 5.0 when the system switches away from your
  1327  * fullscreen application.  The lock will also fail until you have access
  1328  * to the video memory again.
  1329  */
  1330 /* You should call SDL_BlitSurface() unless you know exactly how SDL
  1331    blitting works internally and how to use the other blit functions.
  1332 */
  1333 #define SDL_BlitSurface SDL_UpperBlit
  1334 
  1335 /* This is the public blit function, SDL_BlitSurface(), and it performs
  1336    rectangle validation and clipping before passing it to SDL_LowerBlit()
  1337 */
  1338 extern DECLSPEC int SDLCALL SDL_UpperBlit
  1339     (SDL_Surface * src, SDL_Rect * srcrect,
  1340      SDL_Surface * dst, SDL_Rect * dstrect);
  1341 /* This is a semi-private blit function and it performs low-level surface
  1342    blitting only.
  1343 */
  1344 extern DECLSPEC int SDLCALL SDL_LowerBlit
  1345     (SDL_Surface * src, SDL_Rect * srcrect,
  1346      SDL_Surface * dst, SDL_Rect * dstrect);
  1347 
  1348 /**
  1349  * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
  1350  *
  1351  * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
  1352  * \note This function uses a static buffer, and is not thread-safe.
  1353  */
  1354 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
  1355                                             SDL_Rect * srcrect,
  1356                                             SDL_Surface * dst,
  1357                                             SDL_Rect * dstrect);
  1358 
  1359 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1360 /* OpenGL support functions.                                                 */
  1361 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1362 
  1363 /*
  1364  * Dynamically load an OpenGL library, or the default one if path is NULL
  1365  *
  1366  * If you do this, you need to retrieve all of the GL functions used in
  1367  * your program from the dynamic library using SDL_GL_GetProcAddress().
  1368  */
  1369 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
  1370 
  1371 /*
  1372  * Get the address of a GL function
  1373  */
  1374 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
  1375 
  1376 /*
  1377  * Set an attribute of the OpenGL subsystem before window creation.
  1378  */
  1379 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
  1380 
  1381 /*
  1382  * Get an attribute of the OpenGL subsystem from the windowing
  1383  * interface, such as glX. This is of course different from getting
  1384  * the values from SDL's internal OpenGL subsystem, which only
  1385  * stores the values you request before initialization.
  1386  *
  1387  * Developers should track the values they pass into SDL_GL_SetAttribute
  1388  * themselves if they want to retrieve these values.
  1389  */
  1390 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
  1391 
  1392 /*
  1393  * Swap the OpenGL buffers, if double-buffering is supported.
  1394  */
  1395 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
  1396 
  1397 /* Ends C function definitions when using C++ */
  1398 #ifdef __cplusplus
  1399 /* *INDENT-OFF* */
  1400 }
  1401 /* *INDENT-ON* */
  1402 #endif
  1403 #include "close_code.h"
  1404 
  1405 #endif /* _SDL_video_h */
  1406 
  1407 /* vi: set ts=4 sw=4 expandtab: */