include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Tue, 24 Mar 2009 10:43:53 +0000
changeset 3100 7dc982143c06
parent 3091 32efcc94b3da
child 3130 fef1a835af43
child 3139 7f684f249ec9
permissions -rw-r--r--
Date: Sun, 22 Mar 2009 12:52:29 +0000
From: Luke Benstead
Subject: OpenGL 3.0 Context Creation

I've attached a patch which implements OpenGL 3.x context creation on
the latest SVN. I've added two options to SDL_GL_SetAttribute, these
are SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.
These default to 2 and 1 respectively. If the major version is less
than 3 then the current context creation method is used, otherwise the
appropriate new context creation function is called (depending on the
platform).

Sample code:

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //Without these 2 lines, SDL will create a GL 2.x context
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_Surface* screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL | SDL_FULLSCREEN );


I've implemented context creation on both Win32 and X and run basic
tests on both. This patch doesn't provide access to all the options
allowed by the new context creation (e.g. shared contexts, forward
compatible contexts) but they can be added pretty easily.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2009 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 SDL video functions.
    27  */
    28 
    29 #ifndef _SDL_video_h
    30 #define _SDL_video_h
    31 
    32 #include "SDL_stdinc.h"
    33 #include "SDL_pixels.h"
    34 #include "SDL_rect.h"
    35 #include "SDL_surface.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 /**
    46  * \struct SDL_DisplayMode
    47  *
    48  * \brief  The structure that defines a display mode
    49  *
    50  * \sa SDL_GetNumDisplayModes()
    51  * \sa SDL_GetDisplayMode()
    52  * \sa SDL_GetDesktopDisplayMode()
    53  * \sa SDL_GetCurrentDisplayMode()
    54  * \sa SDL_GetClosestDisplayMode()
    55  * \sa SDL_SetDisplayMode()
    56  */
    57 typedef struct
    58 {
    59     Uint32 format;              /**< pixel format */
    60     int w;                      /**< width */
    61     int h;                      /**< height */
    62     int refresh_rate;           /**< refresh rate (or zero for unspecified) */
    63     void *driverdata;           /**< driver-specific data, initialize to 0 */
    64 } SDL_DisplayMode;
    65 
    66 /**
    67  * \typedef SDL_WindowID
    68  *
    69  * \brief The type used to identify a window
    70  *
    71  * \sa SDL_CreateWindow()
    72  * \sa SDL_CreateWindowFrom()
    73  * \sa SDL_DestroyWindow()
    74  * \sa SDL_GetWindowData()
    75  * \sa SDL_GetWindowFlags()
    76  * \sa SDL_GetWindowGrab()
    77  * \sa SDL_GetWindowPosition()
    78  * \sa SDL_GetWindowSize()
    79  * \sa SDL_GetWindowTitle()
    80  * \sa SDL_HideWindow()
    81  * \sa SDL_MaximizeWindow()
    82  * \sa SDL_MinimizeWindow()
    83  * \sa SDL_RaiseWindow()
    84  * \sa SDL_RestoreWindow()
    85  * \sa SDL_SetWindowData()
    86  * \sa SDL_SetWindowFullscreen()
    87  * \sa SDL_SetWindowGrab()
    88  * \sa SDL_SetWindowIcon()
    89  * \sa SDL_SetWindowPosition()
    90  * \sa SDL_SetWindowSize()
    91  * \sa SDL_SetWindowTitle()
    92  * \sa SDL_ShowWindow()
    93  */
    94 typedef Uint32 SDL_WindowID;
    95 
    96 /**
    97  * \enum SDL_WindowFlags
    98  *
    99  * \brief The flags on a window
   100  *
   101  * \sa SDL_GetWindowFlags()
   102  */
   103 typedef enum
   104 {
   105     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
   106     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
   107     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
   108     SDL_WINDOW_BORDERLESS = 0x00000008,         /**< no window decoration */
   109     SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
   110     SDL_WINDOW_MINIMIZED = 0x00000020,          /**< minimized */
   111     SDL_WINDOW_MAXIMIZED = 0x00000040,          /**< maximized */
   112     SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
   113     SDL_WINDOW_INPUT_FOCUS = 0x00000200,        /**< window has input focus */
   114     SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
   115     SDL_WINDOW_FOREIGN = 0x00000800             /**< window not created by SDL */
   116 } SDL_WindowFlags;
   117 
   118 /**
   119  * \def SDL_WINDOWPOS_UNDEFINED
   120  * \brief Used to indicate that you don't care what the window position is.
   121  */
   122 #define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
   123 /**
   124  * \def SDL_WINDOWPOS_CENTERED
   125  * \brief Used to indicate that the window position should be centered.
   126  */
   127 #define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
   128 
   129 /**
   130  * \enum SDL_WindowEventID
   131  *
   132  * \brief Event subtype for window events
   133  */
   134 typedef enum
   135 {
   136     SDL_WINDOWEVENT_NONE,               /**< Never used */
   137     SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
   138     SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
   139     SDL_WINDOWEVENT_EXPOSED,            /**< Window has been exposed and should be redrawn */
   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_WINDOWEVENT_CLOSE               /**< The window manager requests that the window be closed */
   150 } SDL_WindowEventID;
   151 
   152 /**
   153  * \enum SDL_RendererFlags
   154  *
   155  * \brief Flags used when creating a rendering context
   156  */
   157 typedef enum
   158 {
   159     SDL_RENDERER_SINGLEBUFFER = 0x00000001,     /**< Render directly to the window, if possible */
   160     SDL_RENDERER_PRESENTCOPY = 0x00000002,      /**< Present uses a copy from back buffer to the front buffer */
   161     SDL_RENDERER_PRESENTFLIP2 = 0x00000004,     /**< Present uses a flip, swapping back buffer and front buffer */
   162     SDL_RENDERER_PRESENTFLIP3 = 0x00000008,     /**< Present uses a flip, rotating between two back buffers and a front buffer */
   163     SDL_RENDERER_PRESENTDISCARD = 0x00000010,   /**< Present leaves the contents of the backbuffer undefined */
   164     SDL_RENDERER_PRESENTVSYNC = 0x00000020,     /**< Present is synchronized with the refresh rate */
   165     SDL_RENDERER_ACCELERATED = 0x00000040       /**< The renderer uses hardware acceleration */
   166 } SDL_RendererFlags;
   167 
   168 /**
   169  * \struct SDL_RendererInfo
   170  *
   171  * \brief Information on the capabilities of a render driver or context
   172  */
   173 typedef struct SDL_RendererInfo
   174 {
   175     const char *name;           /**< The name of the renderer */
   176     Uint32 flags;               /**< Supported SDL_RendererFlags */
   177     Uint32 mod_modes;           /**< A mask of supported channel modulation */
   178     Uint32 blend_modes;         /**< A mask of supported blend modes */
   179     Uint32 scale_modes;         /**< A mask of supported scale modes */
   180     Uint32 num_texture_formats; /**< The number of available texture formats */
   181     Uint32 texture_formats[20]; /**< The available texture formats */
   182     int max_texture_width;      /**< The maximimum texture width */
   183     int max_texture_height;     /**< The maximimum texture height */
   184 } SDL_RendererInfo;
   185 
   186 /**
   187  * \enum SDL_TextureAccess
   188  *
   189  * \brief The access pattern allowed for a texture
   190  */
   191 typedef enum
   192 {
   193     SDL_TEXTUREACCESS_STATIC,    /**< Changes rarely, not lockable */
   194     SDL_TEXTUREACCESS_STREAMING  /**< Changes frequently, lockable */
   195 } SDL_TextureAccess;
   196 
   197 /**
   198  * \enum SDL_TextureModulate
   199  *
   200  * \brief The texture channel modulation used in SDL_RenderCopy()
   201  */
   202 typedef enum
   203 {
   204     SDL_TEXTUREMODULATE_NONE = 0x00000000,     /**< No modulation */
   205     SDL_TEXTUREMODULATE_COLOR = 0x00000001,    /**< srcC = srcC * color */
   206     SDL_TEXTUREMODULATE_ALPHA = 0x00000002     /**< srcA = srcA * alpha */
   207 } SDL_TextureModulate;
   208 
   209 /**
   210  * \enum SDL_BlendMode
   211  *
   212  * \brief The blend mode used in SDL_RenderCopy() and drawing operations
   213  */
   214 typedef enum
   215 {
   216     SDL_BLENDMODE_NONE = 0x00000000,     /**< No blending */
   217     SDL_BLENDMODE_MASK = 0x00000001,     /**< dst = A ? src : dst (alpha is mask) */
   218     SDL_BLENDMODE_BLEND = 0x00000002,    /**< dst = (src * A) + (dst * (1-A)) */
   219     SDL_BLENDMODE_ADD = 0x00000004,      /**< dst = (src * A) + dst */
   220     SDL_BLENDMODE_MOD = 0x00000008       /**< dst = src * dst */
   221 } SDL_BlendMode;
   222 
   223 /**
   224  * \enum SDL_TextureScaleMode
   225  *
   226  * \brief The texture scale mode used in SDL_RenderCopy()
   227  */
   228 typedef enum
   229 {
   230     SDL_TEXTURESCALEMODE_NONE = 0x00000000,     /**< No scaling, rectangles must match dimensions */
   231     SDL_TEXTURESCALEMODE_FAST = 0x00000001,     /**< Point sampling or equivalent algorithm */
   232     SDL_TEXTURESCALEMODE_SLOW = 0x00000002,     /**< Linear filtering or equivalent algorithm */
   233     SDL_TEXTURESCALEMODE_BEST = 0x00000004      /**< Bicubic filtering or equivalent algorithm */
   234 } SDL_TextureScaleMode;
   235 
   236 /**
   237  * \typedef SDL_TextureID
   238  *
   239  * \brief An efficient driver-specific representation of pixel data
   240  */
   241 typedef Uint32 SDL_TextureID;
   242 
   243 /**
   244  * \typedef SDL_GLContext
   245  *
   246  * \brief An opaque handle to an OpenGL context.
   247  */
   248 typedef void *SDL_GLContext;
   249 
   250 /**
   251  * \enum SDL_GLattr
   252  *
   253  * \brief OpenGL configuration attributes
   254  */
   255 typedef enum
   256 {
   257     SDL_GL_RED_SIZE,
   258     SDL_GL_GREEN_SIZE,
   259     SDL_GL_BLUE_SIZE,
   260     SDL_GL_ALPHA_SIZE,
   261     SDL_GL_BUFFER_SIZE,
   262     SDL_GL_DOUBLEBUFFER,
   263     SDL_GL_DEPTH_SIZE,
   264     SDL_GL_STENCIL_SIZE,
   265     SDL_GL_ACCUM_RED_SIZE,
   266     SDL_GL_ACCUM_GREEN_SIZE,
   267     SDL_GL_ACCUM_BLUE_SIZE,
   268     SDL_GL_ACCUM_ALPHA_SIZE,
   269     SDL_GL_STEREO,
   270     SDL_GL_MULTISAMPLEBUFFERS,
   271     SDL_GL_MULTISAMPLESAMPLES,
   272     SDL_GL_ACCELERATED_VISUAL,
   273     SDL_GL_RETAINED_BACKING,
   274 	SDL_GL_CONTEXT_MAJOR_VERSION,
   275 	SDL_GL_CONTEXT_MINOR_VERSION
   276 } SDL_GLattr;
   277 
   278 
   279 /* Function prototypes */
   280 
   281 /**
   282  * \fn int SDL_GetNumVideoDrivers(void)
   283  *
   284  * \brief Get the number of video drivers compiled into SDL
   285  *
   286  * \sa SDL_GetVideoDriver()
   287  */
   288 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
   289 
   290 /**
   291  * \fn const char *SDL_GetVideoDriver(int index)
   292  *
   293  * \brief Get the name of a built in video driver.
   294  *
   295  * \note The video drivers are presented in the order in which they are
   296  * normally checked during initialization.
   297  *
   298  * \sa SDL_GetNumVideoDrivers()
   299  */
   300 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
   301 
   302 /**
   303  * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
   304  *
   305  * \brief Initialize the video subsystem, optionally specifying a video driver.
   306  *
   307  * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
   308  * \param flags FIXME: Still needed?
   309  *
   310  * \return 0 on success, -1 on error
   311  *
   312  * This function initializes the video subsystem; setting up a connection
   313  * to the window manager, etc, and determines the available display modes
   314  * and pixel formats, but does not initialize a window or graphics mode.
   315  *
   316  * \sa SDL_VideoQuit()
   317  */
   318 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
   319                                           Uint32 flags);
   320 
   321 /**
   322  * \fn void SDL_VideoQuit(void)
   323  *
   324  * \brief Shuts down the video subsystem.
   325  *
   326  * This function closes all windows, and restores the original video mode.
   327  *
   328  * \sa SDL_VideoInit()
   329  */
   330 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
   331 
   332 /**
   333  * \fn const char *SDL_GetCurrentVideoDriver(void)
   334  *
   335  * \brief Returns the name of the currently initialized video driver.
   336  *
   337  * \return The name of the current video driver or NULL if no driver
   338  *         has been initialized
   339  *
   340  * \sa SDL_GetNumVideoDrivers()
   341  * \sa SDL_GetVideoDriver()
   342  */
   343 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
   344 
   345 /**
   346  * \fn int SDL_GetNumVideoDisplays(void)
   347  *
   348  * \brief Returns the number of available video displays.
   349  *
   350  * \sa SDL_SelectVideoDisplay()
   351  */
   352 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
   353 
   354 /**
   355  * \fn int SDL_SelectVideoDisplay(int index)
   356  *
   357  * \brief Set the index of the currently selected display.
   358  *
   359  * \return 0 on success, or -1 if the index is out of range.
   360  *
   361  * \sa SDL_GetNumVideoDisplays()
   362  * \sa SDL_GetCurrentVideoDisplay()
   363  */
   364 extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
   365 
   366 /**
   367  * \fn int SDL_GetCurrentVideoDisplay(void)
   368  *
   369  * \brief Get the index of the currently selected display.
   370  *
   371  * \return The index of the currently selected display.
   372  *
   373  * \sa SDL_GetNumVideoDisplays()
   374  * \sa SDL_SelectVideoDisplay()
   375  */
   376 extern DECLSPEC int SDLCALL SDL_GetCurrentVideoDisplay(void);
   377 
   378 /**
   379  * \fn int SDL_GetNumDisplayModes(void)
   380  *
   381  * \brief Returns the number of available display modes for the current display.
   382  *
   383  * \sa SDL_GetDisplayMode()
   384  */
   385 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
   386 
   387 /**
   388  * \fn int SDL_GetDisplayMode(int index, SDL_DisplayMode *mode)
   389  *
   390  * \brief Fill in information about a specific display mode.
   391  *
   392  * \note The display modes are sorted in this priority:
   393  *       \li bits per pixel -> more colors to fewer colors
   394  *       \li width -> largest to smallest
   395  *       \li height -> largest to smallest
   396  *       \li refresh rate -> highest to lowest
   397  *
   398  * \sa SDL_GetNumDisplayModes()
   399  */
   400 extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int index,
   401                                                SDL_DisplayMode * mode);
   402 
   403 /**
   404  * \fn int SDL_GetDesktopDisplayMode(SDL_DisplayMode *mode)
   405  *
   406  * \brief Fill in information about the desktop display mode for the current display.
   407  */
   408 extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode);
   409 
   410 /**
   411  * \fn int SDL_GetCurrentDisplayMode(SDL_DisplayMode *mode)
   412  *
   413  * \brief Fill in information about the current display mode.
   414  */
   415 extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode);
   416 
   417 /**
   418  * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
   419  *
   420  * \brief Get the closest match to the requested display mode.
   421  *
   422  * \param mode The desired display mode
   423  * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
   424  *
   425  * \return The passed in value 'closest', or NULL if no matching video mode was available.
   426  *
   427  * 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.
   428  *
   429  * \sa SDL_GetNumDisplayModes()
   430  * \sa SDL_GetDisplayMode()
   431  */
   432 extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
   433                                                                    SDL_DisplayMode
   434                                                                    * mode,
   435                                                                    SDL_DisplayMode
   436                                                                    * closest);
   437 
   438 /**
   439  * \fn int SDL_SetFullscreenDisplayMode(const SDL_DisplayMode *mode)
   440  *
   441  * \brief Set the display mode used when a fullscreen window is visible
   442  *        on the currently selected display.
   443  *
   444  * \param mode The mode to use, or NULL for the desktop mode.
   445  *
   446  * \return 0 on success, or -1 if setting the display mode failed.
   447  *
   448  * \sa SDL_SetWindowFullscreen()
   449  */
   450 extern DECLSPEC int SDLCALL SDL_SetFullscreenDisplayMode(const SDL_DisplayMode
   451                                                          * mode);
   452 
   453 /**
   454  * \fn int SDL_GetFullscreenDisplayMode(SDL_DisplayMode *mode)
   455  *
   456  * \brief Fill in information about the display mode used when a fullscreen
   457  *        window is visible on the currently selected display.
   458  */
   459 extern DECLSPEC int SDLCALL SDL_GetFullscreenDisplayMode(SDL_DisplayMode *
   460                                                          mode);
   461 
   462 /**
   463  * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
   464  *
   465  * \brief Set the palette entries for indexed display modes.
   466  *
   467  * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
   468  */
   469 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
   470                                                   int firstcolor,
   471                                                   int ncolors);
   472 
   473 /**
   474  * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
   475  *
   476  * \brief Gets the palette entries for indexed display modes.
   477  *
   478  * \return 0 on success, or -1 if the display mode isn't palettized
   479  */
   480 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
   481                                                   int firstcolor,
   482                                                   int ncolors);
   483 
   484 /**
   485  * \fn int SDL_SetGamma(float red, float green, float blue)
   486  *
   487  * \brief Set the gamma correction for each of the color channels on the currently selected display.
   488  *
   489  * \return 0 on success, or -1 if setting the gamma isn't supported.
   490  *
   491  * \sa SDL_SetGammaRamp()
   492  */
   493 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
   494 
   495 /**
   496  * \fn int SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
   497  *
   498  * \brief Set the gamma ramp for the currently selected display.
   499  *
   500  * \param red The translation table for the red channel, or NULL
   501  * \param green The translation table for the green channel, or NULL
   502  * \param blue The translation table for the blue channel, or NULL
   503  *
   504  * \return 0 on success, or -1 if gamma ramps are unsupported.
   505  *
   506  * Set the gamma translation table for the red, green, and blue channels
   507  * of the video hardware.  Each table is an array of 256 16-bit quantities,
   508  * representing a mapping between the input and output for that channel.
   509  * The input is the index into the array, and the output is the 16-bit
   510  * gamma value at that index, scaled to the output color precision.
   511  * 
   512  * \sa SDL_GetGammaRamp()
   513  */
   514 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
   515                                              const Uint16 * green,
   516                                              const Uint16 * blue);
   517 
   518 /**
   519  * \fn int SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
   520  *
   521  * \brief Get the gamma ramp for the currently selected display.
   522  *
   523  * \param red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL.
   524  * \param green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL.
   525  * \param blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
   526  * 
   527  * \return 0 on success, or -1 if gamma ramps are unsupported.
   528  *
   529  * \sa SDL_SetGammaRamp()
   530  */
   531 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
   532                                              Uint16 * blue);
   533 
   534 
   535 /**
   536  * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
   537  *
   538  * \brief Create a window with the specified position, dimensions, and flags.
   539  *
   540  * \param title The title of the window, in UTF-8 encoding
   541  * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   542  * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   543  * \param w The width of the window
   544  * \param h The height of the window
   545  * \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
   546  *
   547  * \return The id of the window created, or zero if window creation failed.
   548  *
   549  * \sa SDL_DestroyWindow()
   550  */
   551 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
   552                                                       int x, int y, int w,
   553                                                       int h, Uint32 flags);
   554 
   555 /**
   556  * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
   557  *
   558  * \brief Create an SDL window struct from an existing native window.
   559  *
   560  * \param data A pointer to driver-dependent window creation data
   561  *
   562  * \return The id of the window created, or zero if window creation failed.
   563  *
   564  * \warning This function is NOT SUPPORTED, use at your own risk!
   565  *
   566  * \sa SDL_DestroyWindow()
   567  */
   568 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
   569 
   570 /**
   571  * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
   572  *
   573  * \brief Get the window flags.
   574  */
   575 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
   576 
   577 /**
   578  * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
   579  *
   580  * \brief Set the title of the window, in UTF-8 format.
   581  *
   582  * \sa SDL_GetWindowTitle()
   583  */
   584 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
   585                                                 const char *title);
   586 
   587 /**
   588  * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
   589  *
   590  * \brief Get the title of the window, in UTF-8 format.
   591  *
   592  * \sa SDL_SetWindowTitle()
   593  */
   594 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
   595 
   596 /**
   597  * \fn void SDL_SetWindowIcon(SDL_WindowID windowID, SDL_Surface *icon)
   598  *
   599  * \brief Set the icon of the window.
   600  *
   601  * \param icon The icon for the window
   602  */
   603 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_WindowID windowID,
   604                                                SDL_Surface * icon);
   605 
   606 /**
   607  * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
   608  *
   609  * \brief Associate an arbitrary pointer with the window.
   610  *
   611  * \sa SDL_GetWindowData()
   612  */
   613 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
   614                                                void *userdata);
   615 
   616 /**
   617  * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
   618  *
   619  * \brief Retrieve the data pointer associated with the window.
   620  *
   621  * \sa SDL_SetWindowData()
   622  */
   623 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
   624 
   625 /**
   626  * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
   627  *
   628  * \brief Set the position of the window.
   629  *
   630  * \param windowID The window to reposition
   631  * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   632  * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   633  *
   634  * \note The window coordinate origin is the upper left of the display.
   635  *
   636  * \sa SDL_GetWindowPosition()
   637  */
   638 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
   639                                                    int x, int y);
   640 
   641 /**
   642  * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
   643  *
   644  * \brief Get the position of the window.
   645  *
   646  * \sa SDL_SetWindowPosition()
   647  */
   648 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
   649                                                    int *x, int *y);
   650 
   651 /**
   652  * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
   653  *
   654  * \brief Set the size of the window's client area.
   655  *
   656  * \note You can't change the size of a fullscreen window, it automatically
   657  * matches the size of the display mode.
   658  *
   659  * \sa SDL_GetWindowSize()
   660  */
   661 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
   662                                                int h);
   663 
   664 /**
   665  * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h)
   666  *
   667  * \brief Get the size of the window's client area.
   668  *
   669  * \sa SDL_SetWindowSize()
   670  */
   671 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
   672                                                int *h);
   673 
   674 /**
   675  * \fn void SDL_ShowWindow(SDL_WindowID windowID)
   676  *
   677  * \brief Show the window
   678  *
   679  * \sa SDL_HideWindow()
   680  */
   681 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
   682 
   683 /**
   684  * \fn void SDL_HideWindow(SDL_WindowID windowID)
   685  *
   686  * \brief Hide the window
   687  *
   688  * \sa SDL_ShowWindow()
   689  */
   690 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
   691 
   692 /**
   693  * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
   694  *
   695  * \brief Raise the window above other windows and set the input focus.
   696  */
   697 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
   698 
   699 /**
   700  * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
   701  *
   702  * \brief Make the window as large as possible.
   703  *
   704  * \sa SDL_RestoreWindow()
   705  */
   706 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
   707 
   708 /**
   709  * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
   710  *
   711  * \brief Minimize the window to an iconic representation.
   712  *
   713  * \sa SDL_RestoreWindow()
   714  */
   715 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
   716 
   717 /**
   718  * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
   719  *
   720  * \brief Restore the size and position of a minimized or maximized window.
   721  *
   722  * \sa SDL_MaximizeWindow()
   723  * \sa SDL_MinimizeWindow()
   724  */
   725 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
   726 
   727 /**
   728  * \fn int SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
   729  *
   730  * \brief Set the window's fullscreen state.
   731  *
   732  * \return 0 on success, or -1 if setting the display mode failed.
   733  *
   734  * \sa SDL_SetFullscreenDisplayMode()
   735  */
   736 extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_WindowID windowID,
   737                                                     int fullscreen);
   738 
   739 /**
   740  * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
   741  *
   742  * \brief Set the window's input grab mode.
   743  *
   744  * \param mode This is 1 to grab input, and 0 to release input.
   745  *
   746  * \sa SDL_GetWindowGrab()
   747  */
   748 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
   749                                                int mode);
   750 
   751 /**
   752  * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
   753  *
   754  * \brief Get the window's input grab mode.
   755  *
   756  * \return This returns 1 if input is grabbed, and 0 otherwise.
   757  *
   758  * \sa SDL_SetWindowGrab()
   759  */
   760 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
   761 
   762 /**
   763  * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
   764  *
   765  * \brief Get driver specific information about a window.
   766  *
   767  * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
   768  */
   769 struct SDL_SysWMinfo;
   770 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   771                                                      struct SDL_SysWMinfo
   772                                                      *info);
   773 
   774 /**
   775  * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
   776  *
   777  * \brief Destroy a window.
   778  */
   779 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
   780 
   781 /**
   782  * \fn int SDL_GetNumRenderDrivers(void)
   783  *
   784  * \brief Get the number of 2D rendering drivers available for the current display.
   785  *
   786  * A render driver is a set of code that handles rendering and texture
   787  * management on a particular display.  Normally there is only one, but
   788  * some drivers may have several available with different capabilities.
   789  *
   790  * \sa SDL_GetRenderDriverInfo()
   791  * \sa SDL_CreateRenderer()
   792  */
   793 extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
   794 
   795 /**
   796  * \fn int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
   797  *
   798  * \brief Get information about a specific 2D rendering driver for the current display.
   799  *
   800  * \param index The index of the driver to query information about.
   801  * \param info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
   802  *
   803  * \return 0 on success, -1 if the index was out of range
   804  *
   805  * \sa SDL_CreateRenderer()
   806  */
   807 extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index,
   808                                                     SDL_RendererInfo * info);
   809 
   810 /**
   811  * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags)
   812  *
   813  * \brief Create and make active a 2D rendering context for a window.
   814  *
   815  * \param windowID The window used for rendering
   816  * \param index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
   817  * \param flags SDL_RendererFlags
   818  *
   819  * \return 0 on success, -1 if there was an error creating the renderer.
   820  *
   821  * \sa SDL_SelectRenderer()
   822  * \sa SDL_GetRendererInfo()
   823  * \sa SDL_DestroyRenderer()
   824  */
   825 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
   826                                                int index, Uint32 flags);
   827 
   828 /**
   829  * \fn int SDL_SelectRenderer(SDL_WindowID windowID)
   830  *
   831  * \brief Select the rendering context for a particular window.
   832  *
   833  * \return 0 on success, -1 if the selected window doesn't have a
   834  *         rendering context.
   835  */
   836 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
   837 
   838 /**
   839  * \fn int SDL_GetRendererInfo(SDL_RendererInfo *info)
   840  *
   841  * \brief Get information about the current rendering context.
   842  */
   843 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
   844 
   845 /**
   846  * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h)
   847  *
   848  * \brief Create a texture for the current rendering context.
   849  *
   850  * \param format The format of the texture
   851  * \param access One of the enumerated values in SDL_TextureAccess
   852  * \param w The width of the texture in pixels
   853  * \param h The height of the texture in pixels
   854  *
   855  * \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.
   856  *
   857  * \sa SDL_QueryTexture()
   858  * \sa SDL_DestroyTexture()
   859  */
   860 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
   861                                                         int access, int w,
   862                                                         int h);
   863 
   864 /**
   865  * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface *surface)
   866  *
   867  * \brief Create a texture from an existing surface.
   868  *
   869  * \param format The format of the texture, or 0 to pick an appropriate format
   870  * \param surface The surface containing pixel data used to fill the texture
   871  *
   872  * \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.
   873  *
   874  * \note The surface is not modified or freed by this function.
   875  *
   876  * \sa SDL_QueryTexture()
   877  * \sa SDL_DestroyTexture()
   878  */
   879 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
   880                                                                    format,
   881                                                                    SDL_Surface
   882                                                                    * surface);
   883 
   884 /**
   885  * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
   886  *
   887  * \brief Query the attributes of a texture
   888  *
   889  * \param texture A texture to be queried
   890  * \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.
   891  * \param access A pointer filled in with the actual access to the texture.
   892  * \param w A pointer filled in with the width of the texture in pixels
   893  * \param h A pointer filled in with the height of the texture in pixels
   894  *
   895  * \return 0 on success, or -1 if the texture is not valid
   896  */
   897 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
   898                                              Uint32 * format, int *access,
   899                                              int *w, int *h);
   900 
   901 /**
   902  * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch)
   903  *
   904  * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access.
   905  *
   906  * \param texture A texture to be queried, which was created with SDL_TEXTUREACCESS_STREAMING
   907  * \param pixels A pointer filled with a pointer to the pixels for the texture 
   908  * \param pitch A pointer filled in with the pitch of the pixel data
   909  *
   910  * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access.
   911  */
   912 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
   913                                                    void **pixels, int *pitch);
   914 
   915 /**
   916  * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
   917  *
   918  * \brief Update an indexed texture with a color palette
   919  *
   920  * \param texture The texture to update
   921  * \param colors The array of RGB color data
   922  * \param firstcolor The first index to update
   923  * \param ncolors The number of palette entries to fill with the color data
   924  *
   925  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   926  */
   927 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
   928                                                   const SDL_Color * colors,
   929                                                   int firstcolor,
   930                                                   int ncolors);
   931 
   932 /**
   933  * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
   934  *
   935  * \brief Update an indexed texture with a color palette
   936  *
   937  * \param texture The texture to update
   938  * \param colors The array to fill with RGB color data
   939  * \param firstcolor The first index to retrieve
   940  * \param ncolors The number of palette entries to retrieve
   941  *
   942  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   943  */
   944 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
   945                                                   SDL_Color * colors,
   946                                                   int firstcolor,
   947                                                   int ncolors);
   948 
   949 /**
   950  * \fn int SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
   951  *
   952  * \brief Set an additional color value used in render copy operations
   953  *
   954  * \param texture The texture to update
   955  * \param r The red source color value multiplied into copy operations
   956  * \param g The green source color value multiplied into copy operations
   957  * \param b The blue source color value multiplied into copy operations
   958  *
   959  * \return 0 on success, or -1 if the texture is not valid or color modulation is not supported
   960  *
   961  * \sa SDL_GetTextureColorMod()
   962  */
   963 extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_TextureID textureID,
   964                                                    Uint8 r, Uint8 g, Uint8 b);
   965 
   966 
   967 /**
   968  * \fn int SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 *r, Uint8 *g, Uint8 *b)
   969  *
   970  * \brief Get the additional color value used in render copy operations
   971  *
   972  * \param texture The texture to query
   973  * \param r A pointer filled in with the source red color value
   974  * \param g A pointer filled in with the source green color value
   975  * \param b A pointer filled in with the source blue color value
   976  *
   977  * \return 0 on success, or -1 if the texture is not valid
   978  *
   979  * \sa SDL_SetTextureColorMod()
   980  */
   981 extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_TextureID textureID,
   982                                                    Uint8 * r, Uint8 * g,
   983                                                    Uint8 * b);
   984 
   985 /**
   986  * \fn int SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
   987  *
   988  * \brief Set an additional alpha value used in render copy operations
   989  *
   990  * \param texture The texture to update
   991  * \param alpha The source alpha value multiplied into copy operations.
   992  *
   993  * \return 0 on success, or -1 if the texture is not valid or alpha modulation is not supported
   994  *
   995  * \sa SDL_GetTextureAlphaMod()
   996  */
   997 extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_TextureID textureID,
   998                                                    Uint8 alpha);
   999 
  1000 /**
  1001  * \fn int SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 *alpha)
  1002  *
  1003  * \brief Get the additional alpha value used in render copy operations
  1004  *
  1005  * \param texture The texture to query
  1006  * \param alpha A pointer filled in with the source alpha value
  1007  *
  1008  * \return 0 on success, or -1 if the texture is not valid
  1009  *
  1010  * \sa SDL_SetTextureAlphaMod()
  1011  */
  1012 extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_TextureID textureID,
  1013                                                    Uint8 * alpha);
  1014 
  1015 /**
  1016  * \fn int SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
  1017  *
  1018  * \brief Set the blend mode used for texture copy operations
  1019  *
  1020  * \param texture The texture to update
  1021  * \param blendMode SDL_TextureBlendMode to use for texture blending
  1022  *
  1023  * \return 0 on success, or -1 if the texture is not valid or the blend mode is not supported
  1024  *
  1025  * \note If the blend mode is not supported, the closest supported mode is chosen.
  1026  *
  1027  * \sa SDL_GetTextureBlendMode()
  1028  */
  1029 extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_TextureID textureID,
  1030                                                     int blendMode);
  1031 
  1032 /**
  1033  * \fn int SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
  1034  *
  1035  * \brief Get the blend mode used for texture copy operations
  1036  *
  1037  * \param texture The texture to query
  1038  * \param blendMode A pointer filled in with the current blend mode
  1039  *
  1040  * \return 0 on success, or -1 if the texture is not valid
  1041  *
  1042  * \sa SDL_SetTextureBlendMode()
  1043  */
  1044 extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_TextureID textureID,
  1045                                                     int *blendMode);
  1046 
  1047 /**
  1048  * \fn int SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
  1049  *
  1050  * \brief Set the scale mode used for texture copy operations
  1051  *
  1052  * \param texture The texture to update
  1053  * \param scaleMode SDL_TextureScaleMode to use for texture scaling
  1054  *
  1055  * \return 0 on success, or -1 if the texture is not valid or the scale mode is not supported
  1056  *
  1057  * \note If the scale mode is not supported, the closest supported mode is chosen.
  1058  *
  1059  * \sa SDL_GetTextureScaleMode()
  1060  */
  1061 extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_TextureID textureID,
  1062                                                     int scaleMode);
  1063 
  1064 /**
  1065  * \fn int SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
  1066  *
  1067  * \brief Get the scale mode used for texture copy operations
  1068  *
  1069  * \param texture The texture to query
  1070  * \param scaleMode A pointer filled in with the current scale mode
  1071  *
  1072  * \return 0 on success, or -1 if the texture is not valid
  1073  *
  1074  * \sa SDL_SetTextureScaleMode()
  1075  */
  1076 extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_TextureID textureID,
  1077                                                     int *scaleMode);
  1078 
  1079 /**
  1080  * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
  1081  *
  1082  * \brief Update the given texture rectangle with new pixel data.
  1083  *
  1084  * \param texture The texture to update
  1085  * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  1086  * \param pixels The raw pixel data
  1087  * \param pitch The number of bytes between rows of pixel data
  1088  *
  1089  * \return 0 on success, or -1 if the texture is not valid
  1090  *
  1091  * \note This is a fairly slow function.
  1092  */
  1093 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
  1094                                               const SDL_Rect * rect,
  1095                                               const void *pixels, int pitch);
  1096 
  1097 /**
  1098  * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
  1099  *
  1100  * \brief Lock a portion of the texture for pixel access.
  1101  *
  1102  * \param textureID The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING.
  1103  * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
  1104  * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
  1105  * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
  1106  * \param pitch This is filled in with the pitch of the locked pixels.
  1107  *
  1108  * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TEXTUREACCESS_STATIC
  1109  *
  1110  * \sa SDL_DirtyTexture()
  1111  * \sa SDL_UnlockTexture()
  1112  */
  1113 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
  1114                                             const SDL_Rect * rect,
  1115                                             int markDirty, void **pixels,
  1116                                             int *pitch);
  1117 
  1118 /**
  1119  * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
  1120  *
  1121  * \brief Unlock a texture, uploading the changes to video memory, if needed.
  1122  *
  1123  * \sa SDL_LockTexture()
  1124  * \sa SDL_DirtyTexture()
  1125  */
  1126 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
  1127 
  1128 /**
  1129  * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
  1130  *
  1131  * \brief Mark the specified rectangles of the texture as dirty.
  1132  *
  1133  * \param textureID The texture to mark dirty, which was created with SDL_TEXTUREACCESS_STREAMING.
  1134  * \param numrects The number of rectangles pointed to by rects.
  1135  * \param rects The pointer to an array of dirty rectangles.
  1136  *
  1137  * \sa SDL_LockTexture()
  1138  * \sa SDL_UnlockTexture()
  1139  */
  1140 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
  1141                                               int numrects,
  1142                                               const SDL_Rect * rects);
  1143 
  1144 /**
  1145  * \fn void SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
  1146  *
  1147  * \brief Set the color used for drawing operations (Fill and Line).
  1148  *
  1149  * \param r The red value used to draw on the rendering target
  1150  * \param g The green value used to draw on the rendering target
  1151  * \param b The blue value used to draw on the rendering target
  1152  * \param a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
  1153  * \return 0 on success, or -1 if there is no rendering context current
  1154  */
  1155 extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
  1156                                            Uint8 a);
  1157 
  1158 /**
  1159  * \fn void SDL_GetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
  1160  *
  1161  * \brief Get the color used for drawing operations (Fill and Line).
  1162  *
  1163  * \param r A pointer to the red value used to draw on the rendering target
  1164  * \param g A pointer to the green value used to draw on the rendering target
  1165  * \param b A pointer to the blue value used to draw on the rendering target
  1166  * \param a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
  1167  * \return 0 on success, or -1 if there is no rendering context current
  1168  */
  1169 extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
  1170                                            Uint8 * a);
  1171 
  1172 /**
  1173  * \fn int SDL_SetRenderDrawBlendMode(int blendMode)
  1174  *
  1175  * \brief Set the blend mode used for drawing operations (Fill and Line).
  1176  *
  1177  * \param blendMode SDL_BlendMode to use for blending
  1178  *
  1179  * \return 0 on success, or -1 if there is no rendering context current
  1180  *
  1181  * \note If the blend mode is not supported, the closest supported mode is chosen.
  1182  *
  1183  * \sa SDL_SetRenderDrawBlendMode()
  1184  */
  1185 extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
  1186 
  1187 /**
  1188  * \fn int SDL_GetRenderDrawBlendMode(int *blendMode)
  1189  *
  1190  * \brief Get the blend mode used for drawing operations
  1191  *
  1192  * \param blendMode A pointer filled in with the current blend mode
  1193  *
  1194  * \return 0 on success, or -1 if there is no rendering context current
  1195  *
  1196  * \sa SDL_SetRenderDrawBlendMode()
  1197  */
  1198 extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
  1199 
  1200 /**
  1201  * \fn int SDL_RenderPoint(int x, int y)
  1202  *
  1203  * \brief Draw a point on the current rendering target.
  1204  *
  1205  * \param x The x coordinate of the point
  1206  * \param y The y coordinate of the point
  1207  *
  1208  * \return 0 on success, or -1 if there is no rendering context current
  1209  */
  1210 extern DECLSPEC int SDLCALL SDL_RenderPoint(int x, int y);
  1211 
  1212 /**
  1213  * \fn int SDL_RenderLine(int x1, int y1, int x2, int y2)
  1214  *
  1215  * \brief Draw a line on the current rendering target.
  1216  *
  1217  * \param x1 The x coordinate of the start point
  1218  * \param y1 The y coordinate of the start point
  1219  * \param x2 The x coordinate of the end point
  1220  * \param y2 The y coordinate of the end point
  1221  *
  1222  * \return 0 on success, or -1 if there is no rendering context current
  1223  */
  1224 extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2);
  1225 
  1226 /**
  1227  * \fn void SDL_RenderFill(const SDL_Rect *rect)
  1228  *
  1229  * \brief Fill the current rendering target with the drawing color.
  1230  *
  1231  * \param r The red value used to fill the rendering target
  1232  * \param g The green value used to fill the rendering target
  1233  * \param b The blue value used to fill the rendering target
  1234  * \param a The alpha value used to fill the rendering target, usually SDL_ALPHA_OPAQUE (255)
  1235  * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
  1236  *
  1237  * \return 0 on success, or -1 if there is no rendering context current
  1238  */
  1239 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect);
  1240 
  1241 /**
  1242  * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
  1243  *
  1244  * \brief Copy a portion of the texture to the current rendering target.
  1245  *
  1246  * \param texture The source texture.
  1247  * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
  1248  * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
  1249  *
  1250  * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.
  1251  */
  1252 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
  1253                                            const SDL_Rect * srcrect,
  1254                                            const SDL_Rect * dstrect);
  1255 
  1256 /**
  1257  * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
  1258  *
  1259  * \brief Read pixels from the current rendering target.
  1260  *
  1261  * \param rect A pointer to the rectangle to read, or NULL for the entire render target
  1262  * \param pixels A pointer to be filled in with the pixel data
  1263  * \param pitch The pitch of the pixels parameter
  1264  *
  1265  * \return 0 on success, or -1 if pixel reading is not supported.
  1266  *
  1267  * \warning This is a very slow operation, and should not be used frequently.
  1268  */
  1269 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
  1270                                                  void *pixels, int pitch);
  1271 
  1272 /**
  1273  * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
  1274  *
  1275  * \brief Write pixels to the current rendering target.
  1276  *
  1277  * \param rect A pointer to the rectangle to write, or NULL for the entire render target
  1278  * \param pixels A pointer to the pixel data to write
  1279  * \param pitch The pitch of the pixels parameter
  1280  *
  1281  * \return 0 on success, or -1 if pixel writing is not supported.
  1282  *
  1283  * \warning This is a very slow operation, and should not be used frequently.
  1284  */
  1285 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
  1286                                                   const void *pixels,
  1287                                                   int pitch);
  1288 
  1289 /**
  1290  * \fn void SDL_RenderPresent(void)
  1291  *
  1292  * \brief Update the screen with rendering performed.
  1293  */
  1294 extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
  1295 
  1296 /**
  1297  * \fn void SDL_DestroyTexture(SDL_TextureID textureID);
  1298  *
  1299  * \brief Destroy the specified texture.
  1300  *
  1301  * \sa SDL_CreateTexture()
  1302  * \sa SDL_CreateTextureFromSurface()
  1303  */
  1304 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
  1305 
  1306 /**
  1307  * \fn void SDL_DestroyRenderer(SDL_WindowID windowID);
  1308  *
  1309  * \brief Destroy the rendering context for a window and free associated
  1310  *        textures.
  1311  *
  1312  * \sa SDL_CreateRenderer()
  1313  */
  1314 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
  1315 
  1316 /**
  1317  * \fn SDL_bool SDL_IsScreenSaverEnabled();
  1318  *
  1319  * \brief Returns whether the screensaver is currently enabled (default off).
  1320  *
  1321  * \sa SDL_EnableScreenSaver()
  1322  * \sa SDL_DisableScreenSaver()
  1323  */
  1324 extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void);
  1325 
  1326 /**
  1327  * \fn void SDL_EnableScreenSaver();
  1328  *
  1329  * \brief Allow the screen to be blanked by a screensaver
  1330  *
  1331  * \sa SDL_IsScreenSaverEnabled()
  1332  * \sa SDL_DisableScreenSaver()
  1333  */
  1334 extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void);
  1335 
  1336 /**
  1337  * \fn void SDL_DisableScreenSaver();
  1338  *
  1339  * \brief Prevent the screen from being blanked by a screensaver
  1340  *
  1341  * \sa SDL_IsScreenSaverEnabled()
  1342  * \sa SDL_EnableScreenSaver()
  1343  */
  1344 extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void);
  1345 
  1346 
  1347 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1348 /* OpenGL support functions.                                                 */
  1349 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1350 
  1351 /**
  1352  * \fn int SDL_GL_LoadLibrary(const char *path)
  1353  *
  1354  * \brief Dynamically load an OpenGL library.
  1355  *
  1356  * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
  1357  *
  1358  * \return 0 on success, or -1 if the library couldn't be loaded
  1359  *
  1360  * This should be done after initializing the video driver, but before
  1361  * creating any OpenGL windows.  If no OpenGL library is loaded, the default
  1362  * library will be loaded upon creation of the first OpenGL window.
  1363  *
  1364  * \note If you do this, you need to retrieve all of the GL functions used in
  1365  *       your program from the dynamic library using SDL_GL_GetProcAddress().
  1366  *
  1367  * \sa SDL_GL_GetProcAddress()
  1368  * \sa SDL_GL_UnloadLibrary()
  1369  */
  1370 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
  1371 
  1372 /**
  1373  * \fn void *SDL_GL_GetProcAddress(const char *proc)
  1374  *
  1375  * \brief Get the address of an OpenGL function.
  1376  */
  1377 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
  1378 
  1379 /**
  1380  * \fn void SDL_GL_UnloadLibrary(void)
  1381  *
  1382  * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary()
  1383  *
  1384  * \sa SDL_GL_LoadLibrary()
  1385  */
  1386 extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void);
  1387 
  1388 /**
  1389  * \fn SDL_bool SDL_GL_ExtensionSupported(const char *extension)
  1390  *
  1391  * \brief Return true if an OpenGL extension is supported for the current context.
  1392  */
  1393 extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char
  1394                                                            *extension);
  1395 
  1396 /**
  1397  * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
  1398  *
  1399  * \brief Set an OpenGL window attribute before window creation.
  1400  */
  1401 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
  1402 
  1403 /**
  1404  * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
  1405  *
  1406  * \brief Get the actual value for an attribute from the current context.
  1407  */
  1408 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
  1409 
  1410 /**
  1411  * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID)
  1412  *
  1413  * \brief Create an OpenGL context for use with an OpenGL window, and make it current.
  1414  *
  1415  * \sa SDL_GL_DeleteContext()
  1416  */
  1417 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
  1418                                                            windowID);
  1419 
  1420 /**
  1421  * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
  1422  *
  1423  * \brief Set up an OpenGL context for rendering into an OpenGL window.
  1424  *
  1425  * \note The context must have been created with a compatible window.
  1426  */
  1427 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
  1428                                                SDL_GLContext context);
  1429 
  1430 /**
  1431  * \fn int SDL_GL_SetSwapInterval(int interval)
  1432  *
  1433  * \brief Set the swap interval for the current OpenGL context.
  1434  *
  1435  * \param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace
  1436  *
  1437  * \return 0 on success, or -1 if setting the swap interval is not supported.
  1438  *
  1439  * \sa SDL_GL_GetSwapInterval()
  1440  */
  1441 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
  1442 
  1443 /**
  1444  * \fn int SDL_GL_GetSwapInterval(void)
  1445  *
  1446  * \brief Get the swap interval for the current OpenGL context.
  1447  *
  1448  * \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.
  1449  *
  1450  * \sa SDL_GL_SetSwapInterval()
  1451  */
  1452 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
  1453 
  1454 /**
  1455  * \fn void SDL_GL_SwapWindow(SDL_WindowID windowID)
  1456  *
  1457  * \brief Swap the OpenGL buffers for the window, if double-buffering is supported.
  1458  */
  1459 extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_WindowID windowID);
  1460 
  1461 /**
  1462  * \fn void SDL_GL_DeleteContext(SDL_GLContext context)
  1463  *
  1464  * \brief Delete an OpenGL context.
  1465  *
  1466  * \sa SDL_GL_CreateContext()
  1467  */
  1468 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
  1469 
  1470 
  1471 /* Ends C function definitions when using C++ */
  1472 #ifdef __cplusplus
  1473 /* *INDENT-OFF* */
  1474 }
  1475 /* *INDENT-ON* */
  1476 #endif
  1477 #include "close_code.h"
  1478 
  1479 #endif /* _SDL_video_h */
  1480 
  1481 /* vi: set ts=4 sw=4 expandtab: */