include/SDL_surface.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 31 Oct 2011 02:44:21 -0400
changeset 6041 69d7539ff51f
parent 5535 96594ac5fd1a
child 6138 4c64952a58fb
permissions -rw-r--r--
SDL_ConvertPixels() returns 0 on success
slouken@2275
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@5535
     3
  Copyright (C) 1997-2011 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@3341
    54
#define SDL_PREALLOC        0x00000001  /**< Surface uses preallocated memory */
slouken@3341
    55
#define SDL_RLEACCEL        0x00000002  /**< Surface is RLE encoded */
slouken@5288
    56
#define SDL_DONTFREE        0x00000004  /**< Surface is referenced internally */
slouken@3407
    57
/*@}*//*Surface flags*/
slouken@2275
    58
slouken@3407
    59
/**
slouken@3407
    60
 *  Evaluates to true if the surface needs to be locked before access.
slouken@3407
    61
 */
slouken@2275
    62
#define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
slouken@2275
    63
slouken@2275
    64
/**
slouken@3407
    65
 * \brief A collection of pixels used in software blitting.
slouken@2275
    66
 *
slouken@3407
    67
 * \note  This structure should be treated as read-only, except for \c pixels,
slouken@2275
    68
 *        which, if not NULL, contains the raw pixel data for the surface.
slouken@2275
    69
 */
slouken@2275
    70
typedef struct SDL_Surface
slouken@2275
    71
{
slouken@2275
    72
    Uint32 flags;               /**< Read-only */
slouken@2275
    73
    SDL_PixelFormat *format;    /**< Read-only */
slouken@2275
    74
    int w, h;                   /**< Read-only */
slouken@2275
    75
    int pitch;                  /**< Read-only */
slouken@2275
    76
    void *pixels;               /**< Read-write */
slouken@2275
    77
slouken@3708
    78
    /** Application data associated with the surface */
slouken@2275
    79
    void *userdata;             /**< Read-write */
slouken@2275
    80
slouken@3407
    81
    /** information needed for surfaces requiring locks */
slouken@2275
    82
    int locked;                 /**< Read-only */
slouken@2275
    83
    void *lock_data;            /**< Read-only */
slouken@2275
    84
slouken@3407
    85
    /** clipping information */
slouken@2275
    86
    SDL_Rect clip_rect;         /**< Read-only */
slouken@2275
    87
slouken@3407
    88
    /** info for fast blit mapping to other surfaces */
slouken@2275
    89
    struct SDL_BlitMap *map;    /**< Private */
slouken@2275
    90
slouken@3407
    91
    /** Reference count -- used when freeing surface */
slouken@2275
    92
    int refcount;               /**< Read-mostly */
slouken@2275
    93
} SDL_Surface;
slouken@2275
    94
slouken@2275
    95
/**
slouken@3407
    96
 * \brief The type of function used for surface blitting functions.
slouken@2275
    97
 */
slouken@2275
    98
typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
slouken@2275
    99
                         struct SDL_Surface * dst, SDL_Rect * dstrect);
slouken@2275
   100
slouken@3341
   101
/**
slouken@4424
   102
 *  Allocate and free an RGB surface.
slouken@3407
   103
 *  
slouken@3407
   104
 *  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
slouken@3407
   105
 *  If the depth is greater than 8 bits, the pixel format is set using the
slouken@3407
   106
 *  flags '[RGB]mask'.
slouken@3407
   107
 *  
slouken@3407
   108
 *  If the function runs out of memory, it will return NULL.
slouken@3407
   109
 *  
slouken@3407
   110
 *  \param flags The \c flags are obsolete and should be set to 0.
slouken@2275
   111
 */
slouken@2275
   112
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
slouken@2275
   113
    (Uint32 flags, int width, int height, int depth,
slouken@2275
   114
     Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
slouken@2275
   115
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
slouken@2275
   116
                                                              int width,
slouken@2275
   117
                                                              int height,
slouken@2275
   118
                                                              int depth,
slouken@2275
   119
                                                              int pitch,
slouken@2275
   120
                                                              Uint32 Rmask,
slouken@2275
   121
                                                              Uint32 Gmask,
slouken@2275
   122
                                                              Uint32 Bmask,
slouken@2275
   123
                                                              Uint32 Amask);
slouken@2275
   124
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
slouken@2275
   125
slouken@2275
   126
/**
slouken@3407
   127
 *  \brief Set the palette used by a surface.
slouken@3407
   128
 *  
slouken@3407
   129
 *  \return 0, or -1 if the surface format doesn't use a palette.
slouken@3407
   130
 *  
slouken@3407
   131
 *  \note A single palette can be shared with many surfaces.
slouken@2275
   132
 */
