include/SDL_surface.h
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 27 Apr 2013 17:52:58 +0200
changeset 7125 082c0c53ac16
parent 6885 700f1b25f77f
child 7188 20bd120bf7e4
permissions -rw-r--r--
Corrected spelling in header files.
slouken@2275
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@2275
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@2275
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@2275
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@2275
    20
*/
slouken@2275
    21
slouken@2275
    22
/**
slouken@3407
    23
 *  \file SDL_surface.h
slouken@3407
    24
 *  
slouken@3407
    25
 *  Header file for ::SDL_surface definition and management functions.
slouken@2275
    26
 */
slouken@2275
    27
slouken@2275
    28
#ifndef _SDL_surface_h
slouken@2275
    29
#define _SDL_surface_h
slouken@2275
    30
slouken@2275
    31
#include "SDL_stdinc.h"
slouken@2275
    32
#include "SDL_pixels.h"
slouken@2275
    33
#include "SDL_rect.h"
slouken@4929
    34
#include "SDL_blendmode.h"
slouken@2275
    35
#include "SDL_rwops.h"
slouken@2275
    36
slouken@2275
    37
#include "begin_code.h"
slouken@2275
    38
/* Set up for C function definitions, even when using C++ */
slouken@2275
    39
#ifdef __cplusplus
slouken@2275
    40
/* *INDENT-OFF* */
slouken@2275
    41
extern "C" {
slouken@2275
    42
/* *INDENT-ON* */
slouken@2275
    43
#endif
slouken@2275
    44
slouken@3407
    45
/**
slouken@3407
    46
 *  \name Surface flags
slouken@3407
    47
 *  
slouken@3407
    48
 *  These are the currently supported flags for the ::SDL_surface.
slouken@3407
    49
 *  
slouken@3407
    50
 *  \internal
slouken@3407
    51
 *  Used internally (read-only).
slouken@3341
    52
 */
slouken@3341
    53
/*@{*/
slouken@6257
    54
#define SDL_SWSURFACE       0           /**< Just here for compatibility */
slouken@3341
    55
#define SDL_PREALLOC        0x00000001  /**< Surface uses preallocated memory */
slouken@3341
    56
#define SDL_RLEACCEL        0x00000002  /**< Surface is RLE encoded */
slouken@5288
    57
#define SDL_DONTFREE        0x00000004  /**< Surface is referenced internally */
slouken@3407
    58
/*@}*//*Surface flags*/
slouken@2275
    59
slouken@3407
    60
/**
slouken@3407
    61
 *  Evaluates to true if the surface needs to be locked before access.
slouken@3407
    62
 */
slouken@2275
    63
#define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
slouken@2275
    64
slouken@2275
    65
/**
slouken@3407
    66
 * \brief A collection of pixels used in software blitting.
slouken@2275
    67
 *
slouken@3407
    68
 * \note  This structure should be treated as read-only, except for \c pixels,
slouken@2275
    69
 *        which, if not NULL, contains the raw pixel data for the surface.
slouken@2275
    70
 */
slouken@2275
    71
typedef struct SDL_Surface
slouken@2275
    72
{
slouken@2275
    73
    Uint32 flags;               /**< Read-only */
slouken@2275
    74
    SDL_PixelFormat *format;    /**< Read-only */
slouken@2275
    75
    int w, h;                   /**< Read-only */
slouken@2275
    76
    int pitch;                  /**< Read-only */
slouken@2275
    77
    void *pixels;               /**< Read-write */
slouken@2275
    78
slouken@3708
    79
    /** Application data associated with the surface */
slouken@2275
    80
    void *userdata;             /**< Read-write */
slouken@2275
    81
slouken@3407
    82
    /** information needed for surfaces requiring locks */
slouken@2275
    83
    int locked;                 /**< Read-only */
slouken@2275
    84
    void *lock_data;            /**< Read-only */
slouken@2275
    85
slouken@3407
    86
    /** clipping information */
slouken@2275
    87
    SDL_Rect clip_rect;         /**< Read-only */
slouken@2275
    88
slouken@3407
    89
    /** info for fast blit mapping to other surfaces */
slouken@2275
    90
    struct SDL_BlitMap *map;    /**< Private */
slouken@2275
    91
slouken@3407
    92
    /** Reference count -- used when freeing surface */
slouken@2275
    93
    int refcount;               /**< Read-mostly */
slouken@2275
    94
} SDL_Surface;
slouken@2275
    95
slouken@2275
    96
/**
slouken@3407
    97
 * \brief The type of function used for surface blitting functions.
slouken@2275
    98
 */
slouken@2275
    99
typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
slouken@2275
   100
                         struct SDL_Surface * dst, SDL_Rect * dstrect);
