include/SDL_video.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 29 May 2006 05:08:33 +0000
branchSDL-1.3
changeset 1669 9857d21967bb
parent 1668 4da1ee79c9af
child 1670 eef792d31de8
permissions -rw-r--r--
The test programs compile again.
The dummy video driver is partially functional now.
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@0
    49
/* Useful data types */
slouken@1662
    50
typedef struct SDL_Rect
slouken@1662
    51
{
slouken@1662
    52
    Sint16 x, y;
slouken@1662
    53
    Uint16 w, h;
slouken@0
    54
} SDL_Rect;
slouken@0
    55
slouken@0
    56
/* This structure should be treated as read-only, except for 'pixels',
slouken@0
    57
   which, if not NULL, contains the raw pixel data for the surface.
slouken@0
    58
*/
slouken@1662
    59
typedef struct SDL_Surface
slouken@1662
    60
{
slouken@1662
    61
    Uint32 flags;               /* Read-only */
slouken@1662
    62
    SDL_PixelFormat *format;    /* Read-only */
slouken@1662
    63
    int w, h;                   /* Read-only */
slouken@1662
    64
    Uint16 pitch;               /* Read-only */
slouken@1662
    65
    void *pixels;               /* Read-write */
slouken@1662
    66
    int offset;                 /* Private */
slouken@0
    67
slouken@1662
    68
    /* Hardware-specific surface info */
slouken@1662
    69
    struct private_hwdata *hwdata;
slouken@0
    70
slouken@1662
    71
    /* clipping information */
slouken@1662
    72
    SDL_Rect clip_rect;         /* Read-only */
slouken@1662
    73
    Uint32 unused1;             /* for binary compatibility */
slouken@1662
    74
slouken@1662
    75
    /* Allow recursive locks */
slouken@1662
    76
    Uint32 locked;              /* Private */
slouken@0
    77
slouken@1662
    78
    /* info for fast blit mapping to other surfaces */
slouken@1662
    79
    struct SDL_BlitMap *map;    /* Private */
slouken@0
    80
slouken@1662
    81
    /* format version, bumped at every change to invalidate blit maps */
slouken@1662
    82
    unsigned int format_version;        /* Private */
slouken@0
    83
slouken@1662
    84
    /* Reference count -- used when freeing surface */
slouken@1662
    85
    int refcount;               /* Read-mostly */
slouken@1662
    86
} SDL_Surface;
slouken@0
    87
slouken@0
    88
/* The most common video overlay formats.
slouken@0
    89
   For an explanation of these pixel formats, see:
slouken@0
    90
	http://www.webartz.com/fourcc/indexyuv.htm
slouken@0
    91
slouken@0
    92
   For information on the relationship between color spaces, see:
slouken@0
    93
   http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
slouken@0
    94
 */
slouken@1662
    95
#define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
slouken@1662
    96
#define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
slouken@1662
    97
#define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
slouken@1662
    98
#define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
slouken@1662
    99
#define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
slouken@0
   100
slouken@0
   101
/* The YUV hardware video overlay */
slouken@1662
   102
typedef struct SDL_Overlay
slouken@1662
   103
{
slouken@1662
   104
    Uint32 format;              /* Read-only */
slouken@1662
   105
    int w, h;                   /* Read-only */
slouken@1662
   106
    int planes;                 /* Read-only */
slouken@1662
   107
    Uint16 *pitches;            /* Read-only */
slouken@1662
   108
    Uint8 **pixels;             /* Read-write */
slouken@0
   109
slouken@1662
   110
    /* Hardware-specific surface info */
slouken@1662
   111
    struct private_yuvhwfuncs *hwfuncs;
slouken@1662
   112
    struct private_yuvhwdata *hwdata;
slouken@0
   113
slouken@1662
   114
    /* Special flags */
slouken@1662
   115
    Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
slouken@1662
   116
    Uint32 UnusedBits:31;
slouken@0
   117
} SDL_Overlay;
slouken@0
   118
slouken@1662
   119
/* Evaluates to true if the surface needs to be locked before access */
slouken@1662
   120
#define SDL_MUSTLOCK(surface)	\
slouken@1662
   121
  (surface->offset ||		\
slouken@1662
   122
  ((surface->flags & (SDL_HWSURFACE|SDL_RLEACCEL)) != 0))
slouken@0
   123
slouken@1662
   124
/* typedef for private surface blitting functions */
slouken@1662
   125
typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
slouken@1662
   126
                         struct SDL_Surface * dst, SDL_Rect * dstrect);
slouken@1662
   127
slouken@1662
   128
slouken@1669
   129
/**
slouken@1669
   130
 * \struct SDL_VideoInfo
slouken@1669
   131
 *
slouken@1669
   132
 * \brief Useful for determining the video hardware capabilities
slouken@1669
   133
 */
slouken@1662
   134
typedef struct SDL_VideoInfo
slouken@1662
   135
{
slouken@1669
   136
    Uint32 hw_available:1;  /**< Flag: Can you create hardware surfaces? */
slouken@1669
   137
    Uint32 wm_available:1;  /**< Flag: Can you talk to a window manager? */
slouken@1662
   138
    Uint32 UnusedBits1:6;
slouken@1662
   139
    Uint32 UnusedBits2:1;
slouken@1669
   140
    Uint32 blit_hw:1;       /**< Flag: Accelerated blits HW --> HW */
slouken@1669
   141
    Uint32 blit_hw_CC:1;    /**< Flag: Accelerated blits with Colorkey */
slouken@1669
   142
    Uint32 blit_hw_A:1;     /**< Flag: Accelerated blits with Alpha */
slouken@1669
   143
    Uint32 blit_sw:1;       /**< Flag: Accelerated blits SW --> HW */
slouken@1669
   144
    Uint32 blit_sw_CC:1;    /**< Flag: Accelerated blits with Colorkey */
slouken@1669
   145
    Uint32 blit_sw_A:1;     /**< Flag: Accelerated blits with Alpha */
slouken@1669
   146
    Uint32 blit_fill:1;     /**< Flag: Accelerated color fill */
slouken@1662
   147
    Uint32 UnusedBits3:16;
slouken@1662
   148
    Uint32 video_mem;           /* The total amount of video memory (in K) */
slouken@1669
   149
slouken@1669
   150
    /* Here for backwards compatibility */
slouken@1669
   151
    SDL_PixelFormat *vfmt;
slouken@1662
   152
} SDL_VideoInfo;
slouken@1662
   153
slouken@1662
   154
/**
slouken@1662
   155
 * \struct SDL_DisplayMode
slouken@1662
   156
 *
slouken@1662
   157
 * \brief  The structure that defines a display mode
slouken@1662
   158
 *
slouken@1662
   159
 * \sa SDL_GetNumDisplayModes()
slouken@1662
   160
 * \sa SDL_GetDisplayMode()
slouken@1662
   161
 * \sa SDL_GetDesktopDisplayMode()
slouken@1662
   162
 * \sa SDL_GetCurrentDisplayMode()
slouken@1662
   163
 * \sa SDL_GetClosestDisplayMode()
slouken@1662
   164
 * \sa SDL_SetDisplayMode()
slouken@1662
   165
 */
slouken@1662
   166
typedef struct
slouken@1662
   167
{
slouken@1662
   168
    Uint32 format;              /**< pixel format */
slouken@1662
   169
    int w;                      /**< width */
slouken@1662
   170
    int h;                      /**< height */
slouken@1662
   171
    int refresh_rate;           /**< refresh rate (or zero for unspecified) */
slouken@1662
   172
} SDL_DisplayMode;
slouken@1662
   173
slouken@1662
   174
