include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 07 Jul 2006 10:39:33 +0000
branchSDL-1.3
changeset 1729 0ef52d56e8bb
parent 1727 90a3e0fccb88
child 1733 0b1070f2f94d
permissions -rw-r--r--
Fixed compile problems with new OpenGL API.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  * \file SDL_video.h
    25  *
    26  * Header file for access to the SDL raw framebuffer window
    27  */
    28 
    29 #ifndef _SDL_video_h
    30 #define _SDL_video_h
    31 
    32 #include "SDL_stdinc.h"
    33 #include "SDL_error.h"
    34 #include "SDL_pixels.h"
    35 #include "SDL_rwops.h"
    36 
    37 #include "begin_code.h"
    38 /* Set up for C function definitions, even when using C++ */
    39 #ifdef __cplusplus
    40 /* *INDENT-OFF* */
    41 extern "C" {
    42 /* *INDENT-ON* */
    43 #endif
    44 
    45 /* Transparency definitions: These define alpha as the opacity of a surface */
    46 #define SDL_ALPHA_OPAQUE 255
    47 #define SDL_ALPHA_TRANSPARENT 0
    48 
    49 /**
    50  * \struct SDL_Rect
    51  *
    52  * \brief A rectangle, with the origin at the upper left.
    53  */
    54 typedef struct SDL_Rect
    55 {
    56     Sint16 x, y;
    57     Uint16 w, h;
    58 } SDL_Rect;
    59 
    60 /**
    61  * \struct SDL_DisplayMode
    62  *
    63  * \brief  The structure that defines a display mode
    64  *
    65  * \sa SDL_GetNumDisplayModes()
    66  * \sa SDL_GetDisplayMode()
    67  * \sa SDL_GetDesktopDisplayMode()
    68  * \sa SDL_GetCurrentDisplayMode()
    69  * \sa SDL_GetClosestDisplayMode()
    70  * \sa SDL_SetDisplayMode()
    71  */
    72 typedef struct
    73 {
    74     Uint32 format;              /**< pixel format */
    75     int w;                      /**< width */
    76     int h;                      /**< height */
    77     int refresh_rate;           /**< refresh rate (or zero for unspecified) */
    78     void *driverdata;           /**< driver-specific data, initialize to 0 */
    79 } SDL_DisplayMode;
    80 
    81 /**
    82  * \typedef SDL_WindowID
    83  *
    84  * \brief The type used to identify a window
    85  *
    86  * \sa SDL_CreateWindow()
    87  * \sa SDL_CreateWindowFrom()
    88  * \sa SDL_DestroyWindow()
    89  * \sa SDL_GetWindowData()
    90  * \sa SDL_GetWindowFlags()
    91  * \sa SDL_GetWindowGrab()
    92  * \sa SDL_GetWindowPosition()
    93  * \sa SDL_GetWindowSize()
    94  * \sa SDL_GetWindowTitle()
    95  * \sa SDL_HideWindow()
    96  * \sa SDL_MaximizeWindow()
    97  * \sa SDL_MinimizeWindow()
    98  * \sa SDL_RaiseWindow()
    99  * \sa SDL_RestoreWindow()
   100  * \sa SDL_SetWindowData()
   101  * \sa SDL_SetWindowGrab()
   102  * \sa SDL_SetWindowIcon()
   103  * \sa SDL_SetWindowPosition()
   104  * \sa SDL_SetWindowSize()
   105  * \sa SDL_SetWindowTitle()
   106  * \sa SDL_ShowWindow()
   107  */
   108 typedef Uint32 SDL_WindowID;
   109 
   110 /**
   111  * \enum SDL_WindowFlags
   112  *
   113  * \brief The flags on a window
   114  *
   115  * \sa SDL_GetWindowFlags()
   116  */
   117 typedef enum
   118 {
   119     SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
   120     SDL_WINDOW_OPENGL = 0x00000002,             /**< window usable with OpenGL context */
   121     SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
   122     SDL_WINDOW_BORDERLESS = 0x00000008,         /**< no window decoration */
   123     SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
   124     SDL_WINDOW_MINIMIZED = 0x00000020,          /**< minimized */
   125     SDL_WINDOW_MAXIMIZED = 0x00000040,          /**< maximized */
   126     SDL_WINDOW_INPUT_GRABBED = 0x00000100,      /**< window has grabbed input focus */
   127     SDL_WINDOW_KEYBOARD_FOCUS = 0x00000200,     /**< window has keyboard focus */
   128     SDL_WINDOW_MOUSE_FOCUS = 0x00000400,        /**< window has mouse focus */
   129 } SDL_WindowFlags;
   130 
   131 /**
   132  * \def SDL_WINDOWPOS_UNDEFINED
   133  * \brief Used to indicate that you don't care what the window position is.
   134  */
   135 #define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
   136 /**
   137  * \def SDL_WINDOWPOS_CENTERED
   138  * \brief Used to indicate that the window position should be centered.
   139  */
   140 #define SDL_WINDOWPOS_CENTERED  0x7FFFFFE
   141 
   142 /**
   143  * \enum SDL_WindowEventID
   144  *
   145  * \brief Event subtype for window events
   146  */
   147 typedef enum
   148 {
   149     SDL_WINDOWEVENT_NONE,               /**< Never used */
   150     SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
   151     SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
   152     SDL_WINDOWEVENT_EXPOSED,            /**< Window has been exposed and should be redrawn */
   153     SDL_WINDOWEVENT_MOVED,              /**< Window has been moved to data1,data2 */
   154     SDL_WINDOWEVENT_RESIZED,            /**< Window size changed to data1xdata2 */
   155     SDL_WINDOWEVENT_MINIMIZED,          /**< Window has been minimized */
   156     SDL_WINDOWEVENT_MAXIMIZED,          /**< Window has been maximized */
   157     SDL_WINDOWEVENT_RESTORED,           /**< Window has been restored to normal size and position */
   158     SDL_WINDOWEVENT_ENTER,              /**< The window has gained mouse focus */
   159     SDL_WINDOWEVENT_LEAVE,              /**< The window has lost mouse focus */
   160     SDL_WINDOWEVENT_FOCUS_GAINED,       /**< The window has gained keyboard focus */
   161     SDL_WINDOWEVENT_FOCUS_LOST,         /**< The window has lost keyboard focus */
   162     SDL_WINDOWEVENT_CLOSE,                              /**< The window manager requests that the window be closed */
   163 } SDL_WindowEventID;
   164 
   165 /**
   166  * \enum SDL_RendererFlags
   167  *
   168  * \brief Flags used when initializing a render manager.
   169  */
   170 typedef enum
   171 {
   172     SDL_Renderer_PresentDiscard = 0x00000001,   /**< Present leaves the contents of the backbuffer undefined */
   173     SDL_Renderer_PresentCopy = 0x00000002,      /**< Present uses a copy from back buffer to the front buffer */
   174     SDL_Renderer_PresentFlip2 = 0x00000004,     /**< Present uses a flip, swapping back buffer and front buffer */
   175     SDL_Renderer_PresentFlip3 = 0x00000008,     /**< Present uses a flip, rotating between two back buffers and a front buffer */
   176     SDL_Renderer_PresentVSync = 0x00000010,     /**< Present is synchronized with the refresh rate */
   177     SDL_Renderer_RenderTarget = 0x00000020,     /**< The renderer can create texture render targets */
   178     SDL_Renderer_Accelerated = 0x00000040,      /**< The renderer uses hardware acceleration */
   179     SDL_Renderer_Minimal = 0x00000080,          /**< The renderer only supports the read/write pixel and present functions */
   180 } SDL_RendererFlags;
   181 
   182 /**
   183  * \struct SDL_RendererInfo
   184  *
   185  * \brief Information on the capabilities of a render manager.
   186  */
   187 typedef struct SDL_RendererInfo
   188 {
   189     const char *name;           /**< The name of the renderer */
   190     Uint32 flags;               /**< Supported SDL_RendererFlags */
   191     Uint32 blend_modes;         /**< A mask of supported blend modes */
   192     Uint32 scale_modes;         /**< A mask of supported scale modes */
   193     Uint32 num_texture_formats; /**< The number of available texture formats */
   194     Uint32 texture_formats[32]; /**< The available texture formats */
   195     int max_texture_width;      /**< The maximimum texture width */
   196     int max_texture_height;     /**< The maximimum texture height */
   197 } SDL_RendererInfo;
   198 
   199 /**
   200  * \enum SDL_TextureAccess
   201  *
   202  * \brief The access pattern allowed for a texture
   203  */
   204 typedef enum
   205 {
   206     SDL_TextureAccess_Render,   /**< Unlockable video memory, rendering allowed */
   207     SDL_TextureAccess_Remote,   /**< Unlockable video memory */
   208     SDL_TextureAccess_Local,    /**< Lockable system memory */
   209 } SDL_TextureAccess;
   210 
   211 /**
   212  * \enum SDL_TextureBlendMode
   213  *
   214  * \brief The blend mode used in SDL_RenderCopy()
   215  */
   216 typedef enum
   217 {
   218     SDL_TextureBlendMode_None = 0x00000000,     /**< No blending */
   219     SDL_TextureBlendMode_Mask = 0x00000001,     /**< dst = A ? src : dst (alpha is mask) */
   220     SDL_TextureBlendMode_Blend = 0x00000002,    /**< dst = (src * A) + (dst * (1-A)) */
   221     SDL_TextureBlendMode_Add = 0x00000004,      /**< dst = (src * A) + dst */
   222     SDL_TextureBlendMode_Mod = 0x00000008,      /**< dst = src * dst */
   223 } SDL_TextureBlendMode;
   224 
   225 /**
   226  * \enum SDL_TextureScaleMode
   227  *
   228  * \brief The scale mode used in SDL_RenderCopy()
   229  */
   230 typedef enum
   231 {
   232     SDL_TextureScaleMode_None = 0x00000000,     /**< No scaling, rectangles must match dimensions */
   233     SDL_TextureScaleMode_Fast = 0x00000001,     /**< Point sampling or equivalent algorithm */
   234     SDL_TextureScaleMode_Slow = 0x00000002,     /**< Linear filtering or equivalent algorithm */
   235     SDL_TextureScaleMode_Best = 0x00000004,     /**< Bicubic filtering or equivalent algorithm */
   236 } SDL_TextureScaleMode;
   237 
   238 /**
   239  * \typedef SDL_TextureID
   240  *
   241  * \brief An efficient driver-specific representation of pixel data
   242  */
   243 typedef Uint32 SDL_TextureID;
   244 
   245 /**
   246  * \typedef SDL_GLContext
   247  *
   248  * \brief An opaque handle to an OpenGL context.
   249  */
   250 typedef void *SDL_GLContext;
   251 
   252 
   253 /* These are the currently supported flags for the SDL_surface */
   254 /* Used internally (read-only) */
   255 #define SDL_HWSURFACE       0x00000001  /* Surface represents a texture */
   256 #define SDL_PREALLOC        0x00000002  /* Surface uses preallocated memory */
   257 #define SDL_SRCALPHA        0x00000004  /* Blit uses source alpha blending */
   258 #define SDL_SRCCOLORKEY     0x00000008  /* Blit uses a source color key */
   259 #define SDL_RLEACCELOK      0x00000010  /* Private flag */
   260 #define SDL_RLEACCEL        0x00000020  /* Surface is RLE encoded */
   261 
   262 /* Evaluates to true if the surface needs to be locked before access */
   263 #define SDL_MUSTLOCK(S)	(((S)->flags & (SDL_HWSURFACE|SDL_RLEACCEL)) != 0)
   264 
   265 /* This structure should be treated as read-only, except for 'pixels',
   266    which, if not NULL, contains the raw pixel data for the surface.
   267 */
   268 typedef struct SDL_Surface
   269 {
   270     Uint32 flags;               /* Read-only */
   271     SDL_PixelFormat *format;    /* Read-only */
   272     int w, h;                   /* Read-only */
   273     int pitch;                  /* Read-only */
   274     void *pixels;               /* Read-write */
   275 
   276     /* texture associated with the surface, if any */
   277     SDL_TextureID textureID;
   278 
   279     /* information needed for surfaces requiring locks */
   280     int locked;
   281     void *lock_data;
   282 
   283     /* clipping information */
   284     SDL_Rect clip_rect;         /* Read-only */
   285 
   286     /* info for fast blit mapping to other surfaces */
   287     struct SDL_BlitMap *map;    /* Private */
   288 
   289     /* format version, bumped at every change to invalidate blit maps */
   290     unsigned int format_version;        /* Private */
   291 
   292     /* Reference count -- used when freeing surface */
   293     int refcount;               /* Read-mostly */
   294 } SDL_Surface;
   295 
   296 /* typedef for private surface blitting functions */
   297 typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
   298                          struct SDL_Surface * dst, SDL_Rect * dstrect);
   299 
   300 
   301 /**
   302  * \enum SDL_GLattr
   303  *
   304  * \brief OpenGL configuration attributes
   305  */
   306 typedef enum
   307 {
   308     SDL_GL_RED_SIZE,
   309     SDL_GL_GREEN_SIZE,
   310     SDL_GL_BLUE_SIZE,
   311     SDL_GL_ALPHA_SIZE,
   312     SDL_GL_BUFFER_SIZE,
   313     SDL_GL_DOUBLEBUFFER,
   314     SDL_GL_DEPTH_SIZE,
   315     SDL_GL_STENCIL_SIZE,
   316     SDL_GL_ACCUM_RED_SIZE,
   317     SDL_GL_ACCUM_GREEN_SIZE,
   318     SDL_GL_ACCUM_BLUE_SIZE,
   319     SDL_GL_ACCUM_ALPHA_SIZE,
   320     SDL_GL_STEREO,
   321     SDL_GL_MULTISAMPLEBUFFERS,
   322     SDL_GL_MULTISAMPLESAMPLES,
   323     SDL_GL_ACCELERATED_VISUAL
   324 } SDL_GLattr;
   325 
   326 
   327 /* Function prototypes */
   328 
   329 /**
   330  * \fn int SDL_GetNumVideoDrivers(void)
   331  *
   332  * \brief Get the number of video drivers compiled into SDL
   333  *
   334  * \sa SDL_GetVideoDriver()
   335  */
   336 extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
   337 
   338 /**
   339  * \fn const char *SDL_GetVideoDriver(int index)
   340  *
   341  * \brief Get the name of a built in video driver.
   342  *
   343  * \note The video drivers are presented in the order in which they are
   344  * normally checked during initialization.
   345  *
   346  * \sa SDL_GetNumVideoDrivers()
   347  */
   348 extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
   349 
   350 /**
   351  * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
   352  *
   353  * \brief Initialize the video subsystem, optionally specifying a video driver.
   354  *
   355  * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
   356  * \param flags FIXME: Still needed?
   357  *
   358  * \return 0 on success, -1 on error
   359  *
   360  * This function initializes the video subsystem; setting up a connection
   361  * to the window manager, etc, and determines the available display modes
   362  * and pixel formats, but does not initialize a window or graphics mode.
   363  *
   364  * \sa SDL_VideoQuit()
   365  */
   366 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
   367                                           Uint32 flags);
   368 
   369 /**
   370  * \fn void SDL_VideoQuit(void)
   371  *
   372  * \brief Shuts down the video subsystem.
   373  *
   374  * This function closes all windows, and restores the original video mode.
   375  *
   376  * \sa SDL_VideoInit()
   377  */
   378 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
   379 
   380 /**
   381  * \fn const char *SDL_GetCurrentVideoDriver(void)
   382  *
   383  * \brief Returns the name of the currently initialized video driver.
   384  *
   385  * \return The name of the current video driver or NULL if no driver
   386  *         has been initialized
   387  *
   388  * \sa SDL_GetNumVideoDrivers()
   389  * \sa SDL_GetVideoDriver()
   390  */
   391 extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
   392 
   393 /**
   394  * \fn int SDL_GetNumVideoDisplays(void)
   395  *
   396  * \brief Returns the number of available video displays.
   397  *
   398  * \sa SDL_SelectVideoDisplay()
   399  */
   400 extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
   401 
   402 /**
   403  * \fn int SDL_SelectVideoDisplay(int index)
   404  *
   405  * \brief Set the index of the currently selected display.
   406  *
   407  * \return The index of the currently selected display.
   408  *
   409  * \note You can query the currently selected display by passing an index of -1.
   410  *
   411  * \sa SDL_GetNumVideoDisplays()
   412  */
   413 extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
   414 
   415 /**
   416  * \fn int SDL_GetNumDisplayModes(void)
   417  *
   418  * \brief Returns the number of available display modes for the current display.
   419  *
   420  * \sa SDL_GetDisplayMode()
   421  */
   422 extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
   423 
   424 /**
   425  * \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index)
   426  *
   427  * \brief Retrieve information about a specific display mode.
   428  *
   429  * \note The display modes are sorted in this priority:
   430  *       \li bits per pixel -> more colors to fewer colors
   431  *       \li width -> largest to smallest
   432  *       \li height -> largest to smallest
   433  *       \li refresh rate -> highest to lowest
   434  *
   435  * \sa SDL_GetNumDisplayModes()
   436  */
   437 extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index);
   438 
   439 /**
   440  * \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void)
   441  *
   442  * \brief Retrieve information about the desktop display mode for the current display.
   443  */
   444 extern DECLSPEC const SDL_DisplayMode *SDLCALL
   445 SDL_GetDesktopDisplayMode(void);
   446 
   447 /**
   448  * \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void)
   449  *
   450  * \brief Retrieve information about the current display mode.
   451  */
   452 extern DECLSPEC const SDL_DisplayMode *SDLCALL
   453 SDL_GetCurrentDisplayMode(void);
   454 
   455 /**
   456  * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
   457  *
   458  * \brief Get the closest match to the requested display mode.
   459  *
   460  * \param mode The desired display mode
   461  * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
   462  *
   463  * \return The passed in value 'closest', or NULL if no matching video mode was available.
   464  *
   465  * The available display modes are scanned, and 'closest' is filled in with the closest mode matching the requested mode and returned.  The mode format and refresh_rate default to the desktop mode if they are 0.  The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate.  If all the available modes are too small, then NULL is returned.
   466  *
   467  * \sa SDL_GetNumDisplayModes()
   468  * \sa SDL_GetDisplayMode()
   469  */
   470 extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
   471                                                                    SDL_DisplayMode
   472                                                                    * mode,
   473                                                                    SDL_DisplayMode
   474                                                                    * closest);
   475 
   476 /**
   477  * \fn int SDL_SetDisplayMode(const SDL_DisplayMode *mode)
   478  *
   479  * \brief Set up the closest available mode on the current display.
   480  *
   481  * \param mode The desired display mode, or NULL to set the desktop mode.
   482  *
   483  * \return 0 on success, or -1 if setting the display mode failed.
   484  */
   485 extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode);
   486 
   487 /**
   488  * \fn int SDL_SetDisplayPalette(const SDL_Color *colors, int firstcolor, int ncolors)
   489  *
   490  * \brief Set the palette entries for indexed display modes.
   491  *
   492  * \return 0 on success, or -1 if the display mode isn't palettized or the colors couldn't be set.
   493  */
   494 extern DECLSPEC int SDLCALL SDL_SetDisplayPalette(const SDL_Color * colors,
   495                                                   int firstcolor,
   496                                                   int ncolors);
   497 
   498 /**
   499  * \fn int SDL_GetDisplayPalette(SDL_Color *colors, int firstcolor, int ncolors)
   500  *
   501  * \brief Gets the palette entries for indexed display modes.
   502  *
   503  * \return 0 on success, or -1 if the display mode isn't palettized
   504  */
   505 extern DECLSPEC int SDLCALL SDL_GetDisplayPalette(SDL_Color * colors,
   506                                                   int firstcolor,
   507                                                   int ncolors);
   508 
   509 /**
   510  * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
   511  *
   512  * \brief Create a window with the specified position, dimensions, and flags.
   513  *
   514  * \param title The title of the window
   515  * \param x The x position of the window
   516  * \param y The y position of the window
   517  * \param w The width of the window
   518  * \param h The height of the window
   519  * \param flags The flags for the window
   520  *
   521  * \return The id of the window created, or zero if window creation failed.
   522  *
   523  * \note Setting the position to -1, -1, indicates any position is fine.
   524  *
   525  * \sa SDL_DestroyWindow()
   526  */
   527 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
   528                                                       int x, int y, int w,
   529                                                       int h, Uint32 flags);
   530 
   531 /**
   532  * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
   533  *
   534  * \brief Create an SDL window struct from an existing native window.
   535  *
   536  * \param data A pointer to driver-dependent window creation data
   537  *
   538  * \return The id of the window created, or zero if window creation failed.
   539  *
   540  * \warning This function is NOT SUPPORTED, use at your own risk!
   541  *
   542  * \sa SDL_DestroyWindow()
   543  */
   544 extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(const void *data);
   545 
   546 /**
   547  * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
   548  *
   549  * \brief Get the window flags.
   550  */
   551 extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
   552 
   553 /**
   554  * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
   555  *
   556  * \brief Set the title of the window, in UTF-8 format.
   557  *
   558  * \sa SDL_GetWindowTitle()
   559  */
   560 extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
   561                                                 const char *title);
   562 
   563 /**
   564  * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
   565  *
   566  * \brief Get the title of the window, in UTF-8 format.
   567  *
   568  * \sa SDL_SetWindowTitle()
   569  */
   570 extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
   571 
   572 /**
   573  * \fn void SDL_SetWindowIcon(SDL_Surface *icon)
   574  *
   575  * \brief Set the icon of the window.
   576  *
   577  * \param icon The icon for the window
   578  *
   579  * FIXME: The icon needs to be set before the window is first shown.  Should some icon representation be part of the window creation data?
   580  */
   581 extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon);
   582 
   583 /**
   584  * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
   585  *
   586  * \brief Associate an arbitrary pointer with the window.
   587  *
   588  * \sa SDL_GetWindowData()
   589  */
   590 extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
   591                                                void *userdata);
   592 
   593 /**
   594  * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
   595  *
   596  * \brief Retrieve the data pointer associated with the window.
   597  *
   598  * \sa SDL_SetWindowData()
   599  */
   600 extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
   601 
   602 /**
   603  * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
   604  *
   605  * \brief Set the position of the window.
   606  *
   607  * \param windowID The window to reposition
   608  * \param x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   609  * \param y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
   610  *
   611  * \note The window coordinate origin is the upper left of the display.
   612  *
   613  * \sa SDL_GetWindowPosition()
   614  */
   615 extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
   616                                                    int x, int y);
   617 
   618 /**
   619  * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
   620  *
   621  * \brief Get the position of the window.
   622  *
   623  * \sa SDL_SetWindowPosition()
   624  */
   625 extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
   626                                                    int *x, int *y);
   627 
   628 /**
   629  * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
   630  *
   631  * \brief Set the size of the window's client area.
   632  *
   633  * \note You can't change the size of a fullscreen window, it automatically
   634  * matches the size of the display mode.
   635  *
   636  * \sa SDL_GetWindowSize()
   637  */
   638 extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
   639                                                int h);
   640 
   641 /**
   642  * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w)
   643  *
   644  * \brief Get the size of the window's client area.
   645  *
   646  * \sa SDL_SetWindowSize()
   647  */
   648 extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
   649                                                int *h);
   650 
   651 /**
   652  * \fn void SDL_ShowWindow(SDL_WindowID windowID)
   653  *
   654  * \brief Show the window
   655  *
   656  * \sa SDL_HideWindow()
   657  */
   658 extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
   659 
   660 /**
   661  * \fn void SDL_HideWindow(SDL_WindowID windowID)
   662  *
   663  * \brief Hide the window
   664  *
   665  * \sa SDL_ShowWindow()
   666  */
   667 extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
   668 
   669 /**
   670  * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
   671  *
   672  * \brief Raise the window so it's above other windows.
   673  */
   674 extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
   675 
   676 /**
   677  * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
   678  *
   679  * \brief Make the window as large as possible.
   680  *
   681  * \sa SDL_RestoreWindow()
   682  */
   683 extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
   684 
   685 /**
   686  * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
   687  *
   688  * \brief Minimize the window to an iconic representation.
   689  *
   690  * \sa SDL_RestoreWindow()
   691  */
   692 extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
   693 
   694 /**
   695  * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
   696  *
   697  * \brief Restore the size and position of a minimized or maximized window.
   698  *
   699  * \sa SDL_MaximizeWindow()
   700  * \sa SDL_MinimizeWindow()
   701  */
   702 extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
   703 
   704 /**
   705  * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
   706  *
   707  * \brief Set the window's input grab mode.
   708  *
   709  * \param mode This is 1 to grab input, and 0 to release input.
   710  *
   711  * \sa SDL_GrabMode
   712  * \sa SDL_GetWindowGrab()
   713  */
   714 extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
   715                                                int mode);
   716 
   717 /**
   718  * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
   719  *
   720  * \brief Get the window's input grab mode.
   721  *
   722  * \return This returns 1 if input is grabbed, and 0 otherwise.
   723  *
   724  * \sa SDL_GrabMode
   725  * \sa SDL_SetWindowGrab()
   726  */
   727 extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
   728 
   729 /**
   730  * \fn SDL_bool SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
   731  *
   732  * \brief Get driver specific information about a window.
   733  *
   734  * \note Include SDL_syswm.h for the declaration of SDL_SysWMinfo.
   735  */
   736 struct SDL_SysWMinfo;
   737 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   738                                                      struct SDL_SysWMinfo
   739                                                      *info);
   740 
   741 /**
   742  * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
   743  *
   744  * \brief Destroy a window.
   745  */
   746 extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
   747 
   748 /**
   749  * \fn int SDL_GetNumRenderers(void)
   750  *
   751  * \brief Get the number of render managers on the current display.
   752  *
   753  * A render manager is a set of code that handles rendering and texture
   754  * management on a particular display.  Normally there is only one, but
   755  * some drivers may have several available with different capabilities.
   756  *
   757  * \sa SDL_GetRendererInfo()
   758  * \sa SDL_CreateRenderer()
   759  */
   760 extern DECLSPEC int SDLCALL SDL_GetNumRenderers(void);
   761 
   762 /**
   763  * \fn SDL_RendererInfo *SDL_GetRendererInfo(int index)
   764  *
   765  * \brief Get information about a specific render manager on the current
   766  *        display.
   767  *
   768  * \sa SDL_CreateRenderer()
   769  */
   770 extern DECLSPEC int SDLCALL SDL_GetRendererInfo(int index,
   771                                                 SDL_RendererInfo * info);
   772 
   773 /**
   774  * \fn int SDL_CreateRenderer(SDL_WindowID window, int index, Uint32 flags)
   775  *
   776  * \brief Create and make active a 2D rendering context for a window.
   777  *
   778  * \param windowID The window used for rendering
   779  * \param index The index of the render manager to initialize, or -1 to initialize the first one supporting the requested flags.
   780  * \param flags SDL_RendererFlags
   781  *
   782  * \return 0 on success, -1 if the flags were not supported, or -2 if
   783  *         there isn't enough memory to support the requested flags
   784  *
   785  * \sa SDL_SelectRenderer()
   786  * \sa SDL_DestroyRenderer()
   787  */
   788 extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_WindowID windowID,
   789                                                int index, Uint32 flags);
   790 
   791 /**
   792  * \fn int SDL_SelectRenderer(SDL_WindowID windowID)
   793  *
   794  * \brief Select the rendering context for a particular window.
   795  *
   796  * \return 0 on success, -1 if the selected window doesn't have a
   797  *         rendering context.
   798  */
   799 extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_WindowID windowID);
   800 
   801 /**
   802  * \fn SDL_TextureID SDL_CreateTexture(Uint32 format, int access, int w, int h)
   803  *
   804  * \brief Create a texture for the current rendering context.
   805  *
   806  * \param format The format of the texture
   807  * \param access One of the enumerated values in SDL_TextureAccess
   808  * \param w The width of the texture in pixels
   809  * \param h The height of the texture in pixels
   810  *
   811  * \return The created texture is returned, or 0 if no render manager was active,  the format was unsupported, or the width or height were out of range.
   812  *
   813  * \sa SDL_QueryTexture()
   814  * \sa SDL_DestroyTexture()
   815  */
   816 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTexture(Uint32 format,
   817                                                         int access, int w,
   818                                                         int h);
   819 
   820 /**
   821  * \fn SDL_TextureID SDL_CreateTextureFromSurface(Uint32 format, int access, SDL_Surface *surface)
   822  *
   823  * \brief Create a texture from an existing surface.
   824  *
   825  * \param format The format of the texture, or 0 to pick an appropriate format
   826  * \param access One of the enumerated values in SDL_TextureAccess
   827  * \param surface The surface containing pixel data used to fill the texture
   828  *
   829  * \return The created texture is returned, or 0 if no render manager was active,  the format was unsupported, or the surface width or height were out of range.
   830  *
   831  * \note The surface is not modified or freed by this function.
   832  *
   833  * \sa SDL_QueryTexture()
   834  * \sa SDL_DestroyTexture()
   835  */
   836 extern DECLSPEC SDL_TextureID SDLCALL SDL_CreateTextureFromSurface(Uint32
   837                                                                    format,
   838                                                                    int access,
   839                                                                    SDL_Surface
   840                                                                    * surface);
   841 
   842 /**
   843  * \fn int SDL_QueryTexture(SDL_TextureID textureID, Uint32 *format, int *access, int *w, int *h)
   844  *
   845  * \brief Query the attributes of a texture
   846  *
   847  * \param texture A texture to be queried
   848  * \param format A pointer filled in with the raw format of the texture.  The actual format may differ, but pixel transfers will use this format.
   849  * \param access A pointer filled in with the actual access to the texture.
   850  * \param w A pointer filled in with the width of the texture in pixels
   851  * \param h A pointer filled in with the height of the texture in pixels
   852  *
   853  * \return 0 on success, or -1 if the texture is not valid
   854  */
   855 extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_TextureID textureID,
   856                                              Uint32 * format, int *access,
   857                                              int *w, int *h);
   858 
   859 /**
   860  * \fn int SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int pitch)
   861  *
   862  * \brief Query the pixels of a texture, if the texture does not need to be locked for pixel access.
   863  *
   864  * \param texture A texture to be queried, which was created with SDL_TextureAccess_Local
   865  * \param pixels A pointer filled with a pointer to the pixels for the texture 
   866  * \param pitch A pointer filled in with the pitch of the pixel data
   867  *
   868  * \return 0 on success, or -1 if the texture is not valid, or must be locked for pixel access.
   869  */
   870 extern DECLSPEC int SDLCALL SDL_QueryTexturePixels(SDL_TextureID textureID,
   871                                                    void **pixels, int *pitch);
   872 
   873 /**
   874  * \fn int SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors, int firstcolor, int ncolors)
   875  *
   876  * \brief Update an indexed texture with a color palette
   877  *
   878  * \param texture The texture to update
   879  * \param colors The array of RGB color data
   880  * \param firstcolor The first index to update
   881  * \param ncolors The number of palette entries to fill with the color data
   882  *
   883  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   884  */
   885 extern DECLSPEC int SDLCALL SDL_SetTexturePalette(SDL_TextureID textureID,
   886                                                   const SDL_Color * colors,
   887                                                   int firstcolor,
   888                                                   int ncolors);
   889 
   890 /**
   891  * \fn int SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors, int firstcolor, int ncolors)
   892  *
   893  * \brief Update an indexed texture with a color palette
   894  *
   895  * \param texture The texture to update
   896  * \param colors The array to fill with RGB color data
   897  * \param firstcolor The first index to retrieve
   898  * \param ncolors The number of palette entries to retrieve
   899  *
   900  * \return 0 on success, or -1 if the texture is not valid or not an indexed texture
   901  */
   902 extern DECLSPEC int SDLCALL SDL_GetTexturePalette(SDL_TextureID textureID,
   903                                                   SDL_Color * colors,
   904                                                   int firstcolor,
   905                                                   int ncolors);
   906 
   907 /**
   908  * \fn int SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect *rect, const void *pixels, int pitch)
   909  *
   910  * \brief Update the given texture rectangle with new pixel data.
   911  *
   912  * \param texture The texture to update
   913  * \param rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
   914  * \param pixels The raw pixel data
   915  * \param pitch The number of bytes between rows of pixel data
   916  *
   917  * \return 0 on success, or -1 if the texture is not valid
   918  *
   919  * \note This is a very slow function for textures not created with SDL_TextureAccess_Local.
   920  */
   921 extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_TextureID textureID,
   922                                               const SDL_Rect * rect,
   923                                               const void *pixels, int pitch);
   924 
   925 /**
   926  * \fn void SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect *rect, int markDirty, void **pixels, int *pitch)
   927  *
   928  * \brief Lock a portion of the texture for pixel access.
   929  *
   930  * \param texture The texture to lock for access, which must have been created with SDL_TextureAccess_Local.
   931  * \param rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked.
   932  * \param markDirty If this is nonzero, the locked area will be marked dirty when the texture is unlocked.
   933  * \param pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area.
   934  * \param pitch This is filled in with the pitch of the locked pixels.
   935  *
   936  * \return 0 on success, or -1 if the texture is not valid or was created with SDL_TextureAccess_Remote
   937  *
   938  * \sa SDL_DirtyTexture()
   939  * \sa SDL_UnlockTexture()
   940  */
   941 extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_TextureID textureID,
   942                                             const SDL_Rect * rect,
   943                                             int markDirty, void **pixels,
   944                                             int *pitch);
   945 
   946 /**
   947  * \fn void SDL_UnlockTexture(SDL_TextureID textureID)
   948  *
   949  * \brief Unlock a texture, uploading the changes to video memory, if needed.
   950  *
   951  * \sa SDL_LockTexture()
   952  * \sa SDL_DirtyTexture()
   953  */
   954 extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_TextureID textureID);
   955 
   956 /**
   957  * \fn void SDL_DirtyTexture(SDL_TextureID textureID, int numrects, const SDL_Rect * rects)
   958  *
   959  * \brief Mark the specified rectangles of the texture as dirty.
   960  *
   961  * \note The texture must have been created with SDL_TextureAccess_Local.
   962  *
   963  * \sa SDL_LockTexture()
   964  * \sa SDL_UnlockTexture()
   965  */
   966 extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
   967                                               int numrects,
   968                                               const SDL_Rect * rects);
   969 
   970 /**
   971  * \fn void SDL_SelectRenderTexture(SDL_TextureID textureID)
   972  *
   973  * \brief Select a texture as the rendering target, or 0 to reselect the current window.
   974  *
   975  * \note The texture must have been created with SDL_TextureAccess_Render.
   976  */
   977 extern DECLSPEC void SDLCALL SDL_SelectRenderTexture(SDL_TextureID textureID);
   978 
   979 /**
   980  * \fn void SDL_RenderFill(const SDL_Rect *rect, Uint32 color)
   981  *
   982  * \brief Fill the current rendering target with the specified color.
   983  *
   984  * \param rect A pointer to the destination rectangle, or NULL for the entire rendering target.
   985  * \param color An ARGB color value.
   986  *
   987  * \return 0 on success, or -1 if there is no renderer current
   988  */
   989 extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect,
   990                                            Uint32 color);
   991 
   992 /**
   993  * \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect, Uint32 blendMode, Uint32 scaleMode)
   994  *
   995  * \brief Copy a portion of the texture to the current rendering target.
   996  *
   997  * \param texture The source texture.
   998  * \param srcrect A pointer to the source rectangle, or NULL for the entire texture.
   999  * \param dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
  1000  * \param blendMode SDL_TextureBlendMode to be used if the source texture has an alpha channel.
  1001  * \param scaleMode SDL_TextureScaleMode to be used if the source and destination rectangles don't have the same width and height.
  1002  *
  1003  * \return 0 on success, or -1 if there is no renderer current, or the driver doesn't support the requested operation.
  1004  *
  1005  * \note You can check the video driver info to see what operations are supported.
  1006  */
  1007 extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_TextureID textureID,
  1008                                            const SDL_Rect * srcrect,
  1009                                            const SDL_Rect * dstrect,
  1010                                            int blendMode, int scaleMode);
  1011 
  1012 /**
  1013  * \fn int SDL_RenderReadPixels(const SDL_Rect *rect, void *pixels, int pitch)
  1014  *
  1015  * \brief Read pixels from the current rendering target.
  1016  *
  1017  * \param rect A pointer to the rectangle to read, or NULL for the entire render target
  1018  * \param pixels A pointer to be filled in with the pixel data
  1019  * \param pitch The pitch of the pixels parameter
  1020  *
  1021  * \return 0 on success, or -1 if pixel reading is not supported.
  1022  *
  1023  * \warning This is a very slow operation, and should not be used frequently.
  1024  */
  1025 extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
  1026                                                  void *pixels, int pitch);
  1027 
  1028 /**
  1029  * \fn int SDL_RenderWritePixels(const SDL_Rect *rect, const void *pixels, int pitch)
  1030  *
  1031  * \brief Write pixels to the current rendering target.
  1032  *
  1033  * \param rect A pointer to the rectangle to write, or NULL for the entire render target
  1034  * \param pixels A pointer to the pixel data to write
  1035  * \param pitch The pitch of the pixels parameter
  1036  *
  1037  * \return 0 on success, or -1 if pixel writing is not supported.
  1038  *
  1039  * \warning This is a very slow operation, and should not be used frequently.
  1040  */
  1041 extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
  1042                                                   const void *pixels,
  1043                                                   int pitch);
  1044 
  1045 /**
  1046  * \fn void SDL_RenderPresent(void)
  1047  *
  1048  * \brief Update the screen with rendering performed.
  1049  */
  1050 extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
  1051 
  1052 /**
  1053  * \fn void SDL_DestroyTexture(SDL_TextureID textureID);
  1054  *
  1055  * \brief Destroy the specified texture.
  1056  *
  1057  * \sa SDL_CreateTexture()
  1058  * \sa SDL_CreateTextureFromSurface()
  1059  */
  1060 extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_TextureID textureID);
  1061 
  1062 /**
  1063  * \fn void SDL_DestroyRenderer(SDL_WindowID windowID);
  1064  *
  1065  * \brief Destroy the rendering context for a window and free associated
  1066  *        textures.
  1067  *
  1068  * \sa SDL_CreateRenderer()
  1069  */
  1070 extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_WindowID windowID);
  1071 
  1072 /*
  1073  * Set the gamma correction for each of the color channels.
  1074  * The gamma values range (approximately) between 0.1 and 10.0
  1075  * 
  1076  * If this function isn't supported directly by the hardware, it will
  1077  * be emulated using gamma ramps, if available.  If successful, this
  1078  * function returns 0, otherwise it returns -1.
  1079  */
  1080 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
  1081 
  1082 /*
  1083  * Set the gamma translation table for the red, green, and blue channels
  1084  * of the video hardware.  Each table is an array of 256 16-bit quantities,
  1085  * representing a mapping between the input and output for that channel.
  1086  * The input is the index into the array, and the output is the 16-bit
  1087  * gamma value at that index, scaled to the output color precision.
  1088  * 
  1089  * You may pass NULL for any of the channels to leave it unchanged.
  1090  * If the call succeeds, it will return 0.  If the display driver or
  1091  * hardware does not support gamma translation, or otherwise fails,
  1092  * this function will return -1.
  1093  */
  1094 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
  1095                                              const Uint16 * green,
  1096                                              const Uint16 * blue);
  1097 
  1098 /*
  1099  * Retrieve the current values of the gamma translation tables.
  1100  * 
  1101  * You must pass in valid pointers to arrays of 256 16-bit quantities.
  1102  * Any of the pointers may be NULL to ignore that channel.
  1103  * If the call succeeds, it will return 0.  If the display driver or
  1104  * hardware does not support gamma translation, or otherwise fails,
  1105  * this function will return -1.
  1106  */
  1107 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
  1108                                              Uint16 * blue);
  1109 
  1110 /*
  1111  * Maps an RGB triple to an opaque pixel value for a given pixel format
  1112  */
  1113 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
  1114     (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b);
  1115 
  1116 /*
  1117  * Maps an RGBA quadruple to a pixel value for a given pixel format
  1118  */
  1119 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat * format,
  1120                                            Uint8 r, Uint8 g, Uint8 b,
  1121                                            Uint8 a);
  1122 
  1123 /*
  1124  * Maps a pixel value into the RGB components for a given pixel format
  1125  */
  1126 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
  1127                                         Uint8 * r, Uint8 * g, Uint8 * b);
  1128 
  1129 /*
  1130  * Maps a pixel value into the RGBA components for a given pixel format
  1131  */
  1132 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
  1133                                          Uint8 * r, Uint8 * g, Uint8 * b,
  1134                                          Uint8 * a);
  1135 
  1136 /*
  1137  * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
  1138  * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
  1139  * If the depth is greater than 8 bits, the pixel format is set using the
  1140  * flags '[RGB]mask'.
  1141  * If the function runs out of memory, it will return NULL.
  1142  *
  1143  * The 'flags' tell what kind of surface to create.
  1144  * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
  1145  * SDL_SRCALPHA means that the surface will be used for alpha blits.
  1146  */
  1147 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
  1148     (Uint32 flags, int width, int height, int depth,
  1149      Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
  1150 extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
  1151                                                               int width,
  1152                                                               int height,
  1153                                                               int depth,
  1154                                                               int pitch,
  1155                                                               Uint32 Rmask,
  1156                                                               Uint32 Gmask,
  1157                                                               Uint32 Bmask,
  1158                                                               Uint32 Amask);
  1159 extern DECLSPEC SDL_Surface *SDLCALL
  1160 SDL_CreateRGBSurfaceFromTexture(SDL_TextureID textureID);
  1161 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
  1162 
  1163 /**
  1164  * \fn int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
  1165  *
  1166  * \brief Set the palette used by a surface.
  1167  *
  1168  * \return 0, or -1 if the surface format doesn't use a palette.
  1169  *
  1170  * \note A single palette can be shared with many surfaces.
  1171  */
  1172 extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
  1173                                                   SDL_Palette * palette);
  1174 
  1175 /*
  1176  * SDL_LockSurface() sets up a surface for directly accessing the pixels.
  1177  * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
  1178  * to and read from 'surface->pixels', using the pixel format stored in 
  1179  * 'surface->format'.  Once you are done accessing the surface, you should 
  1180  * use SDL_UnlockSurface() to release it.
  1181  *
  1182  * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
  1183  * to 0, then you can read and write to the surface at any time, and the
  1184  * pixel format of the surface will not change.
  1185  * 
  1186  * No operating system or library calls should be made between lock/unlock
  1187  * pairs, as critical system locks may be held during this time.
  1188  *
  1189  * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
  1190  */
  1191 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
  1192 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
  1193 
  1194 /*
  1195  * Load a surface from a seekable SDL data source (memory or file.)
  1196  * If 'freesrc' is non-zero, the source will be closed after being read.
  1197  * Returns the new surface, or NULL if there was an error.
  1198  * The new surface should be freed with SDL_FreeSurface().
  1199  */
  1200 extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
  1201                                                     int freesrc);
  1202 
  1203 /* Convenience macro -- load a surface from a file */
  1204 #define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
  1205 
  1206 /*
  1207  * Save a surface to a seekable SDL data source (memory or file.)
  1208  * If 'freedst' is non-zero, the source will be closed after being written.
  1209  * Returns 0 if successful or -1 if there was an error.
  1210  */
  1211 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
  1212     (SDL_Surface * surface, SDL_RWops * dst, int freedst);
  1213 
  1214 /* Convenience macro -- save a surface to a file */
  1215 #define SDL_SaveBMP(surface, file) \
  1216 		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
  1217 
  1218 /*
  1219  * Sets the color key (transparent pixel) in a blittable surface.
  1220  * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 
  1221  * 'key' will be the transparent pixel in the source image of a blit.
  1222  * SDL_RLEACCEL requests RLE acceleration for the surface if present,
  1223  * and removes RLE acceleration if absent.
  1224  * If 'flag' is 0, this function clears any current color key.
  1225  * This function returns 0, or -1 if there was an error.
  1226  */
  1227 extern DECLSPEC int SDLCALL SDL_SetColorKey
  1228     (SDL_Surface * surface, Uint32 flag, Uint32 key);
  1229 
  1230 /*
  1231  * This function sets the alpha value for the entire surface, as opposed to
  1232  * using the alpha component of each pixel. This value measures the range
  1233  * of transparency of the surface, 0 being completely transparent to 255
  1234  * being completely opaque. An 'alpha' value of 255 causes blits to be
  1235  * opaque, the source pixels copied to the destination (the default). Note
  1236  * that per-surface alpha can be combined with colorkey transparency.
  1237  *
  1238  * If 'flag' is 0, alpha blending is disabled for the surface.
  1239  * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
  1240  * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
  1241  * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
  1242  *
  1243  * The 'alpha' parameter is ignored for surfaces that have an alpha channel.
  1244  */
  1245 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag,
  1246                                          Uint8 alpha);
  1247 
  1248 /*
  1249  * Sets the clipping rectangle for the destination surface in a blit.
  1250  *
  1251  * If the clip rectangle is NULL, clipping will be disabled.
  1252  * If the clip rectangle doesn't intersect the surface, the function will
  1253  * return SDL_FALSE and blits will be completely clipped.  Otherwise the
  1254  * function returns SDL_TRUE and blits to the surface will be clipped to
  1255  * the intersection of the surface area and the clipping rectangle.
  1256  *
  1257  * Note that blits are automatically clipped to the edges of the source
  1258  * and destination surfaces.
  1259  */
  1260 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
  1261                                                  const SDL_Rect * rect);
  1262 
  1263 /*
  1264  * Gets the clipping rectangle for the destination surface in a blit.
  1265  * 'rect' must be a pointer to a valid rectangle which will be filled
  1266  * with the correct values.
  1267  */
  1268 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
  1269                                              SDL_Rect * rect);
  1270 
  1271 /*
  1272  * Creates a new surface of the specified format, and then copies and maps 
  1273  * the given surface to it so the blit of the converted surface will be as 
  1274  * fast as possible.  If this function fails, it returns NULL.
  1275  *
  1276  * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
  1277  * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
  1278  * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
  1279  * surface.
  1280  *
  1281  * This function is used internally by SDL_DisplayFormat().
  1282  */
  1283 extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
  1284     (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
  1285 
  1286 /*
  1287  * This function performs a fast fill of the given rectangle with 'color'
  1288  * The given rectangle is clipped to the destination surface clip area
  1289  * and the final fill rectangle is saved in the passed in pointer.
  1290  * If 'dstrect' is NULL, the whole surface will be filled with 'color'
  1291  * The color should be a pixel of the format used by the surface, and 
  1292  * can be generated by the SDL_MapRGB() function.
  1293  * This function returns 0 on success, or -1 on error.
  1294  */
  1295 extern DECLSPEC int SDLCALL SDL_FillRect
  1296     (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
  1297 
  1298 /*
  1299  * This performs a fast blit from the source surface to the destination
  1300  * surface.  It assumes that the source and destination rectangles are
  1301  * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
  1302  * surface (src or dst) is copied.  The final blit rectangles are saved
  1303  * in 'srcrect' and 'dstrect' after all clipping is performed.
  1304  * If the blit is successful, it returns 0, otherwise it returns -1.
  1305  *
  1306  * The blit function should not be called on a locked surface.
  1307  *
  1308  * The blit semantics for surfaces with and without alpha and colorkey
  1309  * are defined as follows:
  1310  *
  1311  * RGBA->RGB:
  1312  *     SDL_SRCALPHA set:
  1313  * 	alpha-blend (using alpha-channel).
  1314  * 	SDL_SRCCOLORKEY ignored.
  1315  *     SDL_SRCALPHA not set:
  1316  * 	copy RGB.
  1317  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1318  * 	RGB values of the source colour key, ignoring alpha in the
  1319  * 	comparison.
  1320  * 
  1321  * RGB->RGBA:
  1322  *     SDL_SRCALPHA set:
  1323  * 	alpha-blend (using the source per-surface alpha value);
  1324  * 	set destination alpha to opaque.
  1325  *     SDL_SRCALPHA not set:
  1326  * 	copy RGB, set destination alpha to source per-surface alpha value.
  1327  *     both:
  1328  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1329  * 	source colour key.
  1330  * 
  1331  * RGBA->RGBA:
  1332  *     SDL_SRCALPHA set:
  1333  * 	alpha-blend (using the source alpha channel) the RGB values;
  1334  * 	leave destination alpha untouched. [Note: is this correct?]
  1335  * 	SDL_SRCCOLORKEY ignored.
  1336  *     SDL_SRCALPHA not set:
  1337  * 	copy all of RGBA to the destination.
  1338  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1339  * 	RGB values of the source colour key, ignoring alpha in the
  1340  * 	comparison.
  1341  * 
  1342  * RGB->RGB: 
  1343  *     SDL_SRCALPHA set:
  1344  * 	alpha-blend (using the source per-surface alpha value).
  1345  *     SDL_SRCALPHA not set:
  1346  * 	copy RGB.
  1347  *     both:
  1348  * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
  1349  * 	source colour key.
  1350  *
  1351  * If either of the surfaces were in video memory, and the blit returns -2,
  1352  * the video memory was lost, so it should be reloaded with artwork and 
  1353  * re-blitted:
  1354 	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
  1355 		while ( SDL_LockSurface(image) < 0 )
  1356 			Sleep(10);
  1357 		-- Write image pixels to image->pixels --
  1358 		SDL_UnlockSurface(image);
  1359 	}
  1360  * This happens under DirectX 5.0 when the system switches away from your
  1361  * fullscreen application.  The lock will also fail until you have access
  1362  * to the video memory again.
  1363  */
  1364 /* You should call SDL_BlitSurface() unless you know exactly how SDL
  1365    blitting works internally and how to use the other blit functions.
  1366 */
  1367 #define SDL_BlitSurface SDL_UpperBlit
  1368 
  1369 /* This is the public blit function, SDL_BlitSurface(), and it performs
  1370    rectangle validation and clipping before passing it to SDL_LowerBlit()
  1371 */
  1372 extern DECLSPEC int SDLCALL SDL_UpperBlit
  1373     (SDL_Surface * src, SDL_Rect * srcrect,
  1374      SDL_Surface * dst, SDL_Rect * dstrect);
  1375 /* This is a semi-private blit function and it performs low-level surface
  1376    blitting only.
  1377 */
  1378 extern DECLSPEC int SDLCALL SDL_LowerBlit
  1379     (SDL_Surface * src, SDL_Rect * srcrect,
  1380      SDL_Surface * dst, SDL_Rect * dstrect);
  1381 
  1382 /**
  1383  * \fn int SDL_SoftStretch(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect)
  1384  *
  1385  * \brief Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
  1386  *
  1387  * \note This function uses a static buffer, and is not thread-safe.
  1388  */
  1389 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
  1390                                             SDL_Rect * srcrect,
  1391                                             SDL_Surface * dst,
  1392                                             SDL_Rect * dstrect);
  1393 
  1394 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1395 /* OpenGL support functions.                                                 */
  1396 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1397 
  1398 /**
  1399  * \fn int SDL_GL_LoadLibrary(const char *path)
  1400  *
  1401  * \brief Dynamically load an OpenGL library.
  1402  *
  1403  * \param path The platform dependent OpenGL library name, or NULL to open the default OpenGL library
  1404  *
  1405  * \return 0 on success, or -1 if the library couldn't be loaded
  1406  *
  1407  * \note If you do this, you need to retrieve all of the GL functions used in
  1408  *       your program from the dynamic library using SDL_GL_GetProcAddress().
  1409  *
  1410  * \sa SDL_GL_GetProcAddress()
  1411  */
  1412 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
  1413 
  1414 /**
  1415  * \fn void *SDL_GL_GetProcAddress(const char *proc)
  1416  *
  1417  * \brief Get the address of an OpenGL function.
  1418  */
  1419 extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
  1420 
  1421 /**
  1422  * \fn int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
  1423  *
  1424  * \brief Set an OpenGL window attribute before window creation.
  1425  */
  1426 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
  1427 
  1428 /**
  1429  * \fn int SDL_GL_GetWindowAttribute(SDL_WindowID windowID, SDL_GLattr attr, int *value)
  1430  *
  1431  * \brief Get the actual value for an OpenGL window attribute.
  1432  */
  1433 extern DECLSPEC int SDLCALL SDL_GL_GetWindowAttribute(SDL_WindowID windowID,
  1434                                                       SDL_GLattr attr,
  1435                                                       int *value);
  1436 
  1437 /**
  1438  * \fn SDL_GLContext SDL_GL_CreateContext(SDL_WindowID windowID)
  1439  *
  1440  * \brief Create an OpenGL context for use with an OpenGL window, and make it current.
  1441  *
  1442  * \sa SDL_GL_DeleteContext()
  1443  */
  1444 extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_WindowID
  1445                                                            windowID);
  1446 
  1447 /**
  1448  * \fn int SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
  1449  *
  1450  * \brief Set up an OpenGL context for rendering into an OpenGL window.
  1451  *
  1452  * \note The context must have been created with a compatible window.
  1453  */
  1454 extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_WindowID windowID,
  1455                                                SDL_GLContext context);
  1456 
  1457 /**
  1458  * \fn int SDL_GL_SetSwapInterval(int interval)
  1459  *
  1460  * \brief Set the swap interval for the current OpenGL context.
  1461  *
  1462  * \sa SDL_GL_GetSwapInterval()
  1463  */
  1464 extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval);
  1465 
  1466 /**
  1467  * \fn int SDL_GL_GetSwapInterval(void)
  1468  *
  1469  * \brief Get the swap interval for the current OpenGL context.
  1470  *
  1471  * \sa SDL_GL_SetSwapInterval()
  1472  */
  1473 extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void);
  1474 
  1475 /**
  1476  * \fn void SDL_GL_SwapBuffers(void)
  1477  *
  1478  * Swap the OpenGL buffers, if double-buffering is supported.
  1479  */
  1480 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
  1481 
  1482 /**
  1483  * \fn void SDL_GL_DeleteContext(SDL_GLContext context)
  1484  *
  1485  * \brief Delete an OpenGL context.
  1486  *
  1487  * \sa SDL_GL_CreateContext()
  1488  */
  1489 extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
  1490 
  1491 /*
  1492  * Calculate the intersection of two rectangles
  1493  */
  1494 extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
  1495                                                    const SDL_Rect * B,
  1496                                                    SDL_Rect * intersection);
  1497 
  1498 /* Ends C function definitions when using C++ */
  1499 #ifdef __cplusplus
  1500 /* *INDENT-OFF* */
  1501 }
  1502 /* *INDENT-ON* */
  1503 #endif
  1504 #include "close_code.h"
  1505 
  1506 #endif /* _SDL_video_h */
  1507 
  1508 /* vi: set ts=4 sw=4 expandtab: */