slouken@2275
   101
slouken@3341
   102
/**
slouken@4424
   103
 *  Allocate and free an RGB surface.
slouken@3407
   104
 *  
slouken@3407
   105
 *  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
slouken@3407
   106
 *  If the depth is greater than 8 bits, the pixel format is set using the
slouken@3407
   107
 *  flags '[RGB]mask'.
slouken@3407
   108
 *  
slouken@3407
   109
 *  If the function runs out of memory, it will return NULL.
slouken@3407
   110
 *  
slouken@3407
   111
 *  \param flags The \c flags are obsolete and should be set to 0.
slouken@2275
   112
 */
slouken@2275
   113
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
slouken@2275
   114
    (Uint32 flags, int width, int height, int depth,
slouken@2275
   115
     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
slouken@2275
   116
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
slouken@2275
   117
                                                              int width,
slouken@2275
   118
                                                              int height,
slouken@2275
   119
                                                              int depth,
slouken@2275
   120
                                                              int pitch,
slouken@2275
   121
                                                              Uint32 Rmask,
slouken@2275
   122
                                                              Uint32 Gmask,
slouken@2275
   123
                                                              Uint32 Bmask,
slouken@2275
   124
                                                              Uint32 Amask);
slouken@2275
   125
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
slouken@2275
   126
slouken@2275
   127
/**
slouken@3407
   128
 *  \brief Set the palette used by a surface.
slouken@3407
   129
 *  
slouken@3407
   130
 *  \return 0, or -1 if the surface format doesn't use a palette.
slouken@3407
   131
 *  
slouken@3407
   132
 *  \note A single palette can be shared with many surfaces.
slouken@2275
   133
 */
slouken@2275
   134
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
slouken@2275
   135
                                                  SDL_Palette * palette);
slouken@2275
   136
slouken@3341
   137
/**
slouken@3407
   138
 *  \brief Sets up a surface for directly accessing the pixels.
slouken@3407
   139
 *  
slouken@3407
   140
 *  Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
slouken@3407
   141
 *  to and read from \c surface->pixels, using the pixel format stored in 
slouken@3407
   142
 *  \c surface->format.  Once you are done accessing the surface, you should 
slouken@3407
   143
 *  use SDL_UnlockSurface() to release it.
slouken@3407
   144
 *  
slouken@3407
   145
 *  Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
slouken@3407
   146
 *  to 0, then you can read and write to the surface at any time, and the
slouken@3407
   147
 *  pixel format of the surface will not change.
slouken@3407
   148
 *  
slouken@3407
   149
 *  No operating system or library calls should be made between lock/unlock
slouken@3407
   150
 *  pairs, as critical system locks may be held during this time.
slouken@3407
   151
 *  
slouken@3407
   152
 *  SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
slouken@3407
   153
 *  
slouken@3407
   154
 *  \sa SDL_UnlockSurface()
slouken@2275
   155
 */
slouken@2275
   156
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
slouken@3341
   157
/** \sa SDL_LockSurface() */
slouken@2275
   158
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
slouken@2275
   159
slouken@3341
   160
/**
slouken@4971
   161
 *  Load a surface from a seekable SDL data stream (memory or file).
slouken@3407
   162
 *  
slouken@4971
   163
 *  If \c freesrc is non-zero, the stream will be closed after being read.
slouken@3407
   164
 *  
slouken@3407
   165
 *  The new surface should be freed with SDL_FreeSurface().
slouken@3407
   166
 *  
slouken@3407
   167
 *  \return the new surface, or NULL if there was an error.
slouken@2275
   168
 */
slouken@2275
   169
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
slouken@2275
   170
                                                    int freesrc);
slouken@2275
   171
slouken@3407
   172
/**
slouken@3407
   173
 *  Load a surface from a file.
slouken@3407
   174
 *  
slouken@3407
   175
 *  Convenience macro.
slouken@3407
   176
 */
slouken@2275
   177
#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
slouken@2275
   178
slouken@3341
   179