/**
slouken@1662
   175
 * \typedef SDL_WindowID
slouken@1662
   176
 *
slouken@1662
   177
 * \brief The type used to identify a window
slouken@1662
   178
 *
slouken@1662
   179
 * \sa SDL_CreateWindow()
slouken@1662
   180
 * \sa SDL_CreateWindowFrom()
slouken@1662
   181
 * \sa SDL_DestroyWindow()
slouken@1662
   182
 * \sa SDL_GetWindowData()
slouken@1662
   183
 * \sa SDL_GetWindowFlags()
slouken@1662
   184
 * \sa SDL_GetWindowGrab()
slouken@1662
   185
 * \sa SDL_GetWindowPosition()
slouken@1662
   186
 * \sa SDL_GetWindowSize()
slouken@1662
   187
 * \sa SDL_GetWindowTitle()
slouken@1662
   188
 * \sa SDL_HideWindow()
slouken@1662
   189
 * \sa SDL_MaximizeWindow()
slouken@1662
   190
 * \sa SDL_MinimizeWindow()
slouken@1662
   191
 * \sa SDL_RaiseWindow()
slouken@1662
   192
 * \sa SDL_RestoreWindow()
slouken@1662
   193
 * \sa SDL_SetWindowData()
slouken@1662
   194
 * \sa SDL_SetWindowGrab()
slouken@1662
   195
 * \sa SDL_SetWindowIcon()
slouken@1662
   196
 * \sa SDL_SetWindowPosition()
slouken@1662
   197
 * \sa SDL_SetWindowSize()
slouken@1662
   198
 * \sa SDL_SetWindowTitle()
slouken@1662
   199
 * \sa SDL_ShowWindow()
slouken@1662
   200
 */
slouken@1662
   201
typedef Uint32 SDL_WindowID;
slouken@1662
   202
slouken@1662
   203
/**
slouken@1662
   204
 * \enum SDL_WindowFlags
slouken@1662
   205
 *
slouken@1662
   206
 * \brief The flags on a window
slouken@1662
   207
 */
slouken@1662
   208
typedef enum
slouken@1662
   209
{
slouken@1662
   210
    SDL_WINDOW_FULLSCREEN = 0x00000001,         /**< fullscreen window, implies borderless */
slouken@1662
   211
    SDL_WINDOW_BORDERLESS = 0x00000002,         /**< no window decoration */
slouken@1662
   212
    SDL_WINDOW_SHOWN = 0x00000004,              /**< window is visible */
slouken@1662
   213
    SDL_WINDOW_OPENGL = 0x00000008,             /**< window usable with OpenGL context */
slouken@1662
   214
    SDL_WINDOW_RESIZABLE = 0x00000010,          /**< window can be resized */
slouken@1662
   215
    SDL_WINDOW_MAXIMIZED = 0x00000020,          /**< maximized */
slouken@1662
   216
    SDL_WINDOW_MINIMIZED = 0x00000040,          /**< minimized */
slouken@1662
   217
    SDL_WINDOW_INPUT_GRABBED = 0x00000080,      /**< window has grabbed input focus */
slouken@1662
   218
    SDL_WINDOW_KEYBOARD_FOCUS = 0x00000100,     /**< window has keyboard focus */
slouken@1662
   219
    SDL_WINDOW_MOUSE_FOCUS = 0x00000200,        /**< window has mouse focus */
slouken@1662
   220
} SDL_WindowFlags;
slouken@1662
   221
slouken@1662
   222
/**
slouken@1662
   223
 * \enum SDL_WindowEventID
slouken@1662
   224
 *
slouken@1662
   225
 * \brief Event subtype for window events
slouken@1662
   226
 */
slouken@1662
   227
typedef enum
slouken@1662
   228
{
slouken@1662
   229
    SDL_WINDOWEVENT_NONE,               /**< Never used */
slouken@1662
   230
    SDL_WINDOWEVENT_SHOWN,              /**< Window has been shown */
slouken@1662
   231
    SDL_WINDOWEVENT_HIDDEN,             /**< Window has been hidden */
slouken@1662
   232
    SDL_WINDOWEVENT_MOVED,              /**< Window has been moved to data1,data2 */
slouken@1662
   233
    SDL_WINDOWEVENT_RESIZED,            /**< Window size changed to data1xdata2 */
slouken@1662
   234
    SDL_WINDOWEVENT_MINIMIZED,          /**< Window has been minimized */
slouken@1662
   235
    SDL_WINDOWEVENT_MAXIMIZED,          /**< Window has been maximized */
slouken@1662
   236
    SDL_WINDOWEVENT_RESTORED,           /**< Window has been restored to normal size and position */
slouken@1662
   237
    SDL_WINDOWEVENT_ENTER,              /**< The window has gained mouse focus */
slouken@1662
   238
    SDL_WINDOWEVENT_LEAVE,              /**< The window has lost mouse focus */
slouken@1662
   239
    SDL_WINDOWEVENT_FOCUS_GAINED,       /**< The window has gained keyboard focus */
slouken@1662
   240
    SDL_WINDOWEVENT_FOCUS_LOST,         /**< The window has lost keyboard focus */
slouken@1662
   241
} SDL_WindowEventID;
slouken@1662
   242
slouken@1662
   243
/**
slouken@1662
   244
 * \enum SDL_GLattr
slouken@1662
   245
 *
slouken@1662
   246
 * \brief OpenGL configuration attributes
slouken@1662
   247
 */
slouken@1662
   248
typedef enum
slouken@1662
   249
{
slouken@0
   250
    SDL_GL_RED_SIZE,
slouken@0
   251
    SDL_GL_GREEN_SIZE,
slouken@0
   252
    SDL_GL_BLUE_SIZE,
slouken@0
   253
    SDL_GL_ALPHA_SIZE,
slouken@0
   254
    SDL_GL_BUFFER_SIZE,
slouken@0
   255
    SDL_GL_DOUBLEBUFFER,
slouken@0
   256
    SDL_GL_DEPTH_SIZE,
slouken@0
   257
    SDL_GL_STENCIL_SIZE,
slouken@0
   258
    SDL_GL_ACCUM_RED_SIZE,
slouken@0
   259
    SDL_GL_ACCUM_GREEN_SIZE,
slouken@0
   260
    SDL_GL_ACCUM_BLUE_SIZE,
slouken@450
   261
    SDL_GL_ACCUM_ALPHA_SIZE,
slouken@655
   262
    SDL_GL_STEREO,
slouken@656
   263
    SDL_GL_MULTISAMPLEBUFFERS,
slouken@1656
   264
    SDL_GL_MULTISAMPLESAMPLES,
slouken@1656
   265
    SDL_GL_ACCELERATED_VISUAL,
slouken@1656
   266
    SDL_GL_SWAP_CONTROL
slouken@0
   267
} SDL_GLattr;
slouken@0
   268
slouken@1662
   269
/* These are the currently supported flags for the SDL_surface */
slouken@1662
   270
#define SDL_SWSURFACE	0x00000000      /* Surface is in system memory */
slouken@1662
   271
#define SDL_HWSURFACE	0x00000001      /* Surface is in video memory */
slouken@1662
   272
/* Available for SDL_CreateWindowSurface() */
slouken@1662
   273
#define SDL_ANYFORMAT	0x10000000      /* Allow any video depth/pixel-format */
slouken@1662
   274
#define SDL_HWPALETTE	0x20000000      /* Surface has exclusive palette */
slouken@1662
   275
#define SDL_DOUBLEBUF	0x40000000      /* Set up double-buffered surface */
slouken@1662
   276
/* Used internally (read-only) */
slouken@1662
   277
#define SDL_HWACCEL	0x00000100      /* Blit uses hardware acceleration */
slouken@1662
   278
#define SDL_SRCCOLORKEY	0x00001000      /* Blit uses a source color key */
slouken@1662
   279
#define SDL_RLEACCELOK	0x00002000      /* Private flag */
slouken@1662
   280
#define SDL_RLEACCEL	0x00004000      /* Surface is RLE encoded */
slouken@1662
   281
#define SDL_SRCALPHA	0x00010000      /* Blit uses source alpha blending */
slouken@1662
   282
#define SDL_PREALLOC	0x00100000      /* Surface uses preallocated memory */
slouken@1662
   283
