include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 18 Aug 2007 05:39:09 +0000
changeset 2267 c785543d1843
parent 2266 e61ad15a205f
child 2275 12ea0fdc0df2
permissions -rw-r--r--
Okay, still some bugs, but everything builds again...
     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     int x, y;
    57     int 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     void *driverdata;           /**< driver-specific data, initialize to 0 */
    79 } SDL_DisplayMode;
    80 
    81 /**
    82  * \typedef SDL_WindowID
    83  *
    84  * \brief The type used to identify a window
    85  *
    86  * \sa SDL_CreateWindow()
    87  * \sa SDL_CreateWindowFrom()
    88  * \sa SDL_DestroyWindow()
    89  * \sa SDL_GetWindowData()
    90  * \sa SDL_GetWindowFlags()
    91  * \sa SDL_GetWindowGrab()
    92  * \sa SDL_GetWindowPosition()
    93  * \sa SDL_GetWindowSize()
    94  * \sa SDL_GetWindowTitle()
    95  * \sa SDL_HideWindow()
    96  * \sa SDL_MaximizeWindow()
    97  * \sa SDL_MinimizeWindow()
    98  * \sa SDL_RaiseWindow()
    99  * \sa SDL_RestoreWindow()
   100  * \sa SDL_SetWindowData()
   101  * \sa SDL_SetWindowFullscreen()
   102  * \sa SDL_SetWindowGrab()
   103  * \sa SDL_SetWindowIcon()
   104  * \sa SDL_SetWindowPosition()
   105  * \sa SDL_SetWindowSize()
   106  * \sa SDL_SetWindowTitle()
   107  * \sa SDL_ShowWindow()
   108  */
   109 typedef Uint32 SDL_WindowID;
   110 
   111 /**
   112  * \enum SDL_WindowFlags
   113  *
   114  * \brief The flags on a window
   115  *
   116  * \sa SDL_GetWindowFlags()
   117  */
   118 typedef enum
   119 {
   120     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
   121     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
   122     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
   123     SDL_WINDOW_BORDERLESS = 0x00000008,         /**< no window decoration */
   124     SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
   125     SDL_WINDOW_MINIMIZED = 0x00000020,          /**< minimized */
   126     SDL_WINDOW_MAXIMIZED = 0x00000040,          /**< maximized */
   127     SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
   128     SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
   129     SDL_WINDOW_MOUSE_FOCUS = 0x00000400         /**< window has mouse focus */
   130 } SDL_WindowFlags;
   131 
   132 /**
   133  * \def SDL_WINDOWPOS_UNDEFINED
   134  * \brief Used to indicate that you don't care what the window position is.
   135  */
   136 #define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
   137 /**
   138  * \def SDL_WINDOWPOS_CENTERED
   139  * \brief Used to indicate that the window position should be centered.
   140  */
   141 #define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
   142 
   143 /**
   144  * \enum SDL_WindowEventID
   145  *
   146  * \brief Event subtype for window events
   147  */
   148 typedef enum
   149 {
   150     SDL_WINDOWEVENT_NONE,               /**< Never used */
   151     SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
   152     SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
   153     SDL_WINDOWEVENT_EXPOSED,            /**< Window has been exposed and should be redrawn */
   154     SDL_WINDOWEVENT_MOVED,              /**< Window has been moved to data1,data2 */
   155     SDL_WINDOWEVENT_RESIZED,            /**< Window size changed to data1xdata2 */
   156     SDL_WINDOWEVENT_MINIMIZED,          /**< Window has been minimized */
   157     SDL_WINDOWEVENT_MAXIMIZED,          /**< Window has been maximized */
   158     SDL_WINDOWEVENT_RESTORED,           /**< Window has been restored to normal size and position */
   159     SDL_WINDOWEVENT_ENTER,              /**< The window has gained mouse focus */
   160     SDL_WINDOWEVENT_LEAVE,              /**< The window has lost mouse focus */
   161     SDL_WINDOWEVENT_FOCUS_GAINED,       /**< The window has gained keyboard focus */
   162     SDL_WINDOWEVENT_FOCUS_LOST,         /**< The window has lost keyboard focus */
   163     SDL_WINDOWEVENT_CLOSE               /**< The window manager requests that the window be closed */
   164 } SDL_WindowEventID;
   165 
   166 /**
   167  * \enum SDL_RendererFlags
   168  *
   169  * \brief Flags used when creating a rendering context
   170  */
   171 typedef enum
   172 {
   173     SDL_RENDERER_SINGLEBUFFER = 0x00000001,     /**< Render directly to the window, if possible */
   174     SDL_RENDERER_PRESENTCOPY = 0x00000002,      /**< Present uses a copy from back buffer to the front buffer */
   175     SDL_RENDERER_PRESENTFLIP2 = 0x00000004,     /**< Present uses a flip, swapping back buffer and front buffer */
   176     SDL_RENDERER_PRESENTFLIP3 = 0x00000008,     /**< Present uses a flip, rotating between two back buffers and a front buffer */
   177     SDL_RENDERER_PRESENTDISCARD = 0x00000010,   /**< Present leaves the contents of the backbuffer undefined */
   178     SDL_RENDERER_PRESENTVSYNC = 0x00000020,     /**< Present is synchronized with the refresh rate */
   179     SDL_RENDERER_ACCELERATED = 0x00000040       /**< The renderer uses hardware acceleration */
   180 } SDL_RendererFlags;
   181 
   182 /**
   183  * \struct SDL_RendererInfo
   184  *
   185  * \brief Information on the capabilities of a render driver or context
   186  */
   187 typedef struct SDL_RendererInfo
   188 {
   189     const char *name;           /**< The name of the renderer */
   190     Uint32 flags;               /**< Supported SDL_RendererFlags */
   191     Uint32 mod_modes;           /**< A mask of supported channel modulation */
   192     Uint32 blend_modes;         /**< A mask of supported blend modes */
   193     Uint32 scale_modes;         /**< A mask of supported scale modes */
   194     Uint32 num_texture_formats; /**< The number of available texture formats */
   195     Uint32 texture_formats[20]; /**< The available texture formats */
   196     int max_texture_width;      /**< The maximimum texture width */
   197     int max_texture_height;     /**< The maximimum texture height */
   198 } SDL_RendererInfo;
   199 
   200 /**
   201  * \enum SDL_TextureAccess
   202  *
   203  * \brief The access pattern allowed for a texture
   204  */
   205 typedef enum
   206 {
   207     SDL_TEXTUREACCESS_STATIC,    /**< Changes rarely, not lockable */
   208     SDL_TEXTUREACCESS_STREAMING  /**< Changes frequently, lockable */
   209 } SDL_TextureAccess;
   210 
   211 /**
   212  * \enum SDL_TextureModulate
   213  *
   214  * \brief The texture channel modulation used in SDL_RenderCopy()
   215  */
   216 typedef enum
   217 {
   218     SDL_TEXTUREMODULATE_NONE = 0x00000000,     /**< No modulation */
   219     SDL_TEXTUREMODULATE_COLOR = 0x00000001,    /**< srcC = srcC * color */
   220     SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
   221 } SDL_TextureModulate;
   222 
   223 /**
   224  * \enum SDL_TextureBlendMode
   225  *
   226  * \brief The texture blend mode used in SDL_RenderCopy()
   227  */
   228 typedef enum
   229 {
   230     SDL_TEXTUREBLENDMODE_NONE = 0x00000000,     /**< No blending */
   231     SDL_TEXTUREBLENDMODE_MASK = 0x00000001,     /**< dst = A ? src : dst (alpha is mask) */
   232     SDL_TEXTUREBLENDMODE_BLEND = 0x00000002,    /**< dst = (src * A) + (dst * (1-A)) */
   233     SDL_TEXTUREBLENDMODE_ADD = 0x00000004,      /**< dst = (src * A) + dst */
   234     SDL_TEXTUREBLENDMODE_MOD = 0x00000008       /**< dst = src * dst */
   235 } SDL_TextureBlendMode;
   236 
   237 /**
   238  * \enum SDL_TextureScaleMode
   239  *
   240  * \brief The texture scale mode used in SDL_RenderCopy()
   241  */
   242 typedef enum
   243 {
   244     SDL_TEXTURESCALEMODE_NONE = 0x00000000,     /**< No scaling, rectangles must match dimensions */
   245     SDL_TEXTURESCALEMODE_FAST = 0x00000001,     /**< Point sampling or equivalent algorithm */
   246     SDL_TEXTURESCALEMODE_SLOW = 0x00000002,     /**< Linear filtering or equivalent algorithm */
   247     SDL_TEXTURESCALEMODE_BEST = 0x00000004      /**< Bicubic filtering or equivalent algorithm */
   248 } SDL_TextureScaleMode;
   249 
   250 /**
   251  * \typedef SDL_TextureID
   252  *
   253  * \brief An efficient driver-specific representation of pixel data
   254  */
   255 typedef Uint32 SDL_TextureID;
   256 
   257 /**
   258  * \typedef SDL_GLContext
   259  *
   260  * \brief An opaque handle to an OpenGL context.
   261  */
   262 typedef void *SDL_GLContext;
   263 
   264 
   265 /* These are the currently supported flags for the SDL_surface */
   266 /* Used internally (read-only) */
   267 #define SDL_PREALLOC        0x00000001  /* Surface uses preallocated memory */
   268 #define SDL_RLEACCEL        0x00000002  /* Surface is RLE encoded */
   269 
   270 /* Evaluates to true if the surface needs to be locked before access */
   271 #define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
   272 
   273 /* This structure should be treated as read-only, except for 'pixels',
   274    which, if not NULL, contains the raw pixel data for the surface.
   275 */
   276 typedef struct SDL_Surface
   277 {
   278     Uint32 flags;               /* Read-only */
   279     SDL_PixelFormat *format;    /* Read-only */
   280     int w, h;                   /* Read-only */
   281     int pitch;                  /* Read-only */
   282     void *pixels;               /* Read-write */
   283 
   284     /* Application data associated with the surfade */
   285     void *userdata;             /* Read-write */
   286 
   287     /* information needed for surfaces requiring locks */
   288     int locked;                 /* Read-only */
   289     void *lock_data;            /* Read-only */
   290 
   291     /* clipping information */
   292     SDL_Rect clip_rect;         /* Read-only */
   293 
   294     /* info for fast blit mapping to other surfaces */
   295     struct SDL_BlitMap *map;    /* Private */
   296 
   297     /* format version, bumped at every change to invalidate blit maps */
   298     unsigned int format_version;        /* Private */
   299 
   300     /* Reference count -- used when freeing surface */
   301     int refcount;               /* Read-mostly */
   302 } SDL_Surface;
   303 
   304 /* typedef for private surface blitting functions */
   305 typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
   306                          struct SDL_Surface * dst, SDL_Rect * dstrect);
   307 
   308 
   309 /**
   310  * \enum SDL_GLattr
   311  *
   312  * \brief OpenGL configuration attributes
   313  */
   314 typedef enum
   315 {
   316     SDL_GL_RED_SIZE,
   317     SDL_GL_GREEN_SIZE,
   318     SDL_GL_BLUE_SIZE,
   319     SDL_GL_ALPHA_SIZE,
   320     SDL_GL_BUFFER_SIZE,
   321     SDL_GL_DOUBLEBUFFER,
   322     SDL_GL_DEPTH_SIZE,
   323     SDL_GL_STENCIL_SIZE,
   324     SDL_GL_ACCUM_RED_SIZE,
   325     SDL_GL_ACCUM_GREEN_SIZE,
   326     SDL_GL_ACCUM_BLUE_SIZE,
   327     SDL_GL_ACCUM_ALPHA_SIZE,
   328     SDL_GL_STEREO,
   329     SDL_GL_MULTISAMPLEBUFFERS,
   330     SDL_GL_MULTISAMPLESAMPLES,
   331     SDL_GL_ACCELERATED_VISUAL
   332 } SDL_GLattr;
   333 
   334 
   335 /* Function prototypes */
   336 
   337 /**
   338  * \fn int SDL_GetNumVideoDrivers(void)
   339  *
   340  * \brief Get the number of video drivers compiled into SDL
   341  *
   342  * \sa SDL_GetVideoDriver()
   343  */
   344 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
   345 
   346 /**
   347  * \fn const char *SDL_GetVideoDriver(int index)
   348  *
   349  * \brief Get the name of a built in video driver.
   350  *
   351  * \note The video drivers are presented in the order in which they are
   352  * normally checked during initialization.
   353  *
   354  * \sa SDL_GetNumVideoDrivers()
   355  */
   356 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
   357 
   358 /**
   359  * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
   360  *
   361  * \brief Initialize the video subsystem, optionally specifying a video driver.
   362  *
   363  * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
   364  * \param flags FIXME: Still needed?
   365  *
   366  * \return 0 on success, -1 on error
   367  *
   368  * This function initializes the video subsystem; setting up a connection
   369  * to the window manager, etc, and determines the available display modes
   370  * and pixel formats, but does not initialize a window or graphics mode.
   371  *
   372  * \sa SDL_VideoQuit()
   373  */
   374 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
   375                                           Uint32 flags);
   376 
   377 /**
   378  * \fn void SDL_VideoQuit(void)
   379  *
   380  * \brief Shuts down the video subsystem.
   381  *
   382  * This function closes all windows, and restores the original video mode.
   383  *
   384  * \sa SDL_VideoInit()
   385  */
   386 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
   387 
   388 /**
   389  * \fn const char *SDL_GetCurrentVideoDriver(void)
   390  *
   391  * \brief Returns the name of the currently initialized video driver.
   392  *
   393  * \return The name of the current video driver or NULL if no driver
   394  *         has been initialized
   395  *
   396  * \sa SDL_GetNumVideoDrivers()
   397  * \sa SDL_GetVideoDriver()
   398  */
   399 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
   400 
   401 /**
   402  * \fn int SDL_GetNumVideoDisplays(void)
   403  *
   404  * \brief Returns the number of available video displays.
   405  *
   406  * \sa SDL_SelectVideoDisplay()
   407  */
   408 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
   409 
   410 /**
   411  * \fn int SDL_SelectVideoDisplay(int index)
   412  *
   413  * \brief Set the index of the currently selected display.
   414  *
   415  * \return 0 on success, or -1 if the index is out of range.
   416  *
   417  * \sa SDL_GetNumVideoDisplays()
   418  * \sa SDL_GetCurrentVideoDisplay()
   419  */
   420 extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
   421 
   422 /**
   423  * \fn int SDL_GetCurrentVideoDisplay(void)
   424  *
   425  * \brief Get the index of the currently selected display.
   426  *
   427  * \return The index of the currently selected display.
   428  *
   429  * \sa SDL_GetNumVideoDisplays()
   430  * \sa SDL_SelectVideoDisplay()
   431  */
   432 extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
   433 
   434 /**
   435  * \fn int SDL_GetNumDisplayModes(void)
   436  *
   437  * \brief Returns the number of available display modes for the current display.
   438  *
   439  * \sa SDL_GetDisplayMode()
   440  */
   441 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
   442 
   443 /**
   444  * \fn int SDL_GetDisplayMode(int index, SDL_DisplayMode *mode)
   445  *
   446  * \brief Fill in information about a specific display mode.
   447  *
   448  * \note The display modes are sorted in this priority:
   449  *       \li bits per pixel -> more colors to fewer colors
   450  *       \li width -> largest to smallest
   451  *       \li height -> largest to smallest
   452  *       \li refresh rate -> highest to lowest
   453  *
   454  * \sa SDL_GetNumDisplayModes()
   455  */
   456 extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
   457                                                SDL_DisplayMode * mode);
   458 
   459 /**
   460  * \fn int SDL_GetDesktopDisplayMode(SDL_DisplayMode *mode)
   461  *
   462  * \brief Fill in information about the desktop display mode for the current display.
   463  */
   464 extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
   465 
   466 /**
   467  * \fn int SDL_GetCurrentDisplayMode(SDL_DisplayMode *mode)
   468  *
   469  * \brief Fill in information about the current display mode.
   470  */
   471 extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
   472 
   473 /**
   474  * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
   475  *
   476  * \brief Get the closest match to the requested display mode.
   477  *
   478  * \param mode The desired display mode
   479  * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
   480  *
   481  * \return The passed in value 'closest', or NULL if no matching video mode was available.
   482  *
   483  * 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.
   484  *
   485  * \sa SDL_GetNumDisplayModes()
   486  * \sa SDL_GetDisplayMode()
   487  */
   488 extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
   489                                                                    SDL_DisplayMode
   490                                                                    * mode,
   491                                                                    SDL_DisplayMode
   492                                                                    * closest);
   493 
   494 /**
   495  * \fn int SDL_SetFullscreenDisplayMode(const SDL_DisplayMode *mode)
   496  *
   497  * \brief Set the display mode used when a fullscreen window is visible
   498  *        on the currently selected display.
   499  *
   500  * \param mode The mode to use, or NULL for the desktop mode.
   501  *
   502  * \return 0 on success, or -1 if setting the display mode failed.
   503  *
   504  * \sa SDL_SetWindowFullscreen()
   505  */
   506 extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode
   507                                                          * mode);
   508 
   509 /**
   510  * \fn int SDL_GetFullscreenDisplayMode(SDL_DisplayMode *mode)
   511  *
   512  * \brief Fill in information about the display mode used when a fullscreen
   513  *        window is visible on the currently selected display.
   514  */
   515 extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
   516                                                          mode);
   517 
   518 /**
   519  * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
   520  *
   521  * \brief Set the palette entries for indexed display modes.
   522  *
   523  * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
   524  */
   525 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
   526                                                   int firstcolor,
   527                                                   int ncolors);
   528 
   529 /**
   530  * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
   531  *
   532  * \brief Gets the palette entries for indexed display modes.
   533  *
   534  * \return 0 on success, or -1 if the display mode isn't palettized
   535  */
   536 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
   537                                                   int firstcolor,
   538                                                   int ncolors);
   539 
   540 /**
   541  * \fn int SDL_SetGamma(float red, float green, float blue)
   542  *
   543  * \brief Set the gamma correction for each of the color channels on the currently selected display.
   544  *
   545  * \return 0 on success, or -1 if setting the gamma isn't supported.
   546  *
   547  * \sa SDL_SetGammaRamp()
   548  */
   549 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
   550 
   551 /**
   552  * \fn int SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
   553  *
   554  * \brief Set the gamma ramp for the currently selected display.
   555  *
   556  * \param red The translation table for the red channel, or NULL
   557  * \param green The translation table for the green channel, or NULL
   558  * \param blue The translation table for the blue channel, or NULL
   559  *
   560  * \return 0 on success, or -1 if gamma ramps are unsupported.
   561  *
   562  * Set the gamma translation table for the red, green, and blue channels
   563  * of the video hardware.  Each table is an array of 256 16-bit quantities,
   564  * representing a mapping between the input and output for that channel.
   565  * The input is the index into the array, and the output is the 16-bit
   566  * gamma value at that index, scaled to the output color precision.
   567  * 
   568  * \sa SDL_GetGammaRamp()
   569  */
   570 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
   571                                              const Uint16 * green,
   572                                              const Uint16 * blue);
   573 
   574 /**
   575  * \fn int SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
   576  *
   577  * \brief Get the gamma ramp for the currently selected display.
   578  *
   579  * \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
   580  * \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
   581  * \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
   582  * 
   583  * \return 0 on success, or -1 if gamma ramps are unsupported.
   584  *
   585  * \sa SDL_SetGammaRamp()
   586  */
   587 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
   588                                              Uint16 * blue);
   589 
   590 
   591 /**
   592  * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
   593  *
   594  * \brief Create a window with the specified position, dimensions, and flags.
   595  *
   596  * \param title The title of the window, in UTF-8 encoding
   597  * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   598  * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   599  * \param w The width of the window
   600  * \param h The height of the window
   601  * \param flags The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_SHOWN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED
   602  *
   603  * \return The id of the window created, or zero if window creation failed.
   604  *
   605  * \sa SDL_DestroyWindow()
   606  */
   607 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
   608                                                       int x, int y, int w,
   609                                                       int h, Uint32 flags);
   610 
   611 /**
   612  * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
   613  *
   614  * \brief Create an SDL window struct from an existing native window.
   615  *
   616  * \param data A pointer to driver-dependent window creation data
   617  *
   618  * \return The id of the window created, or zero if window creation failed.
   619  *
   620  * \warning This function is NOT SUPPORTED, use at your own risk!
   621  *
   622  * \sa SDL_DestroyWindow()
   623  */
   624 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
   625 
   626 /**
   627  * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
   628  *
   629  * \brief Get the window flags.
   630  */
   631 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
   632 
   633 /**
   634  * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
   635  *
   636  * \brief Set the title of the window, in UTF-8 format.
   637  *
   638  * \sa SDL_GetWindowTitle()
   639  */
   640 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
   641                                                 const char *title);
   642 
   643 /**
   644  * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
   645  *
   646  * \brief Get the title of the window, in UTF-8 format.
   647  *
   648  * \sa SDL_SetWindowTitle()
   649  */
   650 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
   651 
   652 /**
   653  * \fn void SDL_SetWindowIcon(SDL_Surface *icon)
   654  *
   655  * \brief Set the icon of the window.
   656  *
   657  * \param icon The icon for the window
   658  *
   659  * FIXME: The icon needs to be set before the window is first shown.  Should some icon representation be part of the window creation data?
   660  */
   661 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon);
   662 
   663 /**
   664  * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
   665  *
   666  * \brief Associate an arbitrary pointer with the window.
   667  *
   668  * \sa SDL_GetWindowData()
   669  */
   670 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
   671                                                void *userdata);
   672 
   673 /**
   674  * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
   675  *
   676  * \brief Retrieve the data pointer associated with the window.
   677  *
   678  * \sa SDL_SetWindowData()
   679  */
   680 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
   681 
   682 /**
   683  * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
   684  *
   685  * \brief Set the position of the window.
   686  *
   687  * \param windowID The window to reposition
   688  * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   689  * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   690  *
   691  * \note The window coordinate origin is the upper left of the display.
   692  *
   693  * \sa SDL_GetWindowPosition()
   694  */
   695 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
   696                                                    int x, int y);
   697 
   698 /**
   699  * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
   700  *
   701  * \brief Get the position of the window.
   702  *
   703  * \sa SDL_SetWindowPosition()
   704  */
   705 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
   706                                                    int *x, int *y);
   707 
   708 /**
   709  * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
   710  *
   711  * \brief Set the size of the window's client area.
   712  *
   713  * \note You can't change the size of a fullscreen window, it automatically
   714  * matches the size of the display mode.
   715  *
   716  * \sa SDL_GetWindowSize()
   717  */
   718 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
   719                                                int h);
   720 
   721 /**
   722  * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w)
   723  *
   724  * \brief Get the size of the window's client area.
   725  *
   726  * \sa SDL_SetWindowSize()
   727  */
   728 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
   729                                                int *h);
   730 
   731 /**
   732  * \fn void SDL_ShowWindow(SDL_WindowID windowID)
   733  *
   734  * \brief Show the window
   735  *
   736  * \sa SDL_HideWindow()
   737  */
   738 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
   739 
   740 /**
   741  * \fn void SDL_HideWindow(SDL_WindowID windowID)
   742  *
   743  * \brief Hide the window
   744  *
   745  * \sa SDL_ShowWindow()
   746  */
   747 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
   748 
   749 /**
   750  * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
   751  *
   752  * \brief Raise the window above other windows and set the input focus.
   753  */
   754 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
   755 
   756 /**
   757  * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
   758  *
   759  * \brief Make the window as large as possible.
   760  *
   761  * \sa SDL_RestoreWindow()
   762  */
   763 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
   764 
   765 /**
   766  * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
   767  *
   768  * \brief Minimize the window to an iconic representation.
   769  *
   770  * \sa SDL_RestoreWindow()
   771  */
   772 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
   773 
   774 /**
   775  * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
   776  *
   777  * \brief Restore the size and position of a minimized or maximized window.
   778  *
   779  * \sa SDL_MaximizeWindow()
   780  * \sa SDL_MinimizeWindow()
   781  */
   782 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
   783 
   784 /**
   785  * \fn int SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
   786  *
   787  * \brief Set the window's fullscreen state.
   788  *
   789  * \return 0 on success, or -1 if setting the display mode failed.
   790  *
   791  * \sa SDL_SetFullscreenDisplayMode()
   792  */
   793 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
   794                                                     int fullscreen);
   795 
   796 /**
   797  * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
   798  *
   799  * \brief Set the window's input grab mode.
   800  *
   801  * \param mode This is 1 to grab input, and 0 to release input.
   802  *
   803  * \sa SDL_GetWindowGrab()
   804  */
   805 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
   806                                                int mode);
   807 
   808 /**
   809  * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
   810  *
   811  * \brief Get the window's input grab mode.
   812  *
   813  * \return This returns 1 if input is grabbed, and 0 otherwise.
   814  *
   815  * \sa SDL_SetWindowGrab()
   816  */
   817 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
   818 
   819 /**
   820  * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
   821  *
   822  * \brief Get driver specific information about a window.
   823  *
   824  * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
   825  */
   826 struct SDL_SysWMinfo;
   827 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   828                                                      struct SDL_SysWMinfo
   829                                                      *info);
   830 
   831 /**
   832  * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
   833  *
   834  * \brief Destroy a window.
   835  */
   836 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
   837 
   838 /**
   839  * \fn int SDL_GetNumRenderDrivers(void)
   840  *
   841  * \brief Get the number of 2D rendering drivers available for the current display.
   842  *
   843  * A render driver is a set of code that handles rendering and texture
   844  * management on a particular display.  Normally there is only one, but
   845  * some drivers may have several available with different capabilities.
   846  *
   847  * \sa SDL_GetRenderDriverInfo()
   848  * \sa SDL_CreateRenderer()
   849  */
   850 extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
   851 
   852 /**
   853  * \fn int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
   854  *
   855  * \brief Get information about a specific 2D rendering driver for the current display.
   856  *
   857  * \param index The index of the driver to query information about.
   858  * \param info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
   859  *
   860  * \return 0 on success, -1 if the index was out of range
   861  *
   862  * \sa SDL_CreateRenderer()
   863  */
   864 extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
   865                                                     SDL_RendererInfo * info);
   866 
   867 /**
   868  * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags)
   869  *
   870  * \brief Create and make active a 2D rendering context for a window.
   871  *
   872  * \param windowID The window used for rendering
   873  * \param index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
   874  * \param flags SDL_RendererFlags
   875  *
   876  * \return 0 on success, -1 if the flags were not supported, or -2 if
   877  *         there isn't enough memory to support the requested flags
   878  *
   879  * \sa SDL_SelectRenderer()
   880  * \sa SDL_GetRendererInfo()
   881  * \sa SDL_DestroyRenderer()
   882  */
   883 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
   884                                                int index, Uint32 flags);
   885 
   886 /**
   887  * \fn int SDL_SelectRenderer(SDL_WindowID windowID)
   888  *
   889  * \brief Select the rendering context for a particular window.
   890  *
   891  * \return 0 on success, -1 if the selected window doesn't have a
   892  *         rendering context.
   893  */
   894 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
   895 
   896 /**
   897  * \fn int SDL_GetRendererInfo(SDL_RendererInfo *info)
   898  *
   899  * \brief Get information about the current rendering context.
   900  */
   901 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
   902 
   903 /**
   904  * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h)
   905  *
   906  * \brief Create a texture for the current rendering context.
   907  *
   908  * \param format The format of the texture
   909  * \param access One of the enumerated values in SDL_TextureAccess
   910  * \param w The width of the texture in pixels
   911  * \param h The height of the texture in pixels
   912  *
   913  * \return The created texture is returned, or 0 if no rendering context was active,  the format was unsupported, or the width or height were out of range.
   914  *
   915  * \sa SDL_QueryTexture()
   916  * \sa SDL_DestroyTexture()
   917  */
   918 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
   919                                                         int access, int w,
   920                                                         int h);
   921 
   922 /**
   923  * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface *surface)
   924  *
   925  * \brief Create a texture from an existing surface.
   926  *
   927  * \param format The format of the texture, or 0 to pick an appropriate format
   928  * \param surface The surface containing pixel data used to fill the texture
   929  *
   930  * \return The created texture is returned, or 0 if no rendering context was active,  the format was unsupported, or the surface width or height were out of range.
   931  *
   932  * \note The surface is not modified or freed by this function.
   933  *
   934  * \sa SDL_QueryTexture()
   935  * \sa SDL_DestroyTexture()
   936  */
   937 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
   938                                                                    format,
   939                                                                    SDL_Surface
   940                                                                    * surface);
   941 
   942 /**
   943  * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
   944  *
   945  * \brief Query the attributes of a texture
   946  *
   947  * \param texture A texture to be queried
   948  * \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.
   949  * \param access A pointer filled in with the actual access to the texture.
   950  * \param w A pointer filled in with the width of the texture in pixels
   951  * \param h A pointer filled in with the height of the texture in pixels
   952  *
   953  * \return 0 on success, or -1 if the texture is not valid
   954  */
   955 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
   956                                              Uint32 * format, int *access,
   957                                              int *w, int *h);
   958 
   959 /**
   960  * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch)
   961  *
   962  * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access.
   963  *
   964  * \param texture A texture to be queried, which was created with SDL_TEXTUREACCESS_STREAMING
   965  * \param pixels A pointer filled with a pointer to the pixels for the texture 
   966  * \param pitch A pointer filled in with the pitch of the pixel data
   967  *
   968  * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access.
   969  */
   970 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
   971                                                    void **pixels, int *pitch);
   972 
   973 /**
   974  * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
   975  *
   976  * \brief Update an indexed texture with a color palette
   977  *
   978  * \param texture The texture to update
   979  * \param colors The array of RGB color data
   980  * \param firstcolor The first index to update
   981  * \param ncolors The number of palette entries to fill with the color data
   982  *
   983  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   984  */
   985 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
   986                                                   const SDL_Color * colors,
   987                                                   int firstcolor,
   988                                                   int ncolors);
   989 
   990 /**
   991  * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
   992  *
   993  * \brief Update an indexed texture with a color palette
   994  *
   995  * \param texture The texture to update
   996  * \param colors The array to fill with RGB color data
   997  * \param firstcolor The first index to retrieve
   998  * \param ncolors The number of palette entries to retrieve
   999  *
  1000  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
  1001  */
  1002 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
  1003                                                   SDL_Color * colors,
  1004                                                   int firstcolor,
  1005                                                   int ncolors);
  1006 
  1007 /**
  1008  * \fn int SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
  1009  *
  1010  * \brief Set an additional color value used in render copy operations
  1011  *
  1012  * \param texture The texture to update
  1013  * \param r The red source color value multiplied into copy operations
  1014  * \param g The green source color value multiplied into copy operations
  1015  * \param b The blue source color value multiplied into copy operations
  1016  *
  1017  * \return 0 on success, or -1 if the texture is not valid or color modulation is not supported
  1018  *
  1019  * \sa SDL_GetTextureColorMod()
  1020  */
  1021 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID,
  1022                                                    Uint8 r, Uint8 g, Uint8 b);
  1023 
  1024 
  1025 /**
  1026  * \fn int SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 *r, Uint8 *g, Uint8 *b)
  1027  *
  1028  * \brief Get the additional color value used in render copy operations
  1029  *
  1030  * \param texture The texture to query
  1031  * \param r A pointer filled in with the source red color value
  1032  * \param g A pointer filled in with the source green color value
  1033  * \param b A pointer filled in with the source blue color value
  1034  *
  1035  * \return 0 on success, or -1 if the texture is not valid
  1036  *
  1037  * \sa SDL_SetTextureColorMod()
  1038  */
  1039 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID,
  1040                                                    Uint8 * r, Uint8 * g,
  1041                                                    Uint8 * b);
  1042 
  1043 /**
  1044  * \fn int SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
  1045  *
  1046  * \brief Set an additional alpha value used in render copy operations
  1047  *
  1048  * \param texture The texture to update
  1049  * \param alpha The source alpha value multiplied into copy operations.
  1050  *
  1051  * \return 0 on success, or -1 if the texture is not valid or alpha modulation is not supported
  1052  *
  1053  * \sa SDL_GetTextureAlphaMod()
  1054  */
  1055 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID,
  1056                                                    Uint8 alpha);
  1057 
  1058 /**
  1059  * \fn int SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 *alpha)
  1060  *
  1061  * \brief Get the additional alpha value used in render copy operations
  1062  *
  1063  * \param texture The texture to query
  1064  * \param alpha A pointer filled in with the source alpha value
  1065  *
  1066  * \return 0 on success, or -1 if the texture is not valid
  1067  *
  1068  * \sa SDL_SetTextureAlphaMod()
  1069  */
  1070 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID,
  1071                                                    Uint8 * alpha);
  1072 
  1073 /**
  1074  * \fn int SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
  1075  *
  1076  * \brief Set the blend mode used for texture copy operations
  1077  *
  1078  * \param texture The texture to update
  1079  * \param blendMode SDL_TextureBlendMode to use for texture blending
  1080  *
  1081  * \return 0 on success, or -1 if the texture is not valid or the blend mode is not supported
  1082  *
  1083  * \note If the blend mode is not supported, the closest supported mode is chosen.
  1084  *
  1085  * \sa SDL_GetTextureBlendMode()
  1086  */
  1087 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID,
  1088                                                     int blendMode);
  1089 
  1090 /**
  1091  * \fn int SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
  1092  *
  1093  * \brief Get the blend mode used for texture copy operations
  1094  *
  1095  * \param texture The texture to query
  1096  * \param blendMode A pointer filled in with the current blend mode
  1097  *
  1098  * \return 0 on success, or -1 if the texture is not valid
  1099  *
  1100  * \sa SDL_SetTextureBlendMode()
  1101  */
  1102 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID,
  1103                                                     int *blendMode);
  1104 
  1105 /**
  1106  * \fn int SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
  1107  *
  1108  * \brief Set the scale mode used for texture copy operations
  1109  *
  1110  * \param texture The texture to update
  1111  * \param scaleMode SDL_TextureScaleMode to use for texture scaling
  1112  *
  1113  * \return 0 on success, or -1 if the texture is not valid or the scale mode is not supported
  1114  *
  1115  * \note If the scale mode is not supported, the closest supported mode is chosen.
  1116  *
  1117  * \sa SDL_GetTextureScaleMode()
  1118  */
  1119 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID,
  1120                                                     int scaleMode);
  1121 
  1122 /**
  1123  * \fn int SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
  1124  *
  1125  * \brief Get the scale mode used for texture copy operations
  1126  *
  1127  * \param texture The texture to query
  1128  * \param scaleMode A pointer filled in with the current scale mode
  1129  *
  1130  * \return 0 on success, or -1 if the texture is not valid
  1131  *
  1132  * \sa SDL_SetTextureScaleMode()
  1133  */
  1134 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID,
  1135                                                     int *scaleMode);
  1136 
  1137 /**
  1138  * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
  1139  *
  1140  * \brief Update the given texture rectangle with new pixel data.
  1141  *
  1142  * \param texture The texture to update
  1143  * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  1144  * \param pixels The raw pixel data
  1145  * \param pitch The number of bytes between rows of pixel data
  1146  *
  1147  * \return 0 on success, or -1 if the texture is not valid
  1148  *
  1149  * \note This is a fairly slow function.
  1150  */
  1151 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
  1152                                               const SDL_Rect * rect,
  1153                                               const void *pixels, int pitch);
  1154 
  1155 /**
  1156  * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
  1157  *
  1158  * \brief Lock a portion of the texture for pixel access.
  1159  *
  1160  * \param textureID The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
  1161  * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
  1162  * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
  1163  * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
  1164  * \param pitch This is filled in with the pitch of the locked pixels.
  1165  *
  1166  * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TEXTUREACCESS_STATIC
  1167  *
  1168  * \sa SDL_DirtyTexture()
  1169  * \sa SDL_UnlockTexture()
  1170  */
  1171 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
  1172                                             const SDL_Rect * rect,
  1173                                             int markDirty, void **pixels,
  1174                                             int *pitch);
  1175 
  1176 /**
  1177  * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
  1178  *
  1179  * \brief Unlock a texture, uploading the changes to video memory, if needed.
  1180  *
  1181  * \sa SDL_LockTexture()
  1182  * \sa SDL_DirtyTexture()
  1183  */
  1184 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
  1185 
  1186 /**
  1187  * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
  1188  *
  1189  * \brief Mark the specified rectangles of the texture as dirty.
  1190  *
  1191  * \param textureID The texture to mark dirty, which was created with SDL_TEXTUREACCESS_STREAMING.
  1192  * \param numrects The number of rectangles pointed to by rects.
  1193  * \param rects The pointer to an array of dirty rectangles.
  1194  *
  1195  * \sa SDL_LockTexture()
  1196  * \sa SDL_UnlockTexture()
  1197  */
  1198 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
  1199                                               int numrects,
  1200                                               const SDL_Rect * rects);
  1201 
  1202 /**
  1203  * \fn void SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect *rect)
  1204  *
  1205  * \brief Fill the current rendering target with the specified color.
  1206  *
  1207  * \param r The red value used to fill the rendering target
  1208  * \param g The green value used to fill the rendering target
  1209  * \param b The blue value used to fill the rendering target
  1210  * \param a The alpha value used to fill the rendering target, usually SDL_ALPHA_OPAQUE (255)
  1211  * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
  1212  *
  1213  * \return 0 on success, or -1 if there is no rendering context current
  1214  */
  1215 extern DECLSPEC int SDLCALL SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a,
  1216                                            const SDL_Rect * rect);
  1217 
  1218 /**
  1219  * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
  1220  *
  1221  * \brief Copy a portion of the texture to the current rendering target.
  1222  *
  1223  * \param texture The source texture.
  1224  * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
  1225  * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
  1226  *
  1227  * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.
  1228  */
  1229 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
  1230                                            const SDL_Rect * srcrect,
  1231                                            const SDL_Rect * dstrect);
  1232 
  1233 /**
  1234  * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
  1235  *
  1236  * \brief Read pixels from the current rendering target.
  1237  *
  1238  * \param rect A pointer to the rectangle to read, or NULL for the entire render target
  1239  * \param pixels A pointer to be filled in with the pixel data
  1240  * \param pitch The pitch of the pixels parameter
  1241  *
  1242  * \return 0 on success, or -1 if pixel reading is not supported.
  1243  *
  1244  * \warning This is a very slow operation, and should not be used frequently.
  1245  */
  1246 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
  1247                                                  void *pixels, int pitch);
  1248 
  1249 /**
  1250  * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
  1251  *
  1252  * \brief Write pixels to the current rendering target.
  1253  *
  1254  * \param rect A pointer to the rectangle to write, or NULL for the entire render target
  1255  * \param pixels A pointer to the pixel data to write
  1256  * \param pitch The pitch of the pixels parameter
  1257  *
  1258  * \return 0 on success, or -1 if pixel writing is not supported.
  1259  *
  1260  * \warning This is a very slow operation, and should not be used frequently.
  1261  */
  1262 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
  1263                                                   const void *pixels,
  1264                                                   int pitch);
  1265 
  1266 /**
  1267  * \fn void SDL_RenderPresent(void)
  1268  *
  1269  * \brief Update the screen with rendering performed.
  1270  */
  1271 extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
  1272 
  1273 /**
  1274  * \fn void SDL_DestroyTexture(SDL_TextureID textureID);
  1275  *
  1276  * \brief Destroy the specified texture.
  1277  *
  1278  * \sa SDL_CreateTexture()
  1279  * \sa SDL_CreateTextureFromSurface()
  1280  */
  1281 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
  1282 
  1283 /**
  1284  * \fn void SDL_DestroyRenderer(SDL_WindowID windowID);
  1285  *
  1286  * \brief Destroy the rendering context for a window and free associated
  1287  *        textures.
  1288  *
  1289  * \sa SDL_CreateRenderer()
  1290  */
  1291 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
  1292 
  1293 /*
  1294  * Maps an RGB triple to an opaque pixel value for a given pixel format
  1295  */
  1296 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat *
  1297                                           const format, const Uint8 r,
  1298                                           const Uint8 g, const Uint8 b);
  1299 
  1300 /*
  1301  * Maps an RGBA quadruple to a pixel value for a given pixel format
  1302  */
  1303 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * const fmt,
  1304                                            const Uint8 r, const Uint8 g,
  1305                                            const Uint8 b, const Uint8 a);
  1306 
  1307 /*
  1308  * Maps a pixel value into the RGB components for a given pixel format
  1309  */
  1310 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
  1311                                         Uint8 * r, Uint8 * g, Uint8 * b);
  1312 
  1313 /*
  1314  * Maps a pixel value into the RGBA components for a given pixel format
  1315  */
  1316 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
  1317                                          Uint8 * r, Uint8 * g, Uint8 * b,
  1318                                          Uint8 * a);
  1319 
  1320 /*
  1321  * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
  1322  * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  1323  * If the depth is greater than 8 bits, the pixel format is set using the
  1324  * flags '[RGB]mask'.
  1325  * If the function runs out of memory, it will return NULL.
  1326  *
  1327  * The 'flags' tell what kind of surface to create.
  1328  * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
  1329  * SDL_SRCALPHA means that the surface will be used for alpha blits.
  1330  */
  1331 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
  1332     (Uint32 flags, int width, int height, int depth,
  1333      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
  1334 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
  1335                                                               int width,
  1336                                                               int height,
  1337                                                               int depth,
  1338                                                               int pitch,
  1339                                                               Uint32 Rmask,
  1340                                                               Uint32 Gmask,
  1341                                                               Uint32 Bmask,
  1342                                                               Uint32 Amask);
  1343 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
  1344 
  1345 /**
  1346  * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
  1347  *
  1348  * \brief Set the palette used by a surface.
  1349  *
  1350  * \return 0, or -1 if the surface format doesn't use a palette.
  1351  *
  1352  * \note A single palette can be shared with many surfaces.
  1353  */
  1354 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
  1355                                                   SDL_Palette * palette);
  1356 
  1357 /*
  1358  * SDL_LockSurface() sets up a surface for directly accessing the pixels.
  1359  * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
  1360  * to and read from 'surface->pixels', using the pixel format stored in 
  1361  * 'surface->format'.  Once you are done accessing the surface, you should 
  1362  * use SDL_UnlockSurface() to release it.
  1363  *
  1364  * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
  1365  * to 0, then you can read and write to the surface at any time, and the
  1366  * pixel format of the surface will not change.
  1367  * 
  1368  * No operating system or library calls should be made between lock/unlock
  1369  * pairs, as critical system locks may be held during this time.
  1370  *
  1371  * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
  1372  */
  1373 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
  1374 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
  1375 
  1376 /*
  1377  * Load a surface from a seekable SDL data source (memory or file.)
  1378  * If 'freesrc' is non-zero, the source will be closed after being read.
  1379  * Returns the new surface, or NULL if there was an error.
  1380  * The new surface should be freed with SDL_FreeSurface().
  1381  */
  1382 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
  1383                                                     int freesrc);
  1384 
  1385 /* Convenience macro -- load a surface from a file */
  1386 #define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
  1387 
  1388 /*
  1389  * Save a surface to a seekable SDL data source (memory or file.)
  1390  * If 'freedst' is non-zero, the source will be closed after being written.
  1391  * Returns 0 if successful or -1 if there was an error.
  1392  */
  1393 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
  1394     (SDL_Surface * surface, SDL_RWops * dst, int freedst);
  1395 
  1396 /* Convenience macro -- save a surface to a file */
  1397 #define SDL_SaveBMP(surface, file) \
  1398 		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
  1399 
  1400 /*
  1401  * \fn int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
  1402  *
  1403  * \brief Sets the RLE acceleration hint for a surface.
  1404  *
  1405  * \return 0 on success, or -1 if the surface is not valid
  1406  *
  1407  * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
  1408  *       but the surface must be locked before directly accessing the pixels.
  1409  */
  1410 extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
  1411                                               int flag);
  1412 
  1413 /*
  1414  * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
  1415  *
  1416  * \brief Sets the color key (transparent pixel) in a blittable surface.
  1417  *
  1418  * \param surface The surface to update
  1419  * \param flag Non-zero to enable colorkey and 0 to disable colorkey 
  1420  * \param key The transparent pixel in the native surface format
  1421  *
  1422  * \return 0 on success, or -1 if the surface is not valid
  1423  */
  1424 extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
  1425                                             Uint32 flag, Uint32 key);
  1426 
  1427 /**
  1428  * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
  1429  *
  1430  * \brief Set an additional color value used in blit operations
  1431  *
  1432  * \param surface The surface to update
  1433  * \param r The red source color value multiplied into blit operations
  1434  * \param g The green source color value multiplied into blit operations
  1435  * \param b The blue source color value multiplied into blit operations
  1436  *
  1437  * \return 0 on success, or -1 if the surface is not valid
  1438  *
  1439  * \sa SDL_GetSurfaceColorMod()
  1440  */
  1441 extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
  1442                                                    Uint8 r, Uint8 g, Uint8 b);
  1443 
  1444 
  1445 /**
  1446  * \fn int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
  1447  *
  1448  * \brief Get the additional color value used in blit operations
  1449  *
  1450  * \param surface The surface to query
  1451  * \param r A pointer filled in with the source red color value
  1452  * \param g A pointer filled in with the source green color value
  1453  * \param b A pointer filled in with the source blue color value
  1454  *
  1455  * \return 0 on success, or -1 if the surface is not valid
  1456  *
  1457  * \sa SDL_SetSurfaceColorMod()
  1458  */
  1459 extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
  1460                                                    Uint8 * r, Uint8 * g,
  1461                                                    Uint8 * b);
  1462 
  1463 /**
  1464  * \fn int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
  1465  *
  1466  * \brief Set an additional alpha value used in blit operations
  1467  *
  1468  * \param surface The surface to update
  1469  * \param alpha The source alpha value multiplied into blit operations.
  1470  *
  1471  * \return 0 on success, or -1 if the surface is not valid
  1472  *
  1473  * \sa SDL_GetSurfaceAlphaMod()
  1474  */
  1475 extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
  1476                                                    Uint8 alpha);
  1477 
  1478 /**
  1479  * \fn int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
  1480  *
  1481  * \brief Get the additional alpha value used in blit operations
  1482  *
  1483  * \param surface The surface to query
  1484  * \param alpha A pointer filled in with the source alpha value
  1485  *
  1486  * \return 0 on success, or -1 if the surface is not valid
  1487  *
  1488  * \sa SDL_SetSurfaceAlphaMod()
  1489  */
  1490 extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
  1491                                                    Uint8 * alpha);
  1492 
  1493 /**
  1494  * \fn int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
  1495  *
  1496  * \brief Set the blend mode used for blit operations
  1497  *
  1498  * \param surface The surface to update
  1499  * \param blendMode SDL_TextureBlendMode to use for blit blending
  1500  *
  1501  * \return 0 on success, or -1 if the parameters are not valid
  1502  *
  1503  * \sa SDL_GetSurfaceBlendMode()
  1504  */
  1505 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
  1506                                                     int blendMode);
  1507 
  1508 /**
  1509  * \fn int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
  1510  *
  1511  * \brief Get the blend mode used for blit operations
  1512  *
  1513  * \param surface The surface to query
  1514  * \param blendMode A pointer filled in with the current blend mode
  1515  *
  1516  * \return 0 on success, or -1 if the surface is not valid
  1517  *
  1518  * \sa SDL_SetSurfaceBlendMode()
  1519  */
  1520 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
  1521                                                     int *blendMode);
  1522 
  1523 /**
  1524  * \fn int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
  1525  *
  1526  * \brief Set the scale mode used for blit operations
  1527  *
  1528  * \param surface The surface to update
  1529  * \param scaleMode SDL_TextureScaleMode to use for blit scaling
  1530  *
  1531  * \return 0 on success, or -1 if the surface is not valid or the scale mode is not supported
  1532  *
  1533  * \note If the scale mode is not supported, the closest supported mode is chosen.  Currently only SDL_TEXTURESCALEMODE_FAST is supported on surfaces.
  1534  *
  1535  * \sa SDL_GetSurfaceScaleMode()
  1536  */
  1537 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
  1538                                                     int scaleMode);
  1539 
  1540 /**
  1541  * \fn int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
  1542  *
  1543  * \brief Get the scale mode used for blit operations
  1544  *
  1545  * \param surface The surface to query
  1546  * \param scaleMode A pointer filled in with the current scale mode
  1547  *
  1548  * \return 0 on success, or -1 if the surface is not valid
  1549  *
  1550  * \sa SDL_SetSurfaceScaleMode()
  1551  */
  1552 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
  1553                                                     int *scaleMode);
  1554 
  1555 /*
  1556  * Sets the clipping rectangle for the destination surface in a blit.
  1557  *
  1558  * If the clip rectangle is NULL, clipping will be disabled.
  1559  * If the clip rectangle doesn't intersect the surface, the function will
  1560  * return SDL_FALSE and blits will be completely clipped.  Otherwise the
  1561  * function returns SDL_TRUE and blits to the surface will be clipped to
  1562  * the intersection of the surface area and the clipping rectangle.
  1563  *
  1564  * Note that blits are automatically clipped to the edges of the source
  1565  * and destination surfaces.
  1566  */
  1567 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
  1568                                                  const SDL_Rect * rect);
  1569 
  1570 /*
  1571  * Gets the clipping rectangle for the destination surface in a blit.
  1572  * 'rect' must be a pointer to a valid rectangle which will be filled
  1573  * with the correct values.
  1574  */
  1575 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
  1576                                              SDL_Rect * rect);
  1577 
  1578 /*
  1579  * Creates a new surface of the specified format, and then copies and maps 
  1580  * the given surface to it so the blit of the converted surface will be as 
  1581  * fast as possible.  If this function fails, it returns NULL.
  1582  *
  1583  * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
  1584  * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
  1585  * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  1586  * surface.
  1587  *
  1588  * This function is used internally by SDL_DisplayFormat().
  1589  */
  1590 extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
  1591     (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
  1592 
  1593 /*
  1594  * This function performs a fast fill of the given rectangle with 'color'
  1595  * The given rectangle is clipped to the destination surface clip area
  1596  * and the final fill rectangle is saved in the passed in pointer.
  1597  * If 'dstrect' is NULL, the whole surface will be filled with 'color'
  1598  * The color should be a pixel of the format used by the surface, and 
  1599  * can be generated by the SDL_MapRGB() function.
  1600  * This function returns 0 on success, or -1 on error.
  1601  */
  1602 extern DECLSPEC int SDLCALL SDL_FillRect
  1603     (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
  1604 
  1605 /*
  1606  * This performs a fast blit from the source surface to the destination
  1607  * surface.  It assumes that the source and destination rectangles are
  1608  * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
  1609  * surface (src or dst) is copied.  The final blit rectangles are saved
  1610  * in 'srcrect' and 'dstrect' after all clipping is performed.
  1611  * If the blit is successful, it returns 0, otherwise it returns -1.
  1612  *
  1613  * The blit function should not be called on a locked surface.
  1614  *
  1615  * The blit semantics for surfaces with and without alpha and colorkey
  1616  * are defined as follows:
  1617  *
  1618  * RGBA->RGB:
  1619  *     SDL_SRCALPHA set:
  1620  * 	alpha-blend (using alpha-channel).
  1621  * 	SDL_SRCCOLORKEY ignored.
  1622  *     SDL_SRCALPHA not set:
  1623  * 	copy RGB.
  1624  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1625  * 	RGB values of the source colour key, ignoring alpha in the
  1626  * 	comparison.
  1627  * 
  1628  * RGB->RGBA:
  1629  *     SDL_SRCALPHA set:
  1630  * 	alpha-blend (using the source per-surface alpha value);
  1631  * 	set destination alpha to opaque.
  1632  *     SDL_SRCALPHA not set:
  1633  * 	copy RGB, set destination alpha to source per-surface alpha value.
  1634  *     both:
  1635  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1636  * 	source colour key.
  1637  * 
  1638  * RGBA->RGBA:
  1639  *     SDL_SRCALPHA set:
  1640  * 	alpha-blend (using the source alpha channel) the RGB values;
  1641  * 	leave destination alpha untouched. [Note: is this correct?]
  1642  * 	SDL_SRCCOLORKEY ignored.
  1643  *     SDL_SRCALPHA not set:
  1644  * 	copy all of RGBA to the destination.
  1645  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1646  * 	RGB values of the source colour key, ignoring alpha in the
  1647  * 	comparison.
  1648  * 
  1649  * RGB->RGB: 
  1650  *     SDL_SRCALPHA set:
  1651  * 	alpha-blend (using the source per-surface alpha value).
  1652  *     SDL_SRCALPHA not set:
  1653  * 	copy RGB.
  1654  *     both:
  1655  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1656  * 	source colour key.
  1657  *
  1658  * If either of the surfaces were in video memory, and the blit returns -2,
  1659  * the video memory was lost, so it should be reloaded with artwork and 
  1660  * re-blitted:
  1661 	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
  1662 		while ( SDL_LockSurface(image) < 0 )
  1663 			Sleep(10);
  1664 		-- Write image pixels to image->pixels --
  1665 		SDL_UnlockSurface(image);
  1666 	}
  1667  * This happens under DirectX 5.0 when the system switches away from your
  1668  * fullscreen application.  The lock will also fail until you have access
  1669  * to the video memory again.
  1670  */
  1671 /* You should call SDL_BlitSurface() unless you know exactly how SDL
  1672    blitting works internally and how to use the other blit functions.
  1673 */
  1674 #define SDL_BlitSurface SDL_UpperBlit
  1675 
  1676 /* This is the public blit function, SDL_BlitSurface(), and it performs
  1677    rectangle validation and clipping before passing it to SDL_LowerBlit()
  1678 */
  1679 extern DECLSPEC int SDLCALL SDL_UpperBlit
  1680     (SDL_Surface * src, SDL_Rect * srcrect,
  1681      SDL_Surface * dst, SDL_Rect * dstrect);
  1682 /* This is a semi-private blit function and it performs low-level surface
  1683    blitting only.
  1684 */
  1685 extern DECLSPEC int SDLCALL SDL_LowerBlit
  1686     (SDL_Surface * src, SDL_Rect * srcrect,
  1687      SDL_Surface * dst, SDL_Rect * dstrect);
  1688 
  1689 /**
  1690  * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
  1691  *
  1692  * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
  1693  *
  1694  * \note This function uses a static buffer, and is not thread-safe.
  1695  */
  1696 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
  1697                                             SDL_Rect * srcrect,
  1698                                             SDL_Surface * dst,
  1699                                             SDL_Rect * dstrect);
  1700 
  1701 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1702 /* OpenGL support functions.                                                 */
  1703 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1704 
  1705 /**
  1706  * \fn int SDL_GL_LoadLibrary(const char *path)
  1707  *
  1708  * \brief Dynamically load an OpenGL library.
  1709  *
  1710  * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
  1711  *
  1712  * \return 0 on success, or -1 if the library couldn't be loaded
  1713  *
  1714  * This should be done after initializing the video driver, but before
  1715  * creating any OpenGL windows.  If no OpenGL library is loaded, the default
  1716  * library will be loaded upon creation of the first OpenGL window.
  1717  *
  1718  * \note If you do this, you need to retrieve all of the GL functions used in
  1719  *       your program from the dynamic library using SDL_GL_GetProcAddress().
  1720  *
  1721  * \sa SDL_GL_GetProcAddress()
  1722  */
  1723 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
  1724 
  1725 /**
  1726  * \fn void *SDL_GL_GetProcAddress(const char *proc)
  1727  *
  1728  * \brief Get the address of an OpenGL function.
  1729  */
  1730 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
  1731 
  1732 /**
  1733  * \fn SDL_bool SDL_GL_ExtensionSupported(const char *extension)
  1734  *
  1735  * \brief Return true if an OpenGL extension is supported for the current context.
  1736  */
  1737 extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
  1738                                                            *extension);
  1739 
  1740 /**
  1741  * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
  1742  *
  1743  * \brief Set an OpenGL window attribute before window creation.
  1744  */
  1745 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
  1746 
  1747 /**
  1748  * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
  1749  *
  1750  * \brief Get the actual value for an attribute from the current context.
  1751  */
  1752 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
  1753 
  1754 /**
  1755  * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID)
  1756  *
  1757  * \brief Create an OpenGL context for use with an OpenGL window, and make it current.
  1758  *
  1759  * \sa SDL_GL_DeleteContext()
  1760  */
  1761 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
  1762                                                            windowID);
  1763 
  1764 /**
  1765  * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
  1766  *
  1767  * \brief Set up an OpenGL context for rendering into an OpenGL window.
  1768  *
  1769  * \note The context must have been created with a compatible window.
  1770  */
  1771 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
  1772                                                SDL_GLContext context);
  1773 
  1774 /**
  1775  * \fn int SDL_GL_SetSwapInterval(int interval)
  1776  *
  1777  * \brief Set the swap interval for the current OpenGL context.
  1778  *
  1779  * \param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace
  1780  *
  1781  * \return 0 on success, or -1 if setting the swap interval is not supported.
  1782  *
  1783  * \sa SDL_GL_GetSwapInterval()
  1784  */
  1785 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
  1786 
  1787 /**
  1788  * \fn int SDL_GL_GetSwapInterval(void)
  1789  *
  1790  * \brief Get the swap interval for the current OpenGL context.
  1791  *
  1792  * \return 0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if getting the swap interval is not supported.
  1793  *
  1794  * \sa SDL_GL_SetSwapInterval()
  1795  */
  1796 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
  1797 
  1798 /**
  1799  * \fn void SDL_GL_SwapWindow(SDL_WindowID windowID)
  1800  *
  1801  * \brief Swap the OpenGL buffers for the window, if double-buffering is supported.
  1802  */
  1803 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID);
  1804 
  1805 /**
  1806  * \fn void SDL_GL_DeleteContext(SDL_GLContext context)
  1807  *
  1808  * \brief Delete an OpenGL context.
  1809  *
  1810  * \sa SDL_GL_CreateContext()
  1811  */
  1812 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
  1813 
  1814 /**
  1815  * \def SDL_RectEmpty()
  1816  *
  1817  * \brief Returns true if the rectangle has no area.
  1818  */
  1819 #define SDL_RectEmpty(X)    (((X)->w <= 0) || ((X)->h <= 0))
  1820 
  1821 /**
  1822  * \def SDL_RectEquals()
  1823  *
  1824  * \brief Returns true if the two rectangles are equal.
  1825  */
  1826 #define SDL_RectEquals(A, B)   (((A)->x == (B)->x) && ((A)->y == (B)->y) && \
  1827                                 ((A)->w == (B)->w) && ((A)->h == (B)->h))
  1828 
  1829 /**
  1830  * \fn SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B);
  1831  *
  1832  * \brief Determine whether two rectangles intersect.
  1833  *
  1834  * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  1835  */
  1836 extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
  1837                                                      const SDL_Rect * B);
  1838 
  1839 /**
  1840  * \fn SDL_bool SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
  1841  *
  1842  * \brief Calculate the intersection of two rectangles.
  1843  *
  1844  * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
  1845  */
  1846 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
  1847                                                    const SDL_Rect * B,
  1848                                                    SDL_Rect * result);
  1849 
  1850 /**
  1851  * \fn void SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result)
  1852  *
  1853  * \brief Calculate the union of two rectangles
  1854  */
  1855 extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
  1856                                            const SDL_Rect * B,
  1857                                            SDL_Rect * result);
  1858 
  1859 /* Ends C function definitions when using C++ */
  1860 #ifdef __cplusplus
  1861 /* *INDENT-OFF* */
  1862 }
  1863 /* *INDENT-ON* */
  1864 #endif
  1865 #include "close_code.h"
  1866 
  1867 #endif /* _SDL_video_h */
  1868 
  1869 /* vi: set ts=4 sw=4 expandtab: */