slouken@2275
   133
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
slouken@2275
   134
                                                  SDL_Palette * palette);
slouken@2275
   135
slouken@3341
   136
/**
slouken@3407
   137
 *  \brief Sets up a surface for directly accessing the pixels.
slouken@3407
   138
 *  
slouken@3407
   139
 *  Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
slouken@3407
   140
 *  to and read from \c surface->pixels, using the pixel format stored in 
slouken@3407
   141
 *  \c surface->format.  Once you are done accessing the surface, you should 
slouken@3407
   142
 *  use SDL_UnlockSurface() to release it.
slouken@3407
   143
 *  
slouken@3407
   144
 *  Not all surfaces require locking.  If SDL_MUSTLOCK(surface) evaluates
slouken@3407
   145
 *  to 0, then you can read and write to the surface at any time, and the
slouken@3407
   146
 *  pixel format of the surface will not change.
slouken@3407
   147
 *  
slouken@3407
   148
 *  No operating system or library calls should be made between lock/unlock
slouken@3407
   149
 *  pairs, as critical system locks may be held during this time.
slouken@3407
   150
 *  
slouken@3407
   151
 *  SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
slouken@3407
   152
 *  
slouken@3407
   153
 *  \sa SDL_UnlockSurface()
slouken@2275
   154
 */
slouken@2275
   155
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
slouken@3341
   156
/** \sa SDL_LockSurface() */
slouken@2275
   157
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
slouken@2275
   158
slouken@3341
   159
/**
slouken@4971
   160
 *  Load a surface from a seekable SDL data stream (memory or file).
slouken@3407
   161
 *  
slouken@4971
   162
 *  If \c freesrc is non-zero, the stream will be closed after being read.
slouken@3407
   163
 *  
slouken@3407
   164
 *  The new surface should be freed with SDL_FreeSurface().
slouken@3407
   165
 *  
slouken@3407
   166
 *  \return the new surface, or NULL if there was an error.
slouken@2275
   167
 */
slouken@2275
   168
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
slouken@2275
   169
                                                    int freesrc);
slouken@2275
   170
slouken@3407
   171
/**
slouken@3407
   172
 *  Load a surface from a file.
slouken@3407
   173
 *  
slouken@3407
   174
 *  Convenience macro.
slouken@3407
   175
 */
slouken@2275
   176
#define SDL_LoadBMP(file)	SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
slouken@2275
   177
slouken@3341
   178
/**
slouken@4971
   179
 *  Save a surface to a seekable SDL data stream (memory or file).
slouken@3407
   180
 *  
slouken@4971
   181
 *  If \c freedst is non-zero, the stream will be closed after being written.
slouken@3407
   182
 *  
slouken@3407
   183
 *  \return 0 if successful or -1 if there was an error.
slouken@2275
   184
 */
slouken@2275
   185
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
slouken@2275
   186
    (SDL_Surface * surface, SDL_RWops * dst, int freedst);
slouken@2275
   187
slouken@3407
   188
/** 
slouken@3407
   189
 *  Save a surface to a file.
slouken@3407
   190
 *  
slouken@3407
   191
 *  Convenience macro.
slouken@3407
   192
 */
slouken@2275
   193
#define SDL_SaveBMP(surface, file) \
slouken@2275
   194
		SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
slouken@2275
   195
slouken@3341
   196
/**
slouken@3407
   197
 *  \brief Sets the RLE acceleration hint for a surface.
slouken@3407
   198
 *  
slouken@3407
   199
 *  \return 0 on success, or -1 if the surface is not valid
slouken@3407
   200
 *  
slouken@3407
   201
 *  \note If RLE is enabled, colorkey and alpha blending blits are much faster,
slouken@3407
   202
 *        but the surface must be locked before directly accessing the pixels.
slouken@2275
   203
 */
slouken@2275
   204
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
slouken@2275
   205
                                              int flag);
slouken@2275
   206
slouken@3341
   207
/**
slouken@3407
   208
 *  \brief Sets the color key (transparent pixel) in a blittable surface.
slouken@3407
   209
 *  
slouken@3407
   210
 *  \param surface The surface to update
slouken@3407
   211
 *  \param flag Non-zero to enable colorkey and 0 to disable colorkey 
slouken@3407
   212
 *  \param key The transparent pixel in the native surface format
slouken@3407
   213
 *  
slouken@3407
   214
 *  \return 0 on success, or -1 if the surface is not valid
slouken@2275
   215
 */
slouken@2275
   216
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
slouken@3560
   217
                                            int flag, Uint32 key);