#define SDL_SCREEN_SURFACE 0x01000000   /* Surface is a window screen surface */
slouken@1662
   284
#define SDL_SHADOW_SURFACE 0x02000000   /* Surface is a window shadow surface */
slouken@0
   285
slouken@0
   286
/* Function prototypes */
slouken@0
   287
slouken@1662
   288
/**
slouken@1662
   289
 * \fn int SDL_GetNumVideoDrivers(void)
slouken@1662
   290
 *
slouken@1662
   291
 * \brief Get the number of video drivers compiled into SDL
slouken@1662
   292
 *
slouken@1662
   293
 * \sa SDL_GetVideoDriver()
slouken@1662
   294
 */
slouken@1668
   295
extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void);
slouken@1662
   296
slouken@1662
   297
/**
slouken@1662
   298
 * \fn const char *SDL_GetVideoDriver(int index)
slouken@1662
   299
 *
slouken@1662
   300
 * \brief Get the name of a built in video driver.
slouken@1662
   301
 *
slouken@1662
   302
 * \note The video drivers are presented in the order in which they are
slouken@1662
   303
 * normally checked during initialization.
slouken@1662
   304
 *
slouken@1662
   305
 * \sa SDL_GetNumVideoDrivers()
slouken@1660
   306
 */
slouken@1668
   307
extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index);
slouken@1660
   308
slouken@1662
   309
/**
slouken@1662
   310
 * \fn int SDL_VideoInit(const char *driver_name, Uint32 flags)
slouken@1662
   311
 *
slouken@1662
   312
 * \brief Initialize the video subsystem, optionally specifying a video driver.
slouken@1662
   313
 *
slouken@1662
   314
 * \param driver_name Initialize a specific driver by name, or NULL for the default video driver.
slouken@1662
   315
 * \param flags FIXME: Still needed?
slouken@1662
   316
 *
slouken@1662
   317
 * \return 0 on success, -1 on error
slouken@1662
   318
 *
slouken@1662
   319
 * This function initializes the video subsystem; setting up a connection
slouken@1662
   320
 * to the window manager, etc, and determines the available display modes
slouken@1662
   321
 * and pixel formats, but does not initialize a window or graphics mode.
slouken@1662
   322
 *
slouken@1662
   323
 * \sa SDL_VideoQuit()
slouken@1662
   324
 */
slouken@1668
   325
extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
slouken@1668
   326
                                          Uint32 flags);
slouken@1662
   327
slouken@1662
   328
/**
slouken@1662
   329
 * \fn void SDL_VideoQuit(void)
slouken@1662
   330
 *
slouken@1662
   331
 * \brief Shuts down the video subsystem.
slouken@1662
   332
 *
slouken@1662
   333
 * This function closes all windows, and restores the original video mode.
slouken@0
   334
 *
slouken@1662
   335
 * \sa SDL_VideoInit()
slouken@1662
   336
 */
slouken@1668
   337
extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
slouken@1662
   338
slouken@1662
   339
/**
slouken@1662
   340
 * \fn const char *SDL_GetCurrentVideoDriver(void)
slouken@1662
   341
 *
slouken@1662
   342
 * \brief Returns the name of the currently initialized video driver.
slouken@1662
   343
 *
slouken@1662
   344
 * \return The name of the current video driver or NULL if no driver
slouken@1662
   345
 *         has been initialized
slouken@1662
   346
 *
slouken@1662
   347
 * \sa SDL_GetNumVideoDrivers()
slouken@1662
   348
 * \sa SDL_GetVideoDriver()
slouken@1662
   349
 */
slouken@1668
   350
extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void);
slouken@1662
   351
slouken@1662
   352
/**
slouken@1662
   353
 * \fn const SDL_VideoInfo *SDL_GetVideoInfo(void)
slouken@1662
   354
 *
slouken@1662
   355
 * \brief Returns information about the currently initialized video driver.
slouken@0
   356
 *
slouken@1662
   357
 * \return A read-only pointer to information about the video hardware,
slouken@1662
   358
 *         or NULL if no video driver has been initialized.
slouken@1662
   359
 */
slouken@1668
   360
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
slouken@1662
   361
slouken@1662
   362
/**
slouken@1662
   363
 * \fn int SDL_GetNumVideoDisplays(void)
slouken@1662
   364
 *
slouken@1662
   365
 * \brief Returns the number of available video displays.
slouken@1662
   366
 *
slouken@1662
   367
 * \sa SDL_SelectVideoDisplay()
slouken@0
   368
 */
slouken@1668
   369
extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void);
slouken@0
   370
slouken@1662
   371
/**
slouken@1662
   372
 * \fn int SDL_SelectVideoDisplay(int index)
slouken@1662
   373
 *
slouken@1662
   374
 * \brief Set the index of the currently selected display.
slouken@1662
   375
 *
slouken@1662
   376
 * \note You can query the currently selected display by passing an index of -1.
slouken@1662
   377
 *
slouken@1662
   378
 * \sa SDL_GetNumVideoDisplays()
slouken@0
   379
 */
slouken@1668
   380
extern DECLSPEC int SDLCALL SDL_SelectVideoDisplay(int index);
slouken@0
   381
slouken@1662
   382
/**
slouken@1662
   383
 * \fn int SDL_GetNumDisplayModes(void)
slouken@1662
   384
 *
slouken@1662
   385
 * \brief Returns the number of available display modes for the current display.
slouken@1662
   386
 *
slouken@1662
   387
 * \sa SDL_GetDisplayMode()
slouken@0
   388
 */
slouken@1668
   389
extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(void);
slouken@0
   390
slouken@1662
   391
/**
slouken@1662
   392
 * \fn const SDL_DisplayMode *SDL_GetDisplayMode(int index)
slouken@1662
   393
 *
slouken@1662
   394
 * \brief Retrieve information about a specific display mode.
slouken@1662
   395
 *
slouken@1662
   396
 * \note The display modes are sorted in this priority:
slouken@1662
   397
 *       \li bits per pixel -> more colors to fewer colors
slouken@1662
   398
 *       \li width -> largest to smallest
slouken@1662
   399
 *       \li height -> largest to smallest
slouken@1662
   400
 *       \li refresh rate -> highest to lowest
slouken@1662
   401
 *
slouken@1662
   402
 * \sa SDL_GetNumDisplayModes()
slouken@0
   403
 */
slouken@1668
   404
extern DECLSPEC const SDL_DisplayMode *SDLCALL SDL_GetDisplayMode(int index);
slouken@1662
   405
slouken@1662
   406
/**
slouken@1662
   407
 * \fn const SDL_DisplayMode *SDL_GetDesktopDisplayMode(void)
slouken@1662
   408
 *
slouken@1662
   409
 * \brief Retrieve information about the desktop display mode for the current display.
slouken@1662
   410
 */
slouken@1662
   411
extern DECLSPEC const SDL_DisplayMode *SDLCALL
slouken@1668
   412
SDL_GetDesktopDisplayMode(void);
slouken@1662
   413
slouken@1662
   414
/**
slouken@1662
   415
 * \fn const SDL_DisplayMode *SDL_GetCurrentDisplayMode(void)
slouken@1662
   416
 *
slouken@1662
   417
 * \brief Retrieve information about the current display mode.
slouken@1662
   418
 */
slouken@1662
   419
extern DECLSPEC const SDL_DisplayMode *SDLCALL
slouken@1668
   420
SDL_GetCurrentDisplayMode(void);
slouken@0
   421
slouken@1662
   422
/**
slouken@1662
   423
 * \fn SDL_DisplayMode *SDL_GetClosestDisplayMode(const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
slouken@1662
   424
 *
slouken@1662
   425
 * \brief Get the closest match to the requested display mode.
slouken@1662
   426
 *
slouken@1662
   427
 * \param mode The desired display mode
slouken@1662
   428
 * \param closest A pointer to a display mode to be filled in with the closest match of the available display modes.
slouken@1662
   429
 *
slouken@1662
   430
 * \return The passed in value 'closest', or NULL if no matching video mode was available.
slouken@1662
   431
 *
slouken@1662
   432
 * 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
   433
 *
slouken@1662
   434
 * \sa SDL_GetNumDisplayModes()
slouken@1662
   435
 * \sa SDL_GetDisplayMode()
slouken@1662
   436
 */
