include/SDL_surface.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 13 Feb 2011 13:46:10 -0800
changeset 5288 d4381f3b0d1e
parent 5262 b530ef003506
child 5292 22335352d750
permissions -rw-r--r--
A few fixes:
Fixed creating render texture framebuffer.
Removed the need for palette watch, added surface format caching.
Added an SDL_DONTFREE flag so you can't free the window and 1.2 shadow surfaces.
slouken@2275
     1
/*
slouken@2275
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 Sam Lantinga
slouken@2275
     4
slouken@2275
     5
    This library is free software; you can redistribute it and/or
slouken@2275
     6
    modify it under the terms of the GNU Lesser General Public
slouken@2275
     7
    License as published by the Free Software Foundation; either
slouken@2275
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@2275
     9
slouken@2275
    10
    This library is distributed in the hope that it will be useful,
slouken@2275
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@2275
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@2275
    13
    Lesser General Public License for more details.
slouken@2275
    14
slouken@2275
    15
    You should have received a copy of the GNU Lesser General Public
slouken@2275
    16
    License along with this library; if not, write to the Free Software
slouken@2275
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@2275
    18
slouken@2275
    19
    Sam Lantinga
slouken@2275
    20
    slouken@libsdl.org
slouken@2275
    21
*/
slouken@2275
    22
slouken@2275
    23
/**
slouken@3407
    24
 *  \file SDL_surface.h
slouken@3407
    25
 *  
slouken@3407
    26
 *  Header file for ::SDL_surface definition and management functions.
slouken@2275
    27
 */
slouken@2275
    28
slouken@2275
    29
#ifndef _SDL_surface_h
slouken@2275
    30
#define _SDL_surface_h
slouken@2275
    31
slouken@2275
    32
#include "SDL_stdinc.h"
slouken@2275
    33
#include "SDL_pixels.h"
slouken@2275
    34
#include "SDL_rect.h"
slouken@4929
    35
#include "SDL_blendmode.h"
slouken@2275
    36
#include "SDL_rwops.h"
slouken@2275
    37
slouken@2275
    38
#include "begin_code.h"
slouken@2275
    39
/* Set up for C function definitions, even when using C++ */
slouken@2275
    40
#ifdef __cplusplus
slouken@2275
    41
/* *INDENT-OFF* */
slouken@2275
    42
extern "C" {
slouken@2275
    43
/* *INDENT-ON* */
slouken@2275
    44
#endif
slouken@2275
    45
slouken@3407
    46
/**
slouken@3407
    47
 *  \name Surface flags
slouken@3407
    48
 *  
slouken@3407
    49
 *  These are the currently supported flags for the ::SDL_surface.
slouken@3407
    50
 *  
slouken@3407
    51
 *  \internal
slouken@3407
    52
 *  Used internally (read-only).
slouken@3341
    53
 */
slouken@3341
    54
/*@{*/
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
    /** format version, bumped at every change to invalidate blit maps */
slouken@4929
    93
    int format_version;         /**< Private */
slouken@2275
    94
slouken@3407
    95
    /** Reference count -- used when freeing surface */
slouken@2275
    96
    int refcount;               /**< Read-mostly */
slouken@2275
    97
} SDL_Surface;
slouken@2275
    98
slouken@2275
    99
/**
slouken@3407
   100
 * \brief The type of function used for surface blitting functions.
slouken@2275
   101
 */
slouken@2275
   102
typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
slouken@2275
   103
                         struct SDL_Surface * dst, SDL_Rect * dstrect);
slouken@2275
   104
slouken@3341
   105
/**
slouken@4424
   106
 *  Allocate and free an RGB surface.
slouken@3407
   107
 *  
slouken@3407
   108
 *  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
slouken@3407
   109
 *  If the depth is greater than 8 bits, the pixel format is set using the
slouken@3407
   110
 *  flags '[RGB]mask'.
slouken@3407
   111
 *  
slouken@3407
   112
 *  If the function runs out of memory, it will return NULL.
slouken@3407
   113
 *  
slouken@3407
   114
 *  \param flags The \c flags are obsolete and should be set to 0.
slouken@2275
   115
 */
