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