slouken@2275
   218
slouken@3341
   219
/**
slouken@3550
   220
 *  \brief Gets the color key (transparent pixel) in a blittable surface.
slouken@3407
   221
 *  
slouken@3407
   222
 *  \param surface The surface to update
slouken@3407
   223
 *  \param key A pointer filled in with the transparent pixel in the native 
slouken@3407
   224
 *             surface format
slouken@3407
   225
 *  
slouken@3407
   226
 *  \return 0 on success, or -1 if the surface is not valid or colorkey is not 
slouken@3407
   227
 *          enabled.
slouken@3103
   228
 */
slouken@3103
   229
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
slouken@3103
   230
                                            Uint32 * key);
slouken@3103
   231
slouken@2275
   232
/**
slouken@3407
   233
 *  \brief Set an additional color value used in blit operations.
slouken@3407
   234
 *  
slouken@3407
   235
 *  \param surface The surface to update.
slouken@4971
   236
 *  \param r The red color value multiplied into blit operations.
slouken@4971
   237
 *  \param g The green color value multiplied into blit operations.
slouken@4971
   238
 *  \param b The blue color value multiplied into blit operations.
slouken@3407
   239
 *  
slouken@3407
   240
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   241
 *  
slouken@3407
   242
 *  \sa SDL_GetSurfaceColorMod()
slouken@2275
   243
 */
slouken@2275
   244
extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   245
                                                   Uint8 r, Uint8 g, Uint8 b);
slouken@2275
   246
slouken@2275
   247
slouken@2275
   248
/**
slouken@3407
   249
 *  \brief Get the additional color value used in blit operations.
slouken@3407
   250
 *  
slouken@3407
   251
 *  \param surface The surface to query.
slouken@4971
   252
 *  \param r A pointer filled in with the current red color value.
slouken@4971
   253
 *  \param g A pointer filled in with the current green color value.
slouken@4971
   254
 *  \param b A pointer filled in with the current blue color value.
slouken@3407
   255
 *  
slouken@3407
   256
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   257
 *  
slouken@3407
   258
 *  \sa SDL_SetSurfaceColorMod()
slouken@2275
   259
 */
slouken@2275
   260
extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
slouken@2275
   261
                                                   Uint8 * r, Uint8 * g,
slouken@2275
   262
                                                   Uint8 * b);
slouken@2275
   263
slouken@2275
   264
/**
slouken@3407
   265
 *  \brief Set an additional alpha value used in blit operations.
slouken@3407
   266
 *  
slouken@3407
   267
 *  \param surface The surface to update.
slouken@4971
   268
 *  \param alpha The alpha value multiplied into blit operations.
slouken@3407
   269
 *  
slouken@3407
   270
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   271
 *  
slouken@3407
   272
 *  \sa SDL_GetSurfaceAlphaMod()
slouken@2275
   273
 */
slouken@2275
   274
extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   275
                                                   Uint8 alpha);
slouken@2275
   276
slouken@2275
   277
/**
slouken@3407
   278
 *  \brief Get the additional alpha value used in blit operations.
slouken@3407
   279
 *  
slouken@3407
   280
 *  \param surface The surface to query.
slouken@4971
   281
 *  \param alpha A pointer filled in with the current alpha value.
slouken@3407
   282
 *  
slouken@3407
   283
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   284
 *  
slouken@3407
   285
 *  \sa SDL_SetSurfaceAlphaMod()
slouken@2275
   286
 */
slouken@2275
   287
extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
slouken@2275
   288
                                                   Uint8 * alpha);
slouken@2275
   289
slouken@2275
   290
/**
slouken@3407
   291
 *  \brief Set the blend mode used for blit operations.
slouken@3407
   292
 *  
slouken@3407
   293
 *  \param surface The surface to update.
slouken@3407
   294
 *  \param blendMode ::SDL_BlendMode to use for blit blending.
slouken@3407
   295
 *  
slouken@3407
   296
 *  \return 0 on success, or -1 if the parameters are not valid.
slouken@3407
   297
 *  
slouken@3407
   298
 *  \sa SDL_GetSurfaceBlendMode()
slouken@2275
   299
 */
slouken@2275
   300
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   301
                                                    SDL_BlendMode blendMode);
slouken@2275
   302
slouken@2275
   303