slouken@2275
   116
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
slouken@2275
   117
    (Uint32 flags, int width, int height, int depth,
slouken@2275
   118
     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
slouken@2275
   119
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
slouken@2275
   120
                                                              int width,
slouken@2275
   121
                                                              int height,
slouken@2275
   122
                                                              int depth,
slouken@2275
   123
                                                              int pitch,
slouken@2275
   124
                                                              Uint32 Rmask,
slouken@2275
   125
                                                              Uint32 Gmask,
slouken@2275
   126
                                                              Uint32 Bmask,
slouken@2275
   127
                                                              Uint32 Amask);
slouken@2275
   128
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
slouken@2275
   129
slouken@2275
   130
/**
slouken@3407
   131
 *  \brief Set the palette used by a surface.
slouken@3407
   132
 *  
slouken@3407
   133
 *  \return 0, or -1 if the surface format doesn't use a palette.
slouken@3407
   134
 *  
slouken@3407
   135
 *  \note A single palette can be shared with many surfaces.
slouken@2275
   136
 */
slouken@2275
   137
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
slouken@2275
   138
                                                  SDL_Palette * palette);
slouken@2275
   139
slouken@3341
   140
/**
slouken@3407
   141
 *  \brief Sets up a surface for directly accessing the pixels.
slouken@3407
   142
 *  
slouken@3407
   143
 *  Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
slouken@3407
   144
 *  to and read from \c surface->pixels, using the pixel format stored in 
slouken@3407
   145
 *  \c surface->format.  Once you are done accessing the surface, you should 
slouken@3407
   146
 *  use SDL_UnlockSurface() to release it.
slouken@3407
   147
 *  
slouken@3407
   148
 *  Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
slouken@3407
   149
 *  to 0, then you can read and write to the surface at any time, and the
slouken@3407
   150
 *  pixel format of the surface will not change.
slouken@3407
   151
 *  
slouken@3407
   152
 *  No operating system or library calls should be made between lock/unlock
slouken@3407
   153
 *  pairs, as critical system locks may be held during this time.
slouken@3407
   154
 *  
slouken@3407
   155
 *  SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
slouken@3407
   156
 *  
slouken@3407
   157
 *  \sa SDL_UnlockSurface()
slouken@2275
   158
 */
slouken@2275
   159
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
slouken@3341
   160
/** \sa SDL_LockSurface() */
slouken@2275
   161
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
slouken@2275
   162
slouken@3341
   163
/**
slouken@4971
   164
 *  Load a surface from a seekable SDL data stream (memory or file).
slouken@3407
   165
 *  
slouken@4971
   166
 *  If \c freesrc is non-zero, the stream will be closed after being read.
slouken@3407
   167
 *  
slouken@3407
   168
 *  The new surface should be freed with SDL_FreeSurface().
slouken@3407
   169
 *  
slouken@3407
   170
 *  \return the new surface, or NULL if there was an error.
slouken@2275
   171
 */
slouken@2275
   172
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
slouken@2275
   173
                                                    int freesrc);
slouken@2275
   174
slouken@3407
   175
/**
slouken@3407
   176
 *  Load a surface from a file.
slouken@3407
   177
 *  
slouken@3407
   178
 *  Convenience macro.
slouken@3407
   179
 */
slouken@2275
   180
#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
slouken@2275
   181
slouken@3341
   182
/**
slouken@4971
   183
 *  Save a surface to a seekable SDL data stream (memory or file).
slouken@3407
   184
 *  
slouken@4971
   185
 *  If \c freedst is non-zero, the stream will be closed after being written.
slouken@3407
   186
 *  
slouken@3407
   187
 *  \return 0 if successful or -1 if there was an error.
slouken@2275
   188
 */
slouken@2275
   189
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
slouken@2275
   190
    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