slouken@1668
   437
extern DECLSPEC SDL_DisplayMode *SDLCALL SDL_GetClosestDisplayMode(const
slouken@1668
   438
                                                                   SDL_DisplayMode
slouken@1668
   439
                                                                   * mode,
slouken@1668
   440
                                                                   SDL_DisplayMode
slouken@1668
   441
                                                                   * closest);
slouken@1662
   442
slouken@1662
   443
/**
slouken@1662
   444
 * \fn int SDL_SetDisplayMode(const SDL_DisplayMode *mode)
slouken@1662
   445
 *
slouken@1662
   446
 * \brief Set up the closest available mode on the current display.
slouken@1662
   447
 *
slouken@1662
   448
 * \param mode The desired display mode
slouken@0
   449
 *
slouken@1662
   450
 * \return 0 on success, or -1 if setting the display mode failed.
slouken@0
   451
 */
slouken@1668
   452
extern DECLSPEC int SDLCALL SDL_SetDisplayMode(const SDL_DisplayMode * mode);
slouken@0
   453
slouken@1662
   454
/**
slouken@1662
   455
 * \fn SDL_WindowID SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
slouken@1662
   456
 *
slouken@1662
   457
 * \brief Create a window with the specified position, dimensions, and flags.
slouken@1662
   458
 *
slouken@1662
   459
 * \param title The title of the window
slouken@1662
   460
 * \param x The x position of the window
slouken@1662
   461
 * \param y The y position of the window
slouken@1662
   462
 * \param w The width of the window
slouken@1662
   463
 * \param h The height of the window
slouken@1662
   464
 * \param flags The flags for the window
slouken@1662
   465
 *
slouken@1662
   466
 * \return The id of the window created, or zero if window creation failed.
slouken@1662
   467
 *
slouken@1662
   468
 * \note Setting the position to -1, -1, indicates any position is fine.
slouken@1662
   469
 *
slouken@1662
   470
 * \sa SDL_DestroyWindow()
slouken@1662
   471
 */
slouken@1668
   472
extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindow(const char *title,
slouken@1668
   473
                                                      int x, int y, int w,
slouken@1668
   474
                                                      int h, Uint32 flags);
slouken@1662
   475
slouken@1662
   476
/**
slouken@1662
   477
 * \fn SDL_WindowID SDL_CreateWindowFrom(void *data)
slouken@1662
   478
 *
slouken@1662
   479
 * \brief Create an SDL window struct from an existing native window.
slouken@1662
   480
 *
slouken@1662
   481
 * \param data A pointer to driver-dependent window creation data
slouken@1662
   482
 *
slouken@1662
   483
 * \return The id of the window created, or zero if window creation failed.
slouken@0
   484
 *
slouken@1662
   485
 * \warning This function is NOT SUPPORTED, use at your own risk!
slouken@1662
   486
 *
slouken@1662
   487
 * \sa SDL_DestroyWindow()
slouken@1662
   488
 */
slouken@1668
   489
extern DECLSPEC SDL_WindowID SDLCALL SDL_CreateWindowFrom(void *data);
slouken@1662
   490
slouken@1662
   491
/**
slouken@1662
   492
 * \fn Uint32 SDL_GetWindowFlags(SDL_WindowID windowID)
slouken@1662
   493
 *
slouken@1662
   494
 * \brief Get the window flags.
slouken@0
   495
 */
slouken@1668
   496
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_WindowID windowID);
slouken@1662
   497
slouken@1662
   498
/**
slouken@1662
   499
 * \fn void SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
slouken@1662
   500
 *
slouken@1662
   501
 * \brief Set the title of the window, in UTF-8 format.
slouken@1662
   502
 *
slouken@1662
   503
 * \sa SDL_GetWindowTitle()
slouken@1662
   504
 */
slouken@1668
   505
extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_WindowID windowID,
slouken@1668
   506
                                                const char *title);
slouken@0
   507
slouken@1662
   508
/**
slouken@1662
   509
 * \fn const char *SDL_GetWindowTitle(SDL_WindowID windowID)
slouken@1662
   510
 *
slouken@1662
   511
 * \brief Get the title of the window, in UTF-8 format.
slouken@0
   512
 *
slouken@1662
   513
 * \sa SDL_SetWindowTitle()
slouken@1662
   514
 */
slouken@1668
   515
extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_WindowID windowID);
slouken@1662
   516
slouken@1662
   517
/**
slouken@1662
   518
 * \fn void SDL_SetWindowIcon(SDL_Surface *icon)
slouken@0
   519
 *
slouken@1662
   520
 * \brief Set the icon of the window.
slouken@1662
   521
 *
slouken@1662
   522
 * \param icon The icon for the window
slouken@1662
   523
 *
slouken@1662
   524
 * 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
   525
 */
slouken@1668
   526
extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Surface * icon);
slouken@1662
   527
slouken@1662
   528
/**
slouken@1662
   529
 * \fn void SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
slouken@1662
   530
 *
slouken@1662
   531
 * \brief Associate an arbitrary pointer with the window.
slouken@0
   532
 *
slouken@1662
   533
 * \sa SDL_GetWindowData()
slouken@1662
   534
 */
slouken@1668
   535
extern DECLSPEC void SDLCALL SDL_SetWindowData(SDL_WindowID windowID,
slouken@1668
   536
                                               void *userdata);
slouken@1662
   537
slouken@1662
   538
/**
slouken@1662
   539
 * \fn void *SDL_GetWindowData(SDL_WindowID windowID)
slouken@0
   540
 *
slouken@1662
   541
 * \brief Retrieve the data pointer associated with the window.
slouken@1662
   542
 *
slouken@1662
   543
 * \sa SDL_SetWindowData()
slouken@1662
   544
 */
slouken@1668
   545
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_WindowID windowID);
slouken@1662
   546
slouken@1662
   547
/**
slouken@1662
   548
 * \fn void SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
slouken@1662
   549
 *
slouken@1662
   550
 * \brief Set the position of the window.
slouken@0
   551
 *
slouken@1662
   552
 * \sa SDL_GetWindowPosition()
slouken@1662
   553
 */
slouken@1668
   554
extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_WindowID windowID,
slouken@1668
   555
                                                   int x, int y);
slouken@1662
   556
slouken@1662
   557
/**
slouken@1662
   558
 * \fn void SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
slouken@1662
   559
 *
slouken@1662
   560
 * \brief Get the position of the window.
slouken@1662
   561
 *
slouken@1662
   562
 * \sa SDL_SetWindowPosition()
slouken@1662
   563
 */
slouken@1668
   564
extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_WindowID windowID,
slouken@1668
   565
                                                   int *x, int *y);
slouken@1662
   566
slouken@1662
   567
/**
slouken@1662
   568
 * \fn void SDL_SetWindowSize(SDL_WindowID windowID, int w, int w)
slouken@1662
   569
 *
slouken@1662
   570
 * \brief Set the size of the window's client area.
slouken@1662
   571
 *
slouken@1662
   572
 * \note You can't change the size of a fullscreen window, it automatically
slouken@1662
   573
 * matches the size of the display mode.
slouken@1662
   574
 *
slouken@1662
   575
 * \sa SDL_GetWindowSize()
slouken@1662
   576
 */
slouken@1668
   577
extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_WindowID windowID, int w,
slouken@1668
   578
                                               int h);
slouken@1662
   579
slouken@1662
   580
/**
slouken@1662
   581
 * \fn void SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *w)
slouken@0
   582
 *
slouken@1662
   583
 * \brief Get the size of the window's client area.
slouken@1662
   584
 *
slouken@1662
   585
 * \sa SDL_SetWindowSize()
slouken@1662
   586
 */