/**
slouken@4971
   180
 *  Save a surface to a seekable SDL data stream (memory or file).
slouken@3407
   181
 *  
slouken@4971
   182
 *  If \c freedst is non-zero, the stream will be closed after being written.
slouken@3407
   183
 *  
slouken@3407
   184
 *  \return 0 if successful or -1 if there was an error.
slouken@2275
   185
 */
slouken@2275
   186
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
slouken@2275
   187
    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
slouken@2275
   188
slouken@3407
   189
/** 
slouken@3407
   190
 *  Save a surface to a file.
slouken@3407
   191
 *  
slouken@3407
   192
 *  Convenience macro.
slouken@3407
   193
 */
slouken@2275
   194
#define SDL_SaveBMP(surface, file) \
slouken@2275
   195
		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
slouken@2275
   196
slouken@3341
   197
/**
slouken@3407
   198
 *  \brief Sets the RLE acceleration hint for a surface.
slouken@3407
   199
 *  
slouken@3407
   200
 *  \return 0 on success, or -1 if the surface is not valid
slouken@3407
   201
 *  
slouken@3407
   202
 *  \note If RLE is enabled, colorkey and alpha blending blits are much faster,
slouken@3407
   203
 *        but the surface must be locked before directly accessing the pixels.
slouken@2275
   204
 */
slouken@2275
   205
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
slouken@2275
   206
                                              int flag);
slouken@2275
   207
slouken@3341
   208
/**
slouken@3407
   209
 *  \brief Sets the color key (transparent pixel) in a blittable surface.
slouken@3407
   210
 *  
slouken@3407
   211
 *  \param surface The surface to update
slouken@6257
   212
 *  \param flag Non-zero to enable colorkey and 0 to disable colorkey
slouken@3407
   213
 *  \param key The transparent pixel in the native surface format
slouken@3407
   214
 *  
slouken@3407
   215
 *  \return 0 on success, or -1 if the surface is not valid
slouken@6257
   216
 *
slouken@6257
   217
 *  You can pass SDL_RLEACCEL to enable RLE accelerated blits.
slouken@2275
   218
 */
slouken@2275
   219
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
slouken@3560
   220
                                            int flag, Uint32 key);
slouken@2275
   221
slouken@3341
   222
/**
slouken@3550
   223
 *  \brief Gets the color key (transparent pixel) in a blittable surface.
slouken@3407
   224
 *  
slouken@3407
   225
 *  \param surface The surface to update
slouken@3407
   226
 *  \param key A pointer filled in with the transparent pixel in the native 
slouken@3407
   227
 *             surface format
slouken@3407
   228
 *  
slouken@3407
   229
 *  \return 0 on success, or -1 if the surface is not valid or colorkey is not 
slouken@3407
   230
 *          enabled.
slouken@3103
   231
 */
slouken@3103
   232
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
slouken@3103
   233
                                            Uint32 * key);
slouken@3103
   234
slouken@2275
   235
/**
slouken@3407
   236
 *  \brief Set an additional color value used in blit operations.
slouken@3407
   237
 *  
slouken@3407
   238
 *  \param surface The surface to update.
slouken@4971
   239
 *  \param r The red color value multiplied into blit operations.
slouken@4971
   240
 *  \param g The green color value multiplied into blit operations.
slouken@4971
   241
 *  \param b The blue color value multiplied into blit operations.
slouken@3407
   242
 *  
slouken@3407
   243
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   244
 *  
slouken@3407
   245
 *  \sa SDL_GetSurfaceColorMod()
slouken@2275
   246
 */
slouken@2275
   247
extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   248
                                                   Uint8 r, Uint8 g, Uint8 b);
slouken@2275
   249
slouken@2275
   250
slouken@2275
   251
/**
slouken@3407
   252
 *  \brief Get the additional color value used in blit operations.
slouken@3407
   253
 *  
slouken@3407
   254
 *  \param surface The surface to query.
slouken@4971
   255
 *  \param r A pointer filled in with the current red color value.
slouken@4971
   256
 *  \param g A pointer filled in with the current green color value.
slouken@4971
   257
 *  \param b A pointer filled in with the current blue color value.
slouken@3407
   258
 *  
slouken@3407
   259
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   260
 *  
slouken@3407
   261
 *  \sa SDL_SetSurfaceColorMod()
slouken@2275
   262
 */
slouken@2275
   263
extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   264
                                                   Uint8 * r, Uint8 * g,
slouken@2275
   265
                                                   Uint8 * b);
slouken@2275
   266
slouken@2275
   267
/**
slouken@3407
   268
 *  \brief Set an additional alpha value used in blit operations.
slouken@3407
   269
 *  
slouken@3407
   270
 *  \param surface The surface to update.
slouken@4971
   271
 *  \param alpha The alpha value multiplied into blit operations.
slouken@3407
   272
 *  
slouken@3407
   273
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   274
 *  
slouken@3407
   275
 *  \sa SDL_GetSurfaceAlphaMod()
slouken@2275
   276
 */
slouken@2275
   277
extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   278
                                                   Uint8 alpha);
slouken@2275
   279
slouken@2275
   280
/**
slouken@3407
   281
 *  \brief Get the additional alpha value used in blit operations.
slouken@3407
   282
 *  
slouken@3407
   283
 *  \param surface The surface to query.
slouken@4971
   284
 *  \param alpha A pointer filled in with the current alpha value.
slouken@3407
   285
 *  
slouken@3407
   286
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   287
 *  
slouken@3407
   288
 *  \sa SDL_SetSurfaceAlphaMod()
slouken@2275
   289
 */
slouken@2275
   290
extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   291
                                                   Uint8 * alpha);
slouken@2275
   292
slouken@2275
   293
/**
slouken@3407
   294
 *  \brief Set the blend mode used for blit operations.
slouken@3407
   295
 *  
slouken@3407
   296
 *  \param surface The surface to update.
slouken@3407
   297
 *  \param blendMode ::SDL_BlendMode to use for blit blending.
slouken@3407
   298
 *  
slouken@3407
   299
 *  \return 0 on success, or -1 if the parameters are not valid.
slouken@3407
   300
 *  
slouken@3407
   301
 *  \sa SDL_GetSurfaceBlendMode()
slouken@2275
   302
 */
slouken@2275
   303
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   304
                                                    SDL_BlendMode blendMode);
slouken@2275
   305
slouken@2275
   306
/**
slouken@3407
   307
 *  \brief Get the blend mode used for blit operations.
slouken@3407
   308
 *  
slouken@3407
   309
 *  \param surface   The surface to query.
slouken@3407
   310
 *  \param blendMode A pointer filled in with the current blend mode.
slouken@3407
   311
 *  
slouken@3407
   312
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   313
 *  
slouken@3407
   314
 *  \sa SDL_SetSurfaceBlendMode()
slouken@2275
   315
 */
slouken@2275
   316
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   317
                                                    SDL_BlendMode *blendMode);
slouken@2275
   318
slouken@2275
   319
/**
slouken@3407
   320
 *  Sets the clipping rectangle for the destination surface in a blit.
slouken@3407
   321
 *  
slouken@3407
   322
 *  If the clip rectangle is NULL, clipping will be disabled.
slouken@3407
   323
 *  
slouken@3407
   324
 *  If the clip rectangle doesn't intersect the surface, the function will
slouken@3407
   325
 *  return SDL_FALSE and blits will be completely clipped.  Otherwise the
slouken@3407
   326
 *  function returns SDL_TRUE and blits to the surface will be clipped to
slouken@3407
   327
 *  the intersection of the surface area and the clipping rectangle.
slouken@3407
   328
 *  
slouken@3407
   329
 *  Note that blits are automatically clipped to the edges of the source
slouken@3407
   330
 *  and destination surfaces.
slouken@2275
   331
 */
slouken@2275
   332
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
slouken@2275
   333
                                                 const SDL_Rect * rect);
slouken@2275
   334
slouken@3341
   335
/**
slouken@3407
   336
 *  Gets the clipping rectangle for the destination surface in a blit.
slouken@3407
   337
 *  
slouken@3407
   338
 *  \c rect must be a pointer to a valid rectangle which will be filled
slouken@3407
   339
 *  with the correct values.
slouken@2275
   340
 */
slouken@2275
   341
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
slouken@2275
   342
                                             SDL_Rect * rect);
slouken@2275
   343
slouken@3341
   344