slouken@2275
   191
slouken@3407
   192
/** 
slouken@3407
   193
 *  Save a surface to a file.
slouken@3407
   194
 *  
slouken@3407
   195
 *  Convenience macro.
slouken@3407
   196
 */
slouken@2275
   197
#define SDL_SaveBMP(surface, file) \
slouken@2275
   198
		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
slouken@2275
   199
slouken@3341
   200
/**
slouken@3407
   201
 *  \brief Sets the RLE acceleration hint for a surface.
slouken@3407
   202
 *  
slouken@3407
   203
 *  \return 0 on success, or -1 if the surface is not valid
slouken@3407
   204
 *  
slouken@3407
   205
 *  \note If RLE is enabled, colorkey and alpha blending blits are much faster,
slouken@3407
   206
 *        but the surface must be locked before directly accessing the pixels.
slouken@2275
   207
 */
slouken@2275
   208
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
slouken@2275
   209
                                              int flag);
slouken@2275
   210
slouken@3341
   211
/**
slouken@3407
   212
 *  \brief Sets the color key (transparent pixel) in a blittable surface.
slouken@3407
   213
 *  
slouken@3407
   214
 *  \param surface The surface to update
slouken@3407
   215
 *  \param flag Non-zero to enable colorkey and 0 to disable colorkey 
slouken@3407
   216
 *  \param key The transparent pixel in the native surface format
slouken@3407
   217
 *  
slouken@3407
   218
 *  \return 0 on success, or -1 if the surface is not valid
slouken@2275
   219
 */
slouken@2275
   220
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
slouken@3560
   221
                                            int flag, Uint32 key);
slouken@2275
   222
slouken@3341
   223
/**
slouken@3550
   224
 *  \brief Gets the color key (transparent pixel) in a blittable surface.
slouken@3407
   225
 *  
slouken@3407
   226
 *  \param surface The surface to update
slouken@3407
   227
 *  \param key A pointer filled in with the transparent pixel in the native 
slouken@3407
   228
 *             surface format
slouken@3407
   229
 *  
slouken@3407
   230
 *  \return 0 on success, or -1 if the surface is not valid or colorkey is not 
slouken@3407
   231
 *          enabled.
slouken@3103
   232
 */
slouken@3103
   233
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
slouken@3103
   234
                                            Uint32 * key);
slouken@3103
   235
slouken@2275
   236
/**
slouken@3407
   237
 *  \brief Set an additional color value used in blit operations.
slouken@3407
   238
 *  
slouken@3407
   239
 *  \param surface The surface to update.
slouken@4971
   240
 *  \param r The red color value multiplied into blit operations.
slouken@4971
   241
 *  \param g The green color value multiplied into blit operations.
slouken@4971
   242
 *  \param b The blue color value multiplied into blit operations.
slouken@3407
   243
 *  
slouken@3407
   244
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   245
 *  
slouken@3407
   246
 *  \sa SDL_GetSurfaceColorMod()
slouken@2275
   247
 */
slouken@2275
   248
extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   249
                                                   Uint8 r, Uint8 g, Uint8 b);
slouken@2275
   250
slouken@2275
   251
slouken@2275
   252
/**
slouken@3407
   253
 *  \brief Get the additional color value used in blit operations.
slouken@3407
   254
 *  
slouken@3407
   255
 *  \param surface The surface to query.
slouken@4971
   256
 *  \param r A pointer filled in with the current red color value.
slouken@4971
   257
 *  \param g A pointer filled in with the current green color value.
slouken@4971
   258
 *  \param b A pointer filled in with the current blue color value.
slouken@3407
   259
 *  
slouken@3407
   260
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   261
 *  
slouken@3407
   262
 *  \sa SDL_SetSurfaceColorMod()
slouken@2275
   263
 */
slouken@2275
   264
extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   265
                                                   Uint8 * r, Uint8 * g,
slouken@2275
   266
                                                   Uint8 * b);
slouken@2275
   267
