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