/**
slouken@3407
   345
 *  Creates a new surface of the specified format, and then copies and maps 
slouken@3407
   346
 *  the given surface to it so the blit of the converted surface will be as 
slouken@3407
   347
 *  fast as possible.  If this function fails, it returns NULL.
slouken@3407
   348
 *  
slouken@3407
   349
 *  The \c flags parameter is passed to SDL_CreateRGBSurface() and has those 
slouken@3407
   350
 *  semantics.  You can also pass ::SDL_RLEACCEL in the flags parameter and
slouken@3407
   351
 *  SDL will try to RLE accelerate colorkey and alpha blits in the resulting
slouken@3407
   352
 *  surface.
slouken@2275
   353
 */
slouken@2275
   354
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
slouken@2275
   355
    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
slouken@5375
   356
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
slouken@5375
   357
    (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
slouken@2275
   358
slouken@3341
   359
/**
slouken@3434
   360
 * \brief Copy a block of pixels of one format to another format
slouken@6041
   361
 *  
slouken@6041
   362
 *  \return 0 on success, or -1 if there was an error
slouken@3434
   363
 */
slouken@3434
   364
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
slouken@3434
   365
                                              Uint32 src_format,
slouken@3434
   366
                                              const void * src, int src_pitch,
slouken@3434
   367
                                              Uint32 dst_format,
slouken@3434
   368
                                              void * dst, int dst_pitch);
slouken@3434
   369
slouken@3434
   370
/**
slouken@3407
   371
 *  Performs a fast fill of the given rectangle with \c color.
slouken@3407
   372
 *  
slouken@3536
   373
 *  If \c rect is NULL, the whole surface will be filled with \c color.
slouken@3407
   374
 *  
slouken@3407
   375
 *  The color should be a pixel of the format used by the surface, and 
slouken@3407
   376
 *  can be generated by the SDL_MapRGB() function.
slouken@3407
   377
 *  
slouken@3407
   378
 *  \return 0 on success, or -1 on error.
slouken@2275
   379
 */
slouken@2275
   380