slouken@2275
   268
/**
slouken@3407
   269
 *  \brief Set an additional alpha value used in blit operations.
slouken@3407
   270
 *  
slouken@3407
   271
 *  \param surface The surface to update.
slouken@4971
   272
 *  \param alpha The alpha value multiplied into blit operations.
slouken@3407
   273
 *  
slouken@3407
   274
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   275
 *  
slouken@3407
   276
 *  \sa SDL_GetSurfaceAlphaMod()
slouken@2275
   277
 */
slouken@2275
   278
extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   279
                                                   Uint8 alpha);
slouken@2275
   280
slouken@2275
   281
/**
slouken@3407
   282
 *  \brief Get the additional alpha value used in blit operations.
slouken@3407
   283
 *  
slouken@3407
   284
 *  \param surface The surface to query.
slouken@4971
   285
 *  \param alpha A pointer filled in with the current alpha value.
slouken@3407
   286
 *  
slouken@3407
   287
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   288
 *  
slouken@3407
   289
 *  \sa SDL_SetSurfaceAlphaMod()
slouken@2275
   290
 */
slouken@2275
   291
extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   292
                                                   Uint8 * alpha);
slouken@2275
   293
slouken@2275
   294
/**
slouken@3407
   295
 *  \brief Set the blend mode used for blit operations.
slouken@3407
   296
 *  
slouken@3407
   297
 *  \param surface The surface to update.
slouken@3407
   298
 *  \param blendMode ::SDL_BlendMode to use for blit blending.
slouken@3407
   299
 *  
slouken@3407
   300
 *  \return 0 on success, or -1 if the parameters are not valid.
slouken@3407
   301
 *  
slouken@3407
   302
 *  \sa SDL_GetSurfaceBlendMode()
slouken@2275
   303
 */
slouken@2275
   304
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   305
                                                    SDL_BlendMode blendMode);
slouken@2275
   306
slouken@2275
   307
/**
slouken@3407
   308
 *  \brief Get the blend mode used for blit operations.
slouken@3407
   309
 *  
slouken@3407
   310
 *  \param surface   The surface to query.
slouken@3407
   311
 *  \param blendMode A pointer filled in with the current blend mode.
slouken@3407
   312
 *  
slouken@3407
   313
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   314
 *  
slouken@3407
   315
 *  \sa SDL_SetSurfaceBlendMode()
slouken@2275
   316
 */
slouken@2275
   317
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   318
                                                    SDL_BlendMode *blendMode);
slouken@2275
   319
slouken@2275
   320
/**
slouken@3407
   321
 *  Sets the clipping rectangle for the destination surface in a blit.
slouken@3407
   322
 *  
slouken@3407
   323
 *  If the clip rectangle is NULL, clipping will be disabled.
slouken@3407
   324
 *  
slouken@3407
   325
 *  If the clip rectangle doesn't intersect the surface, the function will
slouken@3407
   326
 *  return SDL_FALSE and blits will be completely clipped.  Otherwise the
slouken@3407
   327
 *  function returns SDL_TRUE and blits to the surface will be clipped to
slouken@3407
   328
 *  the intersection of the surface area and the clipping rectangle.
slouken@3407
   329
 *  
slouken@3407
   330
 *  Note that blits are automatically clipped to the edges of the source
slouken@3407
   331
 *  and destination surfaces.
slouken@2275
   332
 */
slouken@2275
   333
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
slouken@2275
   334
                                                 const SDL_Rect * rect);
slouken@2275
   335
slouken@3341
   336
/**
slouken@3407
   337
 *  Gets the clipping rectangle for the destination surface in a blit.
slouken@3407
   338
 *  
slouken@3407
   339
 *  \c rect must be a pointer to a valid rectangle which will be filled
slouken@3407
   340
 *  with the correct values.
slouken@2275
   341
 */
slouken@2275
   342
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
slouken@2275
   343
                                             SDL_Rect * rect);
slouken@2275
   344