slouken@1668
   587
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_WindowID windowID, int *w,
slouken@1668
   588
                                               int *h);
slouken@1662
   589
slouken@1662
   590
/**
slouken@1662
   591
 * \fn void SDL_ShowWindow(SDL_WindowID windowID)
slouken@1662
   592
 *
slouken@1662
   593
 * \brief Show the window
slouken@1662
   594
 *
slouken@1662
   595
 * \sa SDL_HideWindow()
slouken@1662
   596
 */
slouken@1668
   597
extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_WindowID windowID);
slouken@1662
   598
slouken@1662
   599
/**
slouken@1662
   600
 * \fn void SDL_HideWindow(SDL_WindowID windowID)
slouken@1662
   601
 *
slouken@1662
   602
 * \brief Hide the window
slouken@0
   603
 *
slouken@1662
   604
 * \sa SDL_ShowWindow()
slouken@1662
   605
 */
slouken@1668
   606
extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_WindowID windowID);
slouken@1662
   607
slouken@1662
   608
/**
slouken@1662
   609
 * \fn void SDL_RaiseWindow(SDL_WindowID windowID)
slouken@1662
   610
 *
slouken@1662
   611
 * \brief Raise the window so it's above other windows.
slouken@1662
   612
 */
slouken@1668
   613
extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_WindowID windowID);
slouken@1662
   614
slouken@1662
   615
/**
slouken@1662
   616
 * \fn void SDL_MaximizeWindow(SDL_WindowID windowID)
slouken@1662
   617
 *
slouken@1662
   618
 * \brief Make the window as large as possible.
slouken@1662
   619
 *
slouken@1662
   620
 * \sa SDL_RestoreWindow()
slouken@1662
   621
 */
slouken@1668
   622
extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_WindowID windowID);
slouken@1662
   623
slouken@1662
   624
/**
slouken@1662
   625
 * \fn void SDL_MinimizeWindow(SDL_WindowID windowID)
slouken@1662
   626
 *
slouken@1662
   627
 * \brief Minimize the window to an iconic representation.
slouken@0
   628
 *
slouken@1662
   629
 * \sa SDL_RestoreWindow()
slouken@1662
   630
 */
slouken@1668
   631
extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_WindowID windowID);
slouken@1662
   632
slouken@1662
   633
/**
slouken@1662
   634
 * \fn void SDL_RestoreWindow(SDL_WindowID windowID)
slouken@1662
   635
 *
slouken@1662
   636
 * \brief Restore the size and position of a minimized or maximized window.
slouken@0
   637
 *
slouken@1662
   638
 * \sa SDL_MaximizeWindow()
slouken@1662
   639
 * \sa SDL_MinimizeWindow()
slouken@1662
   640
 */
slouken@1668
   641
extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_WindowID windowID);
slouken@1662
   642
slouken@1662
   643
/**
slouken@1662
   644
 * \fn void SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
slouken@1662
   645
 *
slouken@1662
   646
 * \brief Set the window's input grab mode.
slouken@1662
   647
 *
slouken@1662
   648
 * \param mode This is 1 to grab input, and 0 to release input.
slouken@0
   649
 *
slouken@1662
   650
 * \sa SDL_GrabMode
slouken@1662
   651
 * \sa SDL_GetWindowGrab()
slouken@1662
   652
 */
slouken@1668
   653
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_WindowID windowID,
slouken@1668
   654
                                               int mode);
slouken@1662
   655
slouken@1662
   656
/**
slouken@1662
   657
 * \fn int SDL_GetWindowGrab(SDL_WindowID windowID)
slouken@1662
   658
 *
slouken@1662
   659
 * \brief Get the window's input grab mode.
slouken@1662
   660
 *
slouken@1662
   661
 * \return This returns 1 if input is grabbed, and 0 otherwise.
slouken@0
   662
 *
slouken@1662
   663
 * \sa SDL_GrabMode
slouken@1662
   664
 * \sa SDL_SetWindowGrab()
slouken@1662
   665
 */
slouken@1668
   666
extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_WindowID windowID);
slouken@1662
   667
slouken@1662
   668
/**
slouken@1662
   669
 * \fn void SDL_DestroyWindow(SDL_WindowID windowID)
slouken@1662
   670
 *
slouken@1662
   671
 * \brief Destroy a window.
slouken@0
   672
 */
slouken@1668
   673
extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_WindowID windowID);
slouken@1662
   674
slouken@1662
   675
/**
slouken@1662
   676
 * \fn SDL_Surface *SDL_CreateWindowSurface (SDL_WindowID windowID, Uint32 format, Uint32 flags)
slouken@1662
   677
 *
slouken@1662
   678
 * \brief Create an SDL_Surface representing the drawing area of the window.
slouken@1662
   679
 */
slouken@1668
   680
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateWindowSurface(SDL_WindowID
slouken@1668
   681
                                                             windowID,
slouken@1668
   682
                                                             Uint32 format,
slouken@1668
   683
                                                             Uint32 flags);
slouken@0
   684
slouken@0
   685
/*
slouken@0
   686
 * Makes sure the given list of rectangles is updated on the given screen.
slouken@0
   687
 * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
slouken@0
   688
 * screen.
slouken@0
   689
 * These functions should not be called while 'screen' is locked.
slouken@0
   690
 */
slouken@337
   691
extern DECLSPEC void SDLCALL SDL_UpdateRects
slouken@1662
   692
    (SDL_Surface * screen, int numrects, SDL_Rect * rects);
slouken@337
   693
extern DECLSPEC void SDLCALL SDL_UpdateRect
slouken@1662
   694
    (SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
slouken@0
   695
slouken@0
   696
/*
slouken@0
   697
 * On hardware that supports double-buffering, this function sets up a flip
slouken@0
   698
 * and returns.  The hardware will wait for vertical retrace, and then swap
slouken@0
   699
 * video buffers before the next video surface blit or lock will return.
slouken@0
   700
 * On hardware that doesn not support double-buffering, this is equivalent
slouken@0
   701
 * to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
slouken@0
   702
 * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
slouken@0
   703
 * setting the video mode for this function to perform hardware flipping.
slouken@0
   704
 * This function returns 0 if successful, or -1 if there was an error.
slouken@0
   705
 */
slouken@1668
   706
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
slouken@0
   707
slouken@0
   708
/*
slouken@0
   709
 * Set the gamma correction for each of the color channels.
slouken@0
   710
 * The gamma values range (approximately) between 0.1 and 10.0
slouken@0
   711
 * 
slouken@0
   712
 * If this function isn't supported directly by the hardware, it will
slouken@0
   713
 * be emulated using gamma ramps, if available.  If successful, this
slouken@0
   714
 * function returns 0, otherwise it returns -1.
slouken@0
   715
 */
slouken@1668
   716
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
slouken@0
   717
slouken@0
   718
/*
slouken@0
   719
 * Set the gamma translation table for the red, green, and blue channels
slouken@0
   720
 * of the video hardware.  Each table is an array of 256 16-bit quantities,
slouken@0
   721
 * representing a mapping between the input and output for that channel.
slouken@0
   722
 * The input is the index into the array, and the output is the 16-bit
slouken@0
   723
 * gamma value at that index, scaled to the output color precision.
slouken@0
   724
 * 
slouken@0
   725
 * You may pass NULL for any of the channels to leave it unchanged.
slouken@0
   726
 * If the call succeeds, it will return 0.  If the display driver or
slouken@0
   727
 * hardware does not support gamma translation, or otherwise fails,
slouken@0
   728
 * this function will return -1.
slouken@0
   729
 */
slouken@1668
   730
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
slouken@1668
   731
                                             const Uint16 * green,
slouken@1668
   732
                                             const Uint16 * blue);
slouken@0
   733
slouken@0
   734