/**
slouken@3407
   304
 *  \brief Get the blend mode used for blit operations.
slouken@3407
   305
 *  
slouken@3407
   306
 *  \param surface   The surface to query.
slouken@3407
   307
 *  \param blendMode A pointer filled in with the current blend mode.
slouken@3407
   308
 *  
slouken@3407
   309
 *  \return 0 on success, or -1 if the surface is not valid.
slouken@3407
   310
 *  
slouken@3407
   311
 *  \sa SDL_SetSurfaceBlendMode()
slouken@2275
   312
 */
slouken@2275
   313
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
slouken@4929
   314
                                                    SDL_BlendMode *blendMode);
slouken@2275
   315
slouken@2275
   316
/**
slouken@3407
   317
 *  Sets the clipping rectangle for the destination surface in a blit.
slouken@3407
   318
 *  
slouken@3407
   319
 *  If the clip rectangle is NULL, clipping will be disabled.
slouken@3407
   320
 *  
slouken@3407
   321
 *  If the clip rectangle doesn't intersect the surface, the function will
slouken@3407
   322
 *  return SDL_FALSE and blits will be completely clipped.  Otherwise the
slouken@3407
   323
 *  function returns SDL_TRUE and blits to the surface will be clipped to
slouken@3407
   324
 *  the intersection of the surface area and the clipping rectangle.
slouken@3407
   325
 *  
slouken@3407
   326
 *  Note that blits are automatically clipped to the edges of the source
slouken@3407
   327
 *  and destination surfaces.
slouken@2275
   328
 */
slouken@2275
   329
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
slouken@2275
   330
                                                 const SDL_Rect * rect);
slouken@2275
   331
slouken@3341
   332
/**
slouken@3407
   333
 *  Gets the clipping rectangle for the destination surface in a blit.
slouken@3407
   334
 *  
slouken@3407
   335
 *  \c rect must be a pointer to a valid rectangle which will be filled
slouken@3407
   336
 *  with the correct values.
slouken@2275
   337
 */
slouken@2275
   338
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
slouken@2275
   339
                                             SDL_Rect * rect);
slouken@2275
   340
slouken@3341
   341
/**
slouken@3407
   342
 *  Creates a new surface of the specified format, and then copies and maps 
slouken@3407
   343
 *  the given surface to it so the blit of the converted surface will be as 
slouken@3407
   344
 *  fast as possible.  If this function fails, it returns NULL.
slouken@3407
   345
 *  
slouken@3407
   346
 *  The \c flags parameter is passed to SDL_CreateRGBSurface() and has those 
slouken@3407
   347
 *  semantics.  You can also pass ::SDL_RLEACCEL in the flags parameter and
slouken@3407
   348
 *  SDL will try to RLE accelerate colorkey and alpha blits in the resulting
slouken@3407
   349
 *  surface.
slouken@2275
   350
 */
slouken@2275
   351
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
slouken@2275
   352
    (SDL_Surface * src, SDL_PixelFormat * fmt, Uint32 flags);
slouken@5375
   353
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
slouken@5375
   354
    (SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
slouken@2275
   355
slouken@3341
   356
/**
slouken@3434
   357
 * \brief Copy a block of pixels of one format to another format
slouken@6041
   358
 *  
slouken@6041
   359
 *  \return 0 on success, or -1 if there was an error
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@5297
   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
ken@5499
   470
#define SDL_BlitScaled SDL_UpperBlitScaled
ken@5499
   471
ken@5296
   472
/**
ken@5499
   473
 *  This is the public scaled blit function, SDL_BlitScaled(), and it performs
ken@5499
   474
 *  rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
ken@5296
   475
 */
ken@5499
   476
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
ken@5296
   477
    (SDL_Surface * src, const SDL_Rect * srcrect,
ken@5499
   478
    SDL_Surface * dst, SDL_Rect * dstrect);
ken@5499
   479
ken@5499
   480
/**
ken@5499
   481
 *  This is a semi-private blit function and it performs low-level surface
ken@5499
   482
 *  scaled blitting only.
ken@5499
   483
 */
ken@5499
   484
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
ken@5499
   485
    (SDL_Surface * src, SDL_Rect * srcrect,
ken@5499
   486
    SDL_Surface * dst, SDL_Rect * dstrect);
ken@5296
   487
ken@5296
   488
slouken@2275
   489
/* Ends C function definitions when using C++ */
slouken@2275
   490
#ifdef __cplusplus
slouken@2275
   491
/* *INDENT-OFF* */
slouken@2275
   492
}
slouken@2275
   493
/* *INDENT-ON* */
slouken@2275
   494
#endif
slouken@2275
   495
#include "close_code.h"
slouken@2275
   496
slouken@2275
   497
#endif /* _SDL_surface_h */
slouken@2275
   498
slouken@2275
   499
/* vi: set ts=4 sw=4 expandtab: */