slouken@3341
   345
/**
slouken@3407
   346
 *  Creates a new surface of the specified format, and then copies and maps 
slouken@3407
   347
 *  the given surface to it so the blit of the converted surface will be as 
slouken@3407
   348
 *  fast as possible.  If this function fails, it returns NULL.
slouken@3407
   349
 *  
slouken@3407
   350
 *  The \c flags parameter is passed to SDL_CreateRGBSurface() and has those 
slouken@3407
   351
 *  semantics.  You can also pass ::SDL_RLEACCEL in the flags parameter and
slouken@3407
   352
 *  SDL will try to RLE accelerate colorkey and alpha blits in the resulting
slouken@3407
   353
 *  surface.
slouken@2275
   354
 */
slouken@2275
   355
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
slouken@2275
   356
    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
slouken@2275
   357
slouken@3341
   358
/**
slouken@3434
   359
 * \brief Copy a block of pixels of one format to another format
slouken@3434
   360
 */
slouken@3434
   361
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
slouken@3434
   362
                                              Uint32 src_format,
slouken@3434
   363
                                              const void * src, int src_pitch,
slouken@3434
   364
                                              Uint32 dst_format,
slouken@3434
   365
                                              void * dst, int dst_pitch);
slouken@3434
   366
slouken@3434
   367
/**
slouken@3407
   368
 *  Performs a fast fill of the given rectangle with \c color.
slouken@3407
   369
 *  
slouken@3536
   370
 *  If \c rect is NULL, the whole surface will be filled with \c color.
slouken@3407
   371
 *  
slouken@3407
   372
 *  The color should be a pixel of the format used by the surface, and 
slouken@3407
   373
 *  can be generated by the SDL_MapRGB() function.
slouken@3407
   374
 *  
slouken@3407
   375
 *  \return 0 on success, or -1 on error.
slouken@2275
   376
 */
slouken@2275
   377
