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