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