extern DECLSPEC int SDLCALL SDL_FillRect
slouken@3536
   378
    (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
slouken@3536
   379
extern DECLSPEC int SDLCALL SDL_FillRects
slouken@3536
   380
    (SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
slouken@2275
   381
slouken@3341
   382
/**
slouken@3407
   383
 *  Performs a fast blit from the source surface to the destination surface.
slouken@3407
   384
 *  
slouken@3407
   385
 *  This assumes that the source and destination rectangles are
slouken@3407
   386
 *  the same size.  If either \c srcrect or \c dstrect are NULL, the entire
slouken@3407
   387
 *  surface (\c src or \c dst) is copied.  The final blit rectangles are saved
slouken@3407
   388
 *  in \c srcrect and \c dstrect after all clipping is performed.
slouken@3407
   389
 *  
slouken@3407
   390
 *  \return If the blit is successful, it returns 0, otherwise it returns -1.
slouken@2275
   391
 *
slouken@3407
   392
 *  The blit function should not be called on a locked surface.
slouken@2275
   393
 *
slouken@3407
   394
 *  The blit semantics for surfaces with and without alpha and colorkey
slouken@3407
   395
 *  are defined as follows:
slouken@3407
   396
 *  \verbatim
slouken@3407
   397
    RGBA->RGB:
slouken@3407
   398
      SDL_SRCALPHA set:
slouken@3407
   399
        alpha-blend (using alpha-channel).
slouken@3407
   400
        SDL_SRCCOLORKEY ignored.
slouken@3407
   401
      SDL_SRCALPHA not set:
slouken@3407
   402
        copy RGB.
slouken@3407
   403
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@3407
   404
        RGB values of the source colour key, ignoring alpha in the
slouken@3407
   405
        comparison.
slouken@3407
   406
   
slouken@3407
   407
    RGB->RGBA:
slouken@3407
   408
      SDL_SRCALPHA set:
slouken@3407
   409
        alpha-blend (using the source per-surface alpha value);
slouken@3407
   410
        set destination alpha to opaque.
slouken@3407
   411
      SDL_SRCALPHA not set:
slouken@3407
   412
        copy RGB, set destination alpha to source per-surface alpha value.
slouken@3407
   413
      both:
slouken@3407
   414
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@3407
   415
        source colour key.
slouken@3407
   416
   
slouken@3407
   417
    RGBA->RGBA:
slouken@3407
   418
      SDL_SRCALPHA set:
slouken@3407
   419
        alpha-blend (using the source alpha channel) the RGB values;
slouken@3407
   420
        leave destination alpha untouched. [Note: is this correct?]
slouken@3407
   421
        SDL_SRCCOLORKEY ignored.
slouken@3407
   422
      SDL_SRCALPHA not set:
slouken@3407
   423
        copy all of RGBA to the destination.
slouken@3407
   424
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@3407
   425
        RGB values of the source colour key, ignoring alpha in the
slouken@3407
   426
       comparison.
slouken@3407
   427
   
slouken@3407
   428
    RGB->RGB: 
slouken@3407
   429
      SDL_SRCALPHA set:
slouken@3407
   430
        alpha-blend (using the source per-surface alpha value).
slouken@3407
   431
      SDL_SRCALPHA not set:
slouken@3407
   432
        copy RGB.
slouken@3407
   433
      both:
slouken@3407
   434
        if SDL_SRCCOLORKEY set, only copy the pixels matching the
slouken@3407
   435
        source colour key.
slouken@3407
   436
    \endverbatim
slouken@3407
   437
 *  
slouken@3407
   438
 *  You should call SDL_BlitSurface() unless you know exactly how SDL
slouken@3407
   439
 *  blitting works internally and how to use the other blit functions.
slouken@2275
   440
 */
slouken@2275
   441
#define SDL_BlitSurface SDL_UpperBlit
slouken@2275
   442
slouken@3407
   443
/**
slouken@3407
   444
 *  This is the public blit function, SDL_BlitSurface(), and it performs
slouken@3341
   445
 *  rectangle validation and clipping before passing it to SDL_LowerBlit()
slouken@3341
   446
 */
slouken@2275
   447
extern DECLSPEC int SDLCALL SDL_UpperBlit
slouken@4949
   448
    (SDL_Surface * src, const SDL_Rect * srcrect,
slouken@2275
   449
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@3341
   450
slouken@3407
   451
/**
slouken@3407
   452
 *  This is a semi-private blit function and it performs low-level surface
slouken@3341
   453
 *  blitting only.
slouken@3341
   454
 */
slouken@2275
   455
extern DECLSPEC int SDLCALL SDL_LowerBlit
slouken@2275
   456
    (SDL_Surface * src, SDL_Rect * srcrect,
slouken@2275
   457
     SDL_Surface * dst, SDL_Rect * dstrect);
slouken@2275
   458
slouken@2275
   459
/**
slouken@3407
   460
 *  \brief Perform a fast, low quality, stretch blit between two surfaces of the
slouken@3407
   461
 *         same pixel format.
slouken@3407
   462
 *  
slouken@3407
   463
 *  \note This function uses a static buffer, and is not thread-safe.
slouken@2275
   464
 */
slouken@2275
   465
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
slouken@2828
   466
                                            const SDL_Rect * srcrect,
slouken@2275
   467
                                            SDL_Surface * dst,
slouken@2828
   468
                                            const SDL_Rect * dstrect);
slouken@2275
   469
slouken@2275
   470
/* Ends C function definitions when using C++ */
slouken@2275
   471
#ifdef __cplusplus
slouken@2275
   472
/* *INDENT-OFF* */
slouken@2275
   473
}
slouken@2275
   474
/* *INDENT-ON* */
slouken@2275
   475
#endif
slouken@2275
   476
#include "close_code.h"
slouken@2275
   477
slouken@2275
   478
#endif /* _SDL_surface_h */
slouken@2275
   479
slouken@2275
   480
/* vi: set ts=4 sw=4 expandtab: */