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