/*
slouken@0
   735
 * Retrieve the current values of the gamma translation tables.
slouken@0
   736
 * 
slouken@0
   737
 * You must pass in valid pointers to arrays of 256 16-bit quantities.
slouken@0
   738
 * Any of the pointers may be NULL to ignore that channel.
slouken@0
   739
 * If the call succeeds, it will return 0.  If the display driver or
slouken@0
   740
 * hardware does not support gamma translation, or otherwise fails,
slouken@0
   741
 * this function will return -1.
slouken@0
   742
 */
slouken@1668
   743
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
slouken@1668
   744
                                             Uint16 * blue);
slouken@0
   745
slouken@0
   746
/*
slouken@0
   747
 * Sets a portion of the colormap for the given 8-bit surface.  If 'surface'
slouken@0
   748
 * is not a palettized surface, this function does nothing, returning 0.
slouken@0
   749
 * If all of the colors were set as passed to SDL_SetColors(), it will
slouken@0
   750
 * return 1.  If not all the color entries were set exactly as given,
slouken@0
   751
 * it will return 0, and you should look at the surface palette to
slouken@0
   752
 * determine the actual color palette.
slouken@0
   753
 *
slouken@0
   754
 * When 'surface' is the surface associated with the current display, the
slouken@0
   755
 * display colormap will be updated with the requested colors.  If 
slouken@0
   756
 * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
slouken@0
   757
 * will always return 1, and the palette is guaranteed to be set the way
slouken@0
   758
 * you desire, even if the window colormap has to be warped or run under
slouken@0
   759
 * emulation.
slouken@0
   760
 */
slouken@1668
   761
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
slouken@1668
   762
                                          SDL_Color * colors, int firstcolor,
slouken@1668
   763
                                          int ncolors);
slouken@0
   764
slouken@0
   765
/*
slouken@0
   766
 * Maps an RGB triple to an opaque pixel value for a given pixel format
slouken@0
   767
 */
slouken@337
   768
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
slouken@1662
   769
    (SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b);
slouken@0
   770
slouken@0
   771
/*
slouken@0
   772
 * Maps an RGBA quadruple to a pixel value for a given pixel format
slouken@0
   773
 */
slouken@1668
   774
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat * format,
slouken@1668
   775
                                           Uint8 r, Uint8 g, Uint8 b,
slouken@1668
   776
                                           Uint8 a);
slouken@0
   777
slouken@0
   778
/*
slouken@0
   779
 * Maps a pixel value into the RGB components for a given pixel format
slouken@0
   780
 */
slouken@1668
   781
extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat * fmt,
slouken@1668
   782
                                        Uint8 * r, Uint8 * g, Uint8 * b);
slouken@0
   783
slouken@0
   784
/*
slouken@0
   785
 * Maps a pixel value into the RGBA components for a given pixel format
slouken@0
   786
 */
slouken@1668
   787
extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat * fmt,
slouken@1668
   788
                                         Uint8 * r, Uint8 * g, Uint8 * b,
slouken@1668
   789
                                         Uint8 * a);
slouken@0
   790
slouken@0
   791
/*
slouken@0
   792
 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
slouken@0
   793
 * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
slouken@0
   794
 * If the depth is greater than 8 bits, the pixel format is set using the
slouken@0
   795
 * flags '[RGB]mask'.
slouken@0
   796
 * If the function runs out of memory, it will return NULL.
slouken@0
   797
 *
slouken@0
   798
 * The 'flags' tell what kind of surface to create.
slouken@0
   799
 * SDL_SWSURFACE means that the surface should be created in system memory.
slouken@0
   800
 * SDL_HWSURFACE means that the surface should be created in video memory,
slouken@0
   801
 * with the same format as the display surface.  This is useful for surfaces
slouken@0
   802
 * that will not change much, to take advantage of hardware acceleration
slouken@0
   803
 * when being blitted to the display surface.
slouken@0
   804
 * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
slouken@0
   805
 * this surface, but you must always lock it before accessing the pixels.
slouken@0
   806
 * SDL will wait for current blits to finish before returning from the lock.
slouken@0
   807
 * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
slouken@0
   808
 * If the hardware supports acceleration of colorkey blits between
slouken@0
   809
 * two surfaces in video memory, SDL will try to place the surface in
slouken@0
   810
 * video memory. If this isn't possible or if there is no hardware
slouken@0
   811
 * acceleration available, the surface will be placed in system memory.
slouken@0
   812
 * SDL_SRCALPHA means that the surface will be used for alpha blits and 
slouken@0
   813
 * if the hardware supports hardware acceleration of alpha blits between
slouken@0
   814
 * two surfaces in video memory, to place the surface in video memory
slouken@0
   815
 * if possible, otherwise it will be placed in system memory.
slouken@0
   816
 * If the surface is created in video memory, blits will be _much_ faster,
slouken@0
   817
 * but the surface format must be identical to the video surface format,
slouken@0
   818
 * and the only way to access the pixels member of the surface is to use
slouken@0
   819
 * the SDL_LockSurface() and SDL_UnlockSurface() calls.
slouken@0
   820
 * If the requested surface actually resides in video memory, SDL_HWSURFACE
slouken@0
   821
 * will be set in the flags member of the returned surface.  If for some
slouken@0
   822
 * reason the surface could not be placed in video memory, it will not have
slouken@0
   823
 * the SDL_HWSURFACE flag set, and will be created in system memory instead.
slouken@0
   824
 */
slouken@0
   825
#define SDL_AllocSurface    SDL_CreateRGBSurface
slouken@1662
   826
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
slouken@1662
   827
    (Uint32 flags, int width, int height, int depth,
slouken@1662
   828
     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
slouken@1668
   829
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
slouken@1668
   830
                                                              int width,
slouken@1668
   831
                                                              int height,
slouken@1668
   832
                                                              int depth,
slouken@1668
   833
                                                              int pitch,
slouken@1668
   834
                                                              Uint32 Rmask,
slouken@1668
   835
                                                              Uint32 Gmask,
slouken@1668
   836
                                                              Uint32 Bmask,
slouken@1668
   837
                                                              Uint32 Amask);
slouken@1668
   838
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
slouken@0
   839
slouken@0
   840
/*
slouken@0
   841
 * SDL_LockSurface() sets up a surface for directly accessing the pixels.
slouken@0
   842
 * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
slouken@0
   843
 * to and read from 'surface->pixels', using the pixel format stored in 
slouken@0
   844
 * 'surface->format'.  Once you are done accessing the surface, you should 
slouken@0
   845
 * use SDL_UnlockSurface() to release it.
slouken@0
   846
 *
slouken@0
   847
 * Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
slouken@0
   848
 * to 0, then you can read and write to the surface at any time, and the
slouken@0
   849
 * pixel format of the surface will not change.  In particular, if the
slouken@0
   850
 * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
slouken@0
   851
 * will not need to lock the display surface before accessing it.
slouken@0
   852
 * 
slouken@0
   853
 * No operating system or library calls should be made between lock/unlock
slouken@0
   854
 * pairs, as critical system locks may be held during this time.
slouken@0
   855
 *
slouken@0
   856
 * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
slouken@0
   857
 */
slouken@1668
   858
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
slouken@1668
   859
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
slouken@0
   860
slouken@0
   861
/*
slouken@0
   862
 * Load a surface from a seekable SDL data source (memory or file.)
slouken@0
   863
 * If 'freesrc' is non-zero, the source will be closed after being read.
slouken@0
   864
 * Returns the new surface, or NULL if there was an error.
slouken@0
   865
 * The new surface should be freed with SDL_FreeSurface().
slouken@0
   866
 */
slouken@1668
   867
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
slouken@1668
   868
                                                    int freesrc);
slouken@0
   869
slouken@0
   870
/* Convenience macro -- load a surface from a file */
slouken@0
   871
#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
slouken@0
   872
slouken@0
   873
/*
slouken@0
   874
 * Save a surface to a seekable SDL data source (memory or file.)
slouken@0
   875
 * If 'freedst' is non-zero, the source will be closed after being written.
slouken@0
   876
 * Returns 0 if successful or -1 if there was an error.
slouken@0
   877
 */