extern DECLSPEC int SDLCALL SDL_FillRect
slouken@3536
   381
    (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
slouken@3536
   382
extern DECLSPEC int SDLCALL SDL_FillRects
slouken@5297
   383
    (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
slouken@2275
   384
slouken@3341
   385
/**
slouken@3407
   386
 *  Performs a fast blit from the source surface to the destination surface.
slouken@3407
   387
 *  
slouken@3407
   388
 *  This assumes that the source and destination rectangles are
slouken@3407
   389
 *  the same size.  If either \c srcrect or \c dstrect are NULL, the entire
slouken@3407
   390
 *  surface (\c src or \c dst) is copied.  The final blit rectangles are saved
slouken@3407
   391
 *  in \c srcrect and \c dstrect after all clipping is performed.
slouken@3407
   392
 *  
slouken@3407
   393
 *  \return If the blit is successful, it returns 0, otherwise it returns -1.
slouken@2275
   394
 *
slouken@3407
   395
 *  The blit function should not be called on a locked surface.
slouken@2275
   396
 *
slouken@3407
   397
 *  The blit semantics for surfaces with and without alpha and colorkey
slouken@3407
   398
 *  are defined as follows:
slouken@3407
   399
 *  \verbatim
slouken@3407
   400
    RGBA->RGB:
slouken@3407
   401
      SDL_SRCALPHA set:
slouken@3407
   402
        alpha-blend (using alpha-channel).
slouken@3407
   403
        SDL_SRCCOLORKEY ignored.
slouken@3407
   404
      SDL_SRCALPHA not set:
slouken@3407
   405
        copy RGB.
slouken@3407
   406
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
philipp@7125
   407
        RGB values of the source color key, ignoring alpha in the
slouken@3407
   408
        comparison.
slouken@3407
   409
   
slouken@3407
   410
    RGB->RGBA:
slouken@3407
   411
      SDL_SRCALPHA set:
slouken@3407
   412
        alpha-blend (using the source per-surface alpha value);
slouken@3407
   413
        set destination alpha to opaque.
slouken@3407
   414
      SDL_SRCALPHA not set:
slouken@3407
   415
        copy RGB, set destination alpha to source per-surface alpha value.
slouken@3407
   416
      both:
slouken@3407
   417
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
philipp@7125
   418
        source color key.
slouken@3407
   419
   
slouken@3407
   420
    RGBA->RGBA:
slouken@3407
   421
      SDL_SRCALPHA set:
slouken@3407
   422
        alpha-blend (using the source alpha channel) the RGB values;
slouken@3407
   423
        leave destination alpha untouched. [Note: is this correct?]
slouken@3407
   424
        SDL_SRCCOLORKEY ignored.
slouken@3407
   425
      SDL_SRCALPHA not set:
slouken@3407
   426
        copy all of RGBA to the destination.
slouken@3407
   427
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
philipp@7125
   428
        RGB values of the source color key, ignoring alpha in the
slouken@3407
   429
       comparison.
slouken@3407
   430
   
slouken@3407
   431
    RGB->RGB: 
slouken@3407
   432
      SDL_SRCALPHA set:
slouken@3407
   433
        alpha-blend (using the source per-surface alpha value).
slouken@3407
   434
      SDL_SRCALPHA not set:
slouken@3407
   435
        copy RGB.
slouken@3407
   436
      both:
slouken@3407
   437
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
philipp@7125
   438
        source color key.
slouken@3407
   439
    \endverbatim
slouken@3407
   440
 *  
slouken@3407
   441
 *  You should call SDL_BlitSurface() unless you know exactly how SDL
slouken@3407
   442
 *  blitting works internally and how to use the other blit functions.
slouken@2275
   443
 */
slouken@2275
   444
#define SDL_BlitSurface SDL_UpperBlit
slouken@2275
   445
slouken@3407
   446
/**
slouken@3407
   447
 *  This is the public blit function, SDL_BlitSurface(), and it performs
slouken@3341
   448
 *  rectangle validation and clipping before passing it to SDL_LowerBlit()
slouken@3341
   449
 */
slouken@2275
   450
extern DECLSPEC int SDLCALL SDL_UpperBlit
slouken@4949
   451
    (SDL_Surface * src, const SDL_Rect * srcrect,
slouken@2275
   452
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@3341
   453
slouken@3407
   454
/**
slouken@3407
   455
 *  This is a semi-private blit function and it performs low-level surface
slouken@3341
   456
 *  blitting only.
slouken@3341
   457
 */
slouken@2275
   458
extern DECLSPEC int SDLCALL SDL_LowerBlit
slouken@2275
   459
    (SDL_Surface * src, SDL_Rect * srcrect,
slouken@2275
   460
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@2275
   461
slouken@2275
   462
/**
slouken@3407
   463
 *  \brief Perform a fast, low quality, stretch blit between two surfaces of the
slouken@3407
   464
 *         same pixel format.
slouken@3407
   465
 *  
slouken@3407
   466
 *  \note This function uses a static buffer, and is not thread-safe.
slouken@2275
   467
 */
slouken@2275
   468
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
slouken@2828
   469
                                            const SDL_Rect * srcrect,
slouken@2275
   470
                                            SDL_Surface * dst,
slouken@2828
   471
                                            const SDL_Rect * dstrect);
slouken@2275
   472
ken@5499
   473
#define SDL_BlitScaled SDL_UpperBlitScaled
ken@5499
   474
ken@5296
   475
/**
ken@5499
   476
 *  This is the public scaled blit function, SDL_BlitScaled(), and it performs
ken@5499
   477
 *  rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
ken@5296
   478
 */
ken@5499
   479
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
ken@5296
   480
    (SDL_Surface * src, const SDL_Rect * srcrect,
ken@5499
   481
    SDL_Surface * dst, SDL_Rect * dstrect);
ken@5499
   482
ken@5499
   483
/**
ken@5499
   484
 *  This is a semi-private blit function and it performs low-level surface
ken@5499
   485
 *  scaled blitting only.
ken@5499
   486
 */
ken@5499
   487
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
ken@5499
   488
    (SDL_Surface * src, SDL_Rect * srcrect,
ken@5499
   489
    SDL_Surface * dst, SDL_Rect * dstrect);
ken@5296
   490
ken@5296
   491
slouken@2275
   492
/* Ends C function definitions when using C++ */
slouken@2275
   493
#ifdef __cplusplus
slouken@2275
   494
/* *INDENT-OFF* */
slouken@2275
   495
}
slouken@2275
   496
/* *INDENT-ON* */
slouken@2275
   497
#endif
slouken@2275
   498
#include "close_code.h"
slouken@2275
   499
slouken@2275
   500
#endif /* _SDL_surface_h */
slouken@2275
   501
slouken@2275
   502
/* vi: set ts=4 sw=4 expandtab: */