annotate include/SDL_surface.h @ 3593:b931bcfd94a0

In the process of adding rectangle drawing
author Sam Lantinga <slouken@libsdl.org>
date Fri, 18 Dec 2009 07:03:09 +0000
parents 5543db4239e6
children f638ded38b8a
rev   line source
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
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2828
diff changeset
3 Copyright (C) 1997-2009 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"
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #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
36
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 #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
38 /* 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
39 #ifdef __cplusplus
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 /* *INDENT-OFF* */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 extern "C" {
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 /* *INDENT-ON* */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #endif
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
45 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
46 * \name Surface flags
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
47 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
48 * 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
49 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
50 * \internal
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
51 * Used internally (read-only).
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
52 */
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 #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
55 #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
56 /*@}*//*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
57
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
58 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
59 * 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
60 */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 #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
62
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
64 * \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
65 *
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
66 * \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
67 * 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
68 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 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
70 {
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 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
72 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
73 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
74 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
75 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
76
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
77 /** Application data associated with the surfade */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 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
79
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
80 /** 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
81 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
82 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
83
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
84 /** 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
85 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
86
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
87 /** 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
88 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
89
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
90 /** format version, bumped at every change to invalidate blit maps */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 unsigned int format_version; /**< Private */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
93 /** 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
94 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
95 } SDL_Surface;
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
98 * \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
99 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 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
101 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
102
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
103 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
104 * Allocate and free an RGB surface (must be called after SDL_SetVideoMode).
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
105 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
106 * 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
107 * 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
108 * flags '[RGB]mask'.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
109 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
110 * 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
111 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
112 * \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
113 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 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
115 (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
116 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
117 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
118 int width,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 int height,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 int depth,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 int pitch,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 Uint32 Rmask,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 Uint32 Gmask,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 Uint32 Bmask,
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 Uint32 Amask);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 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
127
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
129 * \brief Set the palette used by a surface.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
130 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
131 * \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
132 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
133 * \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
134 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 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
136 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
137
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
138 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
139 * \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
140 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
141 * 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
142 * 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
143 * \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
144 * use SDL_UnlockSurface() to release it.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
145 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
146 * 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
147 * 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
148 * pixel format of the surface will not change.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
149 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
150 * 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
151 * 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
152 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
153 * 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
154 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
155 * \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
156 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
158 /** \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
159 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
160
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
161 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
162 * Load a surface from a seekable SDL data source (memory or file).
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
163 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
164 * If \c freesrc is non-zero, the source will be closed after being read.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
165 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
166 * The new surface should be freed with SDL_FreeSurface().
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
167 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
168 * \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
169 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 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
171 int freesrc);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
173 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
174 * Load a surface from a file.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
175 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
176 * Convenience macro.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
177 */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 #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
179
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
180 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
181 * Save a surface to a seekable SDL data source (memory or file).
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
182 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
183 * If \c freedst is non-zero, the source will be closed after being written.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
184 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
185 * \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
186 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 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
188 (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
189
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
190 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
191 * Save a surface to a file.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
192 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
193 * Convenience macro.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
194 */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 #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
196 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
197
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
198 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
199 * \brief Sets the RLE acceleration hint for a surface.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
200 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
201 * \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
202 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
203 * \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
204 * 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
205 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 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
207 int flag);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
209 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
210 * \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
211 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
212 * \param surface The surface to update
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
213 * \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
214 * \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
215 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
216 * \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
217 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 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
219 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
220
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
221 /**
3550
6b69c5def097 Minor documentation fix
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
222 * \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
223 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
224 * \param surface The surface to update
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
225 * \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
226 * surface format
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
227 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
228 * \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
229 * enabled.
3103
7be21a78777e Added SDL_GetColorKey()
Sam Lantinga <slouken@libsdl.org>
parents: 3026
diff changeset
230 */
7be21a78777e Added SDL_GetColorKey()
Sam Lantinga <slouken@libsdl.org>
parents: 3026
diff changeset
231 extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
7be21a78777e Added SDL_GetColorKey()
Sam Lantinga <slouken@libsdl.org>
parents: 3026
diff changeset
232 Uint32 * key);
7be21a78777e Added SDL_GetColorKey()
Sam Lantinga <slouken@libsdl.org>
parents: 3026
diff changeset
233
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
235 * \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
236 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
237 * \param surface The surface to update.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
238 * \param r The red source color value multiplied into blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
239 * \param g The green source color value multiplied into blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
240 * \param b The blue source color value multiplied into blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
241 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
242 * \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
243 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
244 * \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
245 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 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
247 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
248
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
251 * \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
252 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
253 * \param surface The surface to query.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
254 * \param r A pointer filled in with the source red color value.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
255 * \param g A pointer filled in with the source green color value.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
256 * \param b A pointer filled in with the source blue color value.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
257 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
258 * \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
259 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
260 * \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
261 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 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
263 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
264 Uint8 * b);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
267 * \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
268 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
269 * \param surface The surface to update.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
270 * \param alpha The source alpha value multiplied into blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
271 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
272 * \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
273 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
274 * \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
275 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 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
277 Uint8 alpha);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
280 * \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
281 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
282 * \param surface The surface to query.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
283 * \param alpha A pointer filled in with the source alpha value.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
284 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
285 * \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
286 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
287 * \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
288 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 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
290 Uint8 * alpha);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
293 * \brief Set the blend mode used for blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
294 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
295 * \param surface The surface to update.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
296 * \param blendMode ::SDL_BlendMode to use for blit blending.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
297 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
298 * \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
299 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
300 * \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
301 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(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
303 int blendMode);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
306 * \brief Get the blend mode used for blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
307 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
308 * \param surface The surface to query.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
309 * \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
310 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
311 * \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
312 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
313 * \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
314 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(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
316 int *blendMode);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
319 * \brief Set the scale mode used for blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
320 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
321 * \param surface The surface to update.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
322 * \param scaleMode ::SDL_TextureScaleMode to use for blit scaling.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
323 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
324 * \return 0 on success, or -1 if the surface is not valid or the scale mode is
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
325 * not supported.
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 If the scale mode is not supported, the closest supported mode is
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
328 * chosen. Currently only ::SDL_TEXTURESCALEMODE_FAST is supported on
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
329 * surfaces.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
330 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
331 * \sa SDL_GetSurfaceScaleMode()
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(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
334 int scaleMode);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
337 * \brief Get the scale mode used for blit operations.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
338 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
339 * \param surface The surface to query.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
340 * \param scaleMode A pointer filled in with the current scale mode.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
341 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
342 * \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
343 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
344 * \sa SDL_SetSurfaceScaleMode()
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(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
347 int *scaleMode);
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
349 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
350 * 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
351 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
352 * 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
353 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
354 * 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
355 * 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
356 * 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
357 * 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
358 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
359 * 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
360 * 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
361 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 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
363 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
364
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
365 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
366 * 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
367 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
368 * \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
369 * 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
370 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 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
372 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
373
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
374 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
375 * 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
376 * 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
377 * 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
378 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
379 * 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
380 * 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
381 * 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
382 * surface.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
383 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
384 * This function is used internally by SDL_DisplayFormat().
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 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
387 (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
388
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
389 /**
3434
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
390 * \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
391 */
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
392 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
393 Uint32 src_format,
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
394 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
395 Uint32 dst_format,
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
396 void * dst, int dst_pitch);
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
397
147d6ef5be03 Added a utility function to convert blocks of pixels
Sam Lantinga <slouken@libsdl.org>
parents: 3407
diff changeset
398 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
399 * Draws a point with \c color.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
400 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
401 * 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
402 * can be generated by the SDL_MapRGB() function.
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 * \return 0 on success, or -1 on error.
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
405 */
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
406 extern DECLSPEC int SDLCALL SDL_DrawPoint
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
407 (SDL_Surface * dst, int x, int y, Uint32 color);
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
408 extern DECLSPEC int SDLCALL SDL_DrawPoints
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
409 (SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
410
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
411 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
412 * Blends a point with an RGBA value.
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 * 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
415 * can be generated by the SDL_MapRGB() function.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
416 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
417 * \return 0 on success, or -1 on error.
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
418 */
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
419 extern DECLSPEC int SDLCALL SDL_BlendDrawPoint
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
420 (SDL_Surface * dst, int x, int y,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
421 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
422 extern DECLSPEC int SDLCALL SDL_BlendPoints
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
423 (SDL_Surface * dst, const SDL_Point * points, int count,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
424 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2888
diff changeset
425
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
426 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
427 * Draws a line with \c color.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
428 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
429 * 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
430 * can be generated by the SDL_MapRGB() function.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
431 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
432 * \return 0 on success, or -1 on error.
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
433 */
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
434 extern DECLSPEC int SDLCALL SDL_DrawLine
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
435 (SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color);
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
436 extern DECLSPEC int SDLCALL SDL_DrawLines
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
437 (SDL_Surface * dst, const SDL_Point * points, int count, Uint32 color);
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
438
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
439 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
440 * Blends an RGBA value along a line.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
441 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
442 * \return 0 on success, or -1 on error.
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
443 */
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
444 extern DECLSPEC int SDLCALL SDL_BlendLine
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
445 (SDL_Surface * dst, int x1, int y1, int x2, int y2,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
446 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
447 extern DECLSPEC int SDLCALL SDL_BlendLines
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
448 (SDL_Surface * dst, const SDL_Point * points, int count,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
449 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
450
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
451 /**
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
452 * Draws the given rectangle with \c color.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
453 *
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
454 * If \c rect is NULL, the whole surface will be outlined with \c color.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
455 *
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
456 * The color should be a pixel of the format used by the surface, and
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
457 * can be generated by the SDL_MapRGB() function.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
458 *
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
459 * \return 0 on success, or -1 on error.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
460 */
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
461 extern DECLSPEC int SDLCALL SDL_DrawRect
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
462 (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
463 extern DECLSPEC int SDLCALL SDL_DrawRects
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
464 (SDL_Surface * dst, const SDL_Rect ** rects, int count, Uint32 color);
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
465
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
466 /**
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
467 * Blends the given rectangle with \c color.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
468 *
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
469 * If \c rect is NULL, the whole surface will have a blended outline of \c color.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
470 *
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
471 * \return 0 on success, or -1 on error.
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
472 */
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
473 extern DECLSPEC int SDLCALL SDL_BlendRect
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
474 (SDL_Surface * dst, const SDL_Rect * rect,
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
475 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
476 extern DECLSPEC int SDLCALL SDL_BlendRects
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
477 (SDL_Surface * dst, const SDL_Rect ** rects, int count,
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
478 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
479
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
480 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
481 * 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
482 *
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
483 * 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
484 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
485 * 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
486 * can be generated by the SDL_MapRGB() function.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
487 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
488 * \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
489 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490 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
491 (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
492 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
493 (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
494
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
495 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
496 * Blends an RGBA value into the given rectangle.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
497 *
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
498 * If \c rect is NULL, the whole surface will be blended with \c color.
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
499 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
500 * \return This function returns 0 on success, or -1 on error.
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
501 */
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
502 extern DECLSPEC int SDLCALL SDL_BlendFillRect
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
503 (SDL_Surface * dst, const SDL_Rect * rect,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
504 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3560
diff changeset
505 extern DECLSPEC int SDLCALL SDL_BlendFillRects
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
506 (SDL_Surface * dst, const SDL_Rect ** rects, int count,
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3434
diff changeset
507 int blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
2888
32e8bbba1e94 Added stubs for software implementations of blending fills and line drawing
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
508
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
509 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
510 * 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
511 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
512 * This assumes that the source and destination rectangles are
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
513 * 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
514 * 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
515 * 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
516 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
517 * \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
518 *
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
519 * 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
520 *
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
521 * 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
522 * are defined as follows:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
523 * \verbatim
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
524 RGBA->RGB:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
525 SDL_SRCALPHA set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
526 alpha-blend (using alpha-channel).
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
527 SDL_SRCCOLORKEY ignored.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
528 SDL_SRCALPHA not set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
529 copy RGB.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
530 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
531 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
532 comparison.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
533
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
534 RGB->RGBA:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
535 SDL_SRCALPHA set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
536 alpha-blend (using the source per-surface alpha value);
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
537 set destination alpha to opaque.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
538 SDL_SRCALPHA not set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
539 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
540 both:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
541 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
542 source colour key.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
543
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
544 RGBA->RGBA:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
545 SDL_SRCALPHA set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
546 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
547 leave destination alpha untouched. [Note: is this correct?]
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
548 SDL_SRCCOLORKEY ignored.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
549 SDL_SRCALPHA not set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
550 copy all of RGBA to the destination.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
551 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
552 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
553 comparison.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
554
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
555 RGB->RGB:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
556 SDL_SRCALPHA set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
557 alpha-blend (using the source per-surface alpha value).
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
558 SDL_SRCALPHA not set:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
559 copy RGB.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
560 both:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
561 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
562 source colour key.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
563 \endverbatim
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
564 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
565 * If either of the surfaces were in video memory, and the blit returns -2,
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
566 * the video memory was lost, so it should be reloaded with artwork and
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
567 * re-blitted:
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
568 * @code
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
569 * while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
570 * while ( SDL_LockSurface(image) < 0 )
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
571 * Sleep(10);
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
572 * -- Write image pixels to image->pixels --
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
573 * SDL_UnlockSurface(image);
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
574 * }
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
575 * @endcode
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
576 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
577 * This happens under DirectX 5.0 when the system switches away from your
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
578 * fullscreen application. The lock will also fail until you have access
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
579 * to the video memory again.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
580 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
581 * 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
582 * 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
583 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
584 #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
585
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
586 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
587 * 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
588 * rectangle validation and clipping before passing it to SDL_LowerBlit()
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
589 */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
590 extern DECLSPEC int SDLCALL SDL_UpperBlit
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
591 (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
592 SDL_Surface * dst, SDL_Rect * dstrect);
3341
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
593
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
594 /**
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
595 * 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
596 * blitting only.
710139a1692d Fixed bug #826
Sam Lantinga <slouken@libsdl.org>
parents: 3103
diff changeset
597 */
2275
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
598 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
599 (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
600 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
601
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
602 /**
3407
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
603 * \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
604 * same pixel format.
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
605 *
d3baf5ac4e37 Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents: 3341
diff changeset
606 * \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
607 */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
608 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
609 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
610 SDL_Surface * dst,
2828
7e5ff6cd05bf Added very slow software scaling to the X11 renderer
Sam Lantinga <slouken@libsdl.org>
parents: 2807
diff changeset
611 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
612
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
613 /* 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
614 #ifdef __cplusplus
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
615 /* *INDENT-OFF* */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
616 }
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
617 /* *INDENT-ON* */
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
618 #endif
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
619 #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
620
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
621 #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
622
12ea0fdc0df2 Split out the SDL_rect and SDL_surface functions into their own headers.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
623 /* vi: set ts=4 sw=4 expandtab: */