slouken@337
   878
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
slouken@1662
   879
    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
slouken@0
   880
slouken@0
   881
/* Convenience macro -- save a surface to a file */
slouken@0
   882
#define SDL_SaveBMP(surface, file) \
slouken@0
   883
		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
slouken@0
   884
slouken@0
   885
/*
slouken@0
   886
 * Sets the color key (transparent pixel) in a blittable surface.
slouken@0
   887
 * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), 
slouken@0
   888
 * 'key' will be the transparent pixel in the source image of a blit.
slouken@0
   889
 * SDL_RLEACCEL requests RLE acceleration for the surface if present,
slouken@0
   890
 * and removes RLE acceleration if absent.
slouken@0
   891
 * If 'flag' is 0, this function clears any current color key.
slouken@0
   892
 * This function returns 0, or -1 if there was an error.
slouken@0
   893
 */
slouken@337
   894
extern DECLSPEC int SDLCALL SDL_SetColorKey
slouken@1662
   895
    (SDL_Surface * surface, Uint32 flag, Uint32 key);
slouken@0
   896
slouken@0
   897
/*
slouken@0
   898
 * This function sets the alpha value for the entire surface, as opposed to
slouken@0
   899
 * using the alpha component of each pixel. This value measures the range
slouken@0
   900
 * of transparency of the surface, 0 being completely transparent to 255
slouken@0
   901
 * being completely opaque. An 'alpha' value of 255 causes blits to be
slouken@0
   902
 * opaque, the source pixels copied to the destination (the default). Note
slouken@0
   903
 * that per-surface alpha can be combined with colorkey transparency.
slouken@0
   904
 *
slouken@0
   905
 * If 'flag' is 0, alpha blending is disabled for the surface.
slouken@0
   906
 * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
slouken@0
   907
 * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
slouken@0
   908
 * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
slouken@432
   909
 *
slouken@432
   910
 * The 'alpha' parameter is ignored for surfaces that have an alpha channel.
slouken@0
   911
 */
slouken@1668
   912
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag,
slouken@1668
   913
                                         Uint8 alpha);
slouken@0
   914
slouken@0
   915
/*
slouken@0
   916
 * Sets the clipping rectangle for the destination surface in a blit.
slouken@0
   917
 *
slouken@0
   918
 * If the clip rectangle is NULL, clipping will be disabled.
slouken@0
   919
 * If the clip rectangle doesn't intersect the surface, the function will
slouken@0
   920
 * return SDL_FALSE and blits will be completely clipped.  Otherwise the
slouken@0
   921
 * function returns SDL_TRUE and blits to the surface will be clipped to
slouken@0
   922
 * the intersection of the surface area and the clipping rectangle.
slouken@0
   923
 *
slouken@0
   924
 * Note that blits are automatically clipped to the edges of the source
slouken@0
   925
 * and destination surfaces.
slouken@0
   926
 */
slouken@1668
   927
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
slouken@1668
   928
                                                 const SDL_Rect * rect);
slouken@0
   929
slouken@0
   930
/*
slouken@0
   931
 * Gets the clipping rectangle for the destination surface in a blit.
slouken@0
   932
 * 'rect' must be a pointer to a valid rectangle which will be filled
slouken@0
   933
 * with the correct values.
slouken@0
   934
 */
slouken@1668
   935
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
slouken@1668
   936
                                             SDL_Rect * rect);
slouken@0
   937
slouken@0
   938
/*
slouken@0
   939
 * Creates a new surface of the specified format, and then copies and maps 
slouken@0
   940
 * the given surface to it so the blit of the converted surface will be as 
slouken@0
   941
 * fast as possible.  If this function fails, it returns NULL.
slouken@0
   942
 *
slouken@0
   943
 * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those 
slouken@0
   944
 * semantics.  You can also pass SDL_RLEACCEL in the flags parameter and
slouken@0
   945
 * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
slouken@0
   946
 * surface.
slouken@0
   947
 *
slouken@0
   948
 * This function is used internally by SDL_DisplayFormat().
slouken@0
   949
 */
slouken@1662
   950
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
slouken@1662
   951
    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
slouken@0
   952
slouken@0
   953
/*
slouken@0
   954
 * This performs a fast blit from the source surface to the destination
slouken@0
   955
 * surface.  It assumes that the source and destination rectangles are
slouken@0
   956
 * the same size.  If either 'srcrect' or 'dstrect' are NULL, the entire
slouken@0
   957
 * surface (src or dst) is copied.  The final blit rectangles are saved
slouken@0
   958
 * in 'srcrect' and 'dstrect' after all clipping is performed.
slouken@0
   959
 * If the blit is successful, it returns 0, otherwise it returns -1.
slouken@0
   960
 *
slouken@0
   961
 * The blit function should not be called on a locked surface.
slouken@0
   962
 *
slouken@0
   963
 * The blit semantics for surfaces with and without alpha and colorkey
slouken@0
   964
 * are defined as follows:
slouken@0
   965
 *
slouken@0
   966
 * RGBA->RGB:
slouken@0
   967
 *     SDL_SRCALPHA set:
slouken@0
   968
 * 	alpha-blend (using alpha-channel).
slouken@0
   969
 * 	SDL_SRCCOLORKEY ignored.
slouken@0
   970
 *     SDL_SRCALPHA not set:
slouken@0
   971
 * 	copy RGB.
slouken@0
   972
 * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@0
   973
 * 	RGB values of the source colour key, ignoring alpha in the
slouken@0
   974
 * 	comparison.
slouken@0
   975
 * 
slouken@0
   976
 * RGB->RGBA:
slouken@0
   977
 *     SDL_SRCALPHA set:
slouken@0
   978
 * 	alpha-blend (using the source per-surface alpha value);
slouken@0
   979
 * 	set destination alpha to opaque.
slouken@0
   980
 *     SDL_SRCALPHA not set:
slouken@431
   981
 * 	copy RGB, set destination alpha to source per-surface alpha value.
slouken@0
   982
 *     both:
slouken@0
   983
 * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@0
   984
 * 	source colour key.
slouken@0
   985
 * 
slouken@0
   986
 * RGBA->RGBA:
slouken@0
   987
 *     SDL_SRCALPHA set:
slouken@0
   988
 * 	alpha-blend (using the source alpha channel) the RGB values;
slouken@0
   989
 * 	leave destination alpha untouched. [Note: is this correct?]
slouken@0
   990
 * 	SDL_SRCCOLORKEY ignored.
slouken@0
   991
 *     SDL_SRCALPHA not set:
slouken@0
   992
 * 	copy all of RGBA to the destination.
slouken@0
   993
 * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@0
   994
 * 	RGB values of the source colour key, ignoring alpha in the
slouken@0
   995
 * 	comparison.
slouken@0
   996
 * 
slouken@0
   997
 * RGB->RGB: 
slouken@0
   998
 *     SDL_SRCALPHA set:
slouken@0
   999
 * 	alpha-blend (using the source per-surface alpha value).
slouken@0
  1000
 *     SDL_SRCALPHA not set:
slouken@0
  1001
 * 	copy RGB.
slouken@0
  1002
 *     both:
slouken@0
  1003
 * 	if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@0
  1004
 * 	source colour key.
slouken@0
  1005
 *
slouken@0
  1006
 * If either of the surfaces were in video memory, and the blit returns -2,
slouken@0
  1007
 * the video memory was lost, so it should be reloaded with artwork and 
slouken@0
  1008
 * re-blitted:
slouken@0
  1009
	while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
slouken@0
  1010
		while ( SDL_LockSurface(image) < 0 )
slouken@0
  1011
			Sleep(10);
slouken@0
  1012
		-- Write image pixels to image->pixels --
slouken@0
  1013
		SDL_UnlockSurface(image);
slouken@0
  1014
	}
slouken@0
  1015
 * This happens under DirectX 5.0 when the system switches away from your
slouken@0
  1016
 * fullscreen application.  The lock will also fail until you have access
slouken@0
  1017
 * to the video memory again.
slouken@0
  1018
 */
slouken@0
  1019
/* You should call SDL_BlitSurface() unless you know exactly how SDL
slouken@0
  1020
   blitting works internally and how to use the other blit functions.
slouken@0
  1021
*/
slouken@0
  1022
#define SDL_BlitSurface SDL_UpperBlit
slouken@0
  1023
slouken@0
  1024
/* This is the public blit function, SDL_BlitSurface(), and it performs
slouken@0
  1025
   rectangle validation and clipping before passing it to SDL_LowerBlit()
slouken@0
  1026
*/
slouken@337
  1027
extern DECLSPEC int SDLCALL SDL_UpperBlit
slouken@1662
  1028
    (SDL_Surface * src, SDL_Rect * srcrect,
slouken@1662
  1029
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@0
  1030
/* This is a semi-private blit function and it performs low-level surface
slouken@0
  1031
   blitting only.
slouken@0
  1032
*/
slouken@337
  1033
extern DECLSPEC int SDLCALL SDL_LowerBlit
slouken@1662
  1034
    (SDL_Surface * src, SDL_Rect * srcrect,
slouken@1662
  1035
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@0
  1036
slouken@0
  1037
/*
slouken@0
  1038
 * This function performs a fast fill of the given rectangle with 'color'
slouken@0
  1039
 * The given rectangle is clipped to the destination surface clip area
slouken@0
  1040
 * and the final fill rectangle is saved in the passed in pointer.
slouken@0
  1041
 * If 'dstrect' is NULL, the whole surface will be filled with 'color'
slouken@0
  1042
 * The color should be a pixel of the format used by the surface, and 
slouken@0
  1043
 * can be generated by the SDL_MapRGB() function.
slouken@0
  1044
 * This function returns 0 on success, or -1 on error.
slouken@0
  1045
 */
slouken@337
  1046
extern DECLSPEC int SDLCALL SDL_FillRect
slouken@1662
  1047
    (SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color);
slouken@0
  1048
slouken@0
  1049
/* 
slouken@0
  1050
 * This function takes a surface and copies it to a new surface of the
slouken@0
  1051
 * pixel format and colors of the video framebuffer, suitable for fast
slouken@0
  1052
 * blitting onto the display surface.  It calls SDL_ConvertSurface()
slouken@0
  1053
 *
slouken@0
  1054
 * If you want to take advantage of hardware colorkey or alpha blit
slouken@0
  1055
 * acceleration, you should set the colorkey and alpha value before
slouken@0
  1056
 * calling this function.
slouken@0
  1057
 *
slouken@0
  1058
 * If the conversion fails or runs out of memory, it returns NULL
slouken@0
  1059
 */
slouken@1668
  1060
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
slouken@0
  1061
slouken@0
  1062
/* 
slouken@0
  1063
 * This function takes a surface and copies it to a new surface of the
slouken@0
  1064
 * pixel format and colors of the video framebuffer (if possible),
slouken@0
  1065
 * suitable for fast alpha blitting onto the display surface.
slouken@0
  1066
 * The new surface will always have an alpha channel.
slouken@0
  1067
 *
slouken@0
  1068
 * If you want to take advantage of hardware colorkey or alpha blit
slouken@0
  1069
 * acceleration, you should set the colorkey and alpha value before
slouken@0
  1070
 * calling this function.
slouken@0
  1071
 *
slouken@0
  1072
 * If the conversion fails or runs out of memory, it returns NULL
slouken@0
  1073
 */
slouken@1668
  1074
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
slouken@1668
  1075
                                                            surface);
slouken@0
  1076
slouken@0
  1077
slouken@0
  1078
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1079
/* YUV video surface overlay functions                                       */
slouken@0
  1080
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1081
slouken@0
  1082
/* This function creates a video output overlay
slouken@0
  1083
   Calling the returned surface an overlay is something of a misnomer because
slouken@0
  1084
   the contents of the display surface underneath the area where the overlay
slouken@0
  1085
   is shown is undefined - it may be overwritten with the converted YUV data.
slouken@0
  1086
*/
slouken@1668
  1087
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
slouken@1668
  1088
                                                          int height,
slouken@1668
  1089
                                                          Uint32 format,
slouken@1668
  1090
                                                          SDL_Surface *
slouken@1668
  1091
                                                          display);
slouken@0
  1092
slouken@0
  1093
/* Lock an overlay for direct access, and unlock it when you are done */
slouken@1668
  1094
extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
slouken@1668
  1095
extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
slouken@0
  1096
slouken@0
  1097
/* Blit a video overlay to the display surface.
slouken@0
  1098
   The contents of the video surface underneath the blit destination are
slouken@0
  1099
   not defined.  
slouken@0
  1100
   The width and height of the destination rectangle may be different from
slouken@0
  1101
   that of the overlay, but currently only 2x scaling is supported.
slouken@0
  1102
*/
slouken@1668
  1103
extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
slouken@1668
  1104
                                                  SDL_Rect * dstrect);
slouken@0
  1105
slouken@0
  1106
/* Free a video overlay */
slouken@1668
  1107
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
slouken@0
  1108
slouken@0
  1109
slouken@0
  1110
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1111
/* OpenGL support functions.                                                 */
slouken@0
  1112
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
slouken@0
  1113
slouken@0
  1114
/*
slouken@1490
  1115
 * Dynamically load an OpenGL library, or the default one if path is NULL
slouken@0
  1116
 *
slouken@0
  1117
 * If you do this, you need to retrieve all of the GL functions used in
slouken@0
  1118
 * your program from the dynamic library using SDL_GL_GetProcAddress().
slouken@0
  1119
 */
slouken@1668
  1120
extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
slouken@0
  1121
slouken@0
  1122
/*
slouken@1490
  1123
 * Get the address of a GL function
slouken@0
  1124
 */
slouken@1668
  1125
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
slouken@0
  1126
slouken@0
  1127
/*
slouken@1662
  1128
 * Set an attribute of the OpenGL subsystem before window creation.
slouken@0
  1129
 */
slouken@1668
  1130
extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
slouken@0
  1131
slouken@0
  1132
/*
slouken@0
  1133
 * Get an attribute of the OpenGL subsystem from the windowing
slouken@0
  1134
 * interface, such as glX. This is of course different from getting
slouken@0
  1135
 * the values from SDL's internal OpenGL subsystem, which only
slouken@0
  1136
 * stores the values you request before initialization.
slouken@0
  1137
 *
slouken@0
  1138
 * Developers should track the values they pass into SDL_GL_SetAttribute
slouken@0
  1139
 * themselves if they want to retrieve these values.
slouken@0
  1140
 */
slouken@1668
  1141
extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value);
slouken@0
  1142
slouken@0
  1143
/*
slouken@0
  1144
 * Swap the OpenGL buffers, if double-buffering is supported.
slouken@0
  1145
 */
slouken@1668
  1146
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
slouken@0
  1147
slouken@47
  1148
/* Not in public API at the moment - do not use! */
slouken@1668
  1149
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
slouken@1668
  1150
                                            SDL_Rect * srcrect,
slouken@1668
  1151
                                            SDL_Surface * dst,
slouken@1668
  1152
                                            SDL_Rect * dstrect);
slouken@1662
  1153
slouken@0
  1154
/* Ends C function definitions when using C++ */
slouken@0
  1155
#ifdef __cplusplus
slouken@1662
  1156
/* *INDENT-OFF* */
slouken@0
  1157
}
slouken@1662
  1158
/* *INDENT-ON* */
slouken@0
  1159
#endif
slouken@0
  1160
#include "close_code.h"
slouken@0
  1161
slouken@0
  1162
#endif /* _SDL_video_h */
slouken@1662
  1163
slouken@1662
  1164
/* vi: set ts=4 sw=4 expandtab: */