gosu 1.1.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +1 -1
- data/dependencies/SDL/include/SDL.h +108 -14
- data/dependencies/SDL/include/SDL_assert.h +81 -50
- data/dependencies/SDL/include/SDL_atomic.h +135 -35
- data/dependencies/SDL/include/SDL_audio.h +960 -355
- data/dependencies/SDL/include/SDL_bits.h +11 -6
- data/dependencies/SDL/include/SDL_blendmode.h +91 -14
- data/dependencies/SDL/include/SDL_clipboard.h +30 -7
- data/dependencies/SDL/include/SDL_config.h +277 -27
- data/dependencies/SDL/include/SDL_config_android.h +13 -38
- data/dependencies/SDL/include/SDL_config_iphoneos.h +21 -62
- data/dependencies/SDL/include/SDL_config_macosx.h +23 -92
- data/dependencies/SDL/include/SDL_config_minimal.h +1 -4
- data/dependencies/SDL/include/SDL_config_pandora.h +15 -22
- data/dependencies/SDL/include/SDL_config_psp.h +16 -37
- data/dependencies/SDL/include/SDL_config_windows.h +28 -91
- data/dependencies/SDL/include/SDL_config_winrt.h +33 -61
- data/dependencies/SDL/include/SDL_config_wiz.h +28 -56
- data/dependencies/SDL/include/SDL_copying.h +1 -1
- data/dependencies/SDL/include/SDL_cpuinfo.h +331 -71
- data/dependencies/SDL/include/SDL_egl.h +906 -280
- data/dependencies/SDL/include/SDL_endian.h +101 -47
- data/dependencies/SDL/include/SDL_error.h +70 -19
- data/dependencies/SDL/include/SDL_events.h +387 -79
- data/dependencies/SDL/include/SDL_filesystem.h +73 -64
- data/dependencies/SDL/include/SDL_gamecontroller.h +585 -125
- data/dependencies/SDL/include/SDL_gesture.h +36 -6
- data/dependencies/SDL/include/SDL_haptic.h +304 -210
- data/dependencies/SDL/include/SDL_hidapi.h +451 -0
- data/dependencies/SDL/include/SDL_hints.h +1286 -897
- data/dependencies/SDL/include/SDL_joystick.h +577 -130
- data/dependencies/SDL/include/SDL_keyboard.h +162 -63
- data/dependencies/SDL/include/SDL_keycode.h +7 -5
- data/dependencies/SDL/include/SDL_loadso.h +42 -8
- data/dependencies/SDL/include/SDL_locale.h +34 -32
- data/dependencies/SDL/include/SDL_log.h +212 -19
- data/dependencies/SDL/include/SDL_main.h +72 -17
- data/dependencies/SDL/include/SDL_messagebox.h +70 -23
- data/dependencies/SDL/include/SDL_metal.h +27 -32
- data/dependencies/SDL/include/SDL_misc.h +19 -15
- data/dependencies/SDL/include/SDL_mouse.h +262 -110
- data/dependencies/SDL/include/SDL_mutex.h +286 -66
- data/dependencies/SDL/include/SDL_name.h +1 -1
- data/dependencies/SDL/include/SDL_opengl.h +1 -1
- data/dependencies/SDL/include/SDL_opengles.h +1 -1
- data/dependencies/SDL/include/SDL_opengles2.h +2 -2
- data/dependencies/SDL/include/SDL_pixels.h +199 -34
- data/dependencies/SDL/include/SDL_platform.h +39 -2
- data/dependencies/SDL/include/SDL_power.h +23 -10
- data/dependencies/SDL/include/SDL_quit.h +1 -1
- data/dependencies/SDL/include/SDL_rect.h +78 -28
- data/dependencies/SDL/include/SDL_render.h +1204 -472
- data/dependencies/SDL/include/SDL_revision.h +2 -2
- data/dependencies/SDL/include/SDL_rwops.h +605 -33
- data/dependencies/SDL/include/SDL_scancode.h +1 -1
- data/dependencies/SDL/include/SDL_sensor.h +76 -42
- data/dependencies/SDL/include/SDL_shape.h +38 -27
- data/dependencies/SDL/include/SDL_stdinc.h +96 -24
- data/dependencies/SDL/include/SDL_surface.h +571 -139
- data/dependencies/SDL/include/SDL_system.h +339 -101
- data/dependencies/SDL/include/SDL_syswm.h +50 -20
- data/dependencies/SDL/include/SDL_test.h +1 -1
- data/dependencies/SDL/include/SDL_test_assert.h +2 -2
- data/dependencies/SDL/include/SDL_test_common.h +23 -6
- data/dependencies/SDL/include/SDL_test_compare.h +1 -1
- data/dependencies/SDL/include/SDL_test_crc32.h +1 -1
- data/dependencies/SDL/include/SDL_test_font.h +3 -3
- data/dependencies/SDL/include/SDL_test_fuzzer.h +28 -26
- data/dependencies/SDL/include/SDL_test_harness.h +6 -6
- data/dependencies/SDL/include/SDL_test_images.h +1 -1
- data/dependencies/SDL/include/SDL_test_log.h +1 -1
- data/dependencies/SDL/include/SDL_test_md5.h +1 -1
- data/dependencies/SDL/include/SDL_test_memory.h +1 -1
- data/dependencies/SDL/include/SDL_test_random.h +2 -2
- data/dependencies/SDL/include/SDL_thread.h +226 -128
- data/dependencies/SDL/include/SDL_timer.h +129 -22
- data/dependencies/SDL/include/SDL_touch.h +48 -8
- data/dependencies/SDL/include/SDL_types.h +1 -1
- data/dependencies/SDL/include/SDL_version.h +72 -46
- data/dependencies/SDL/include/SDL_video.h +1266 -460
- data/dependencies/SDL/include/SDL_vulkan.h +100 -161
- data/dependencies/SDL/include/begin_code.h +22 -1
- data/dependencies/SDL/include/close_code.h +1 -1
- data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
- data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
- data/dependencies/SDL_sound/SDL_sound.c +83 -7
- data/dependencies/SDL_sound/SDL_sound.h +4 -4
- data/dependencies/SDL_sound/SDL_sound_aiff.c +9 -12
- data/dependencies/SDL_sound/SDL_sound_au.c +7 -7
- data/dependencies/SDL_sound/SDL_sound_coreaudio.c +3 -3
- data/dependencies/SDL_sound/SDL_sound_flac.c +1 -1
- data/dependencies/SDL_sound/SDL_sound_internal.h +17 -10
- data/dependencies/SDL_sound/SDL_sound_modplug.c +25 -27
- data/dependencies/SDL_sound/SDL_sound_mp3.c +5 -17
- data/dependencies/SDL_sound/SDL_sound_raw.c +11 -11
- data/dependencies/SDL_sound/SDL_sound_shn.c +8 -7
- data/dependencies/SDL_sound/SDL_sound_voc.c +6 -4
- data/dependencies/SDL_sound/SDL_sound_vorbis.c +6 -11
- data/dependencies/SDL_sound/SDL_sound_wav.c +35 -29
- data/dependencies/SDL_sound/dr_flac.h +618 -220
- data/dependencies/SDL_sound/dr_mp3.h +263 -94
- data/dependencies/SDL_sound/libmodplug/fastmix.c +58 -64
- data/dependencies/SDL_sound/libmodplug/libmodplug.h +25 -103
- data/dependencies/SDL_sound/libmodplug/load_669.c +14 -17
- data/dependencies/SDL_sound/libmodplug/load_amf.c +11 -7
- data/dependencies/SDL_sound/libmodplug/load_ams.c +65 -22
- data/dependencies/SDL_sound/libmodplug/load_dbm.c +8 -4
- data/dependencies/SDL_sound/libmodplug/load_dmf.c +55 -25
- data/dependencies/SDL_sound/libmodplug/load_far.c +9 -13
- data/dependencies/SDL_sound/libmodplug/load_gdm.c +448 -0
- data/dependencies/SDL_sound/libmodplug/load_it.c +45 -49
- data/dependencies/SDL_sound/libmodplug/load_mdl.c +80 -53
- data/dependencies/SDL_sound/libmodplug/load_med.c +20 -12
- data/dependencies/SDL_sound/libmodplug/load_mod.c +40 -15
- data/dependencies/SDL_sound/libmodplug/load_mt2.c +29 -17
- data/dependencies/SDL_sound/libmodplug/load_okt.c +12 -8
- data/dependencies/SDL_sound/libmodplug/load_psm.c +101 -78
- data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -17
- data/dependencies/SDL_sound/libmodplug/load_s3m.c +9 -7
- data/dependencies/SDL_sound/libmodplug/load_stm.c +3 -2
- data/dependencies/SDL_sound/libmodplug/load_ult.c +2 -2
- data/dependencies/SDL_sound/libmodplug/load_umx.c +315 -35
- data/dependencies/SDL_sound/libmodplug/load_xm.c +25 -21
- data/dependencies/SDL_sound/libmodplug/mmcmp.c +295 -149
- data/dependencies/SDL_sound/libmodplug/modplug.c +7 -123
- data/dependencies/SDL_sound/libmodplug/modplug.h +32 -29
- data/dependencies/SDL_sound/libmodplug/snd_dsp.c +0 -1
- data/dependencies/SDL_sound/libmodplug/snd_flt.c +2 -2
- data/dependencies/SDL_sound/libmodplug/snd_fx.c +24 -18
- data/dependencies/SDL_sound/libmodplug/sndfile.c +55 -156
- data/dependencies/SDL_sound/libmodplug/sndmix.c +7 -12
- data/dependencies/SDL_sound/libmodplug/tables.h +10 -15
- data/dependencies/SDL_sound/stb_vorbis.h +508 -325
- data/dependencies/{al_soft → mojoAL}/AL/al.h +38 -30
- data/dependencies/{al_soft → mojoAL}/AL/alc.h +27 -56
- data/dependencies/mojoAL/mojoal.c +4594 -0
- data/ext/gosu/extconf.rb +33 -30
- data/include/Gosu/Audio.hpp +70 -85
- data/include/Gosu/Color.hpp +63 -107
- data/include/Gosu/Font.hpp +44 -50
- data/include/Gosu/Fwd.hpp +1 -1
- data/include/Gosu/Graphics.hpp +64 -75
- data/include/Gosu/GraphicsBase.hpp +32 -39
- data/include/Gosu/Image.hpp +56 -62
- data/include/Gosu/ImageData.hpp +23 -27
- data/include/Gosu/Inspection.hpp +1 -4
- data/include/Gosu/Math.hpp +4 -16
- data/include/Gosu/Platform.hpp +1 -51
- data/include/Gosu/Text.hpp +37 -40
- data/include/Gosu/TextInput.hpp +34 -40
- data/include/Gosu/Utility.hpp +10 -8
- data/include/Gosu/Version.hpp +1 -1
- data/include/Gosu/Window.hpp +73 -70
- data/lib/SDL2.dll +0 -0
- data/lib/gosu/compat.rb +28 -37
- data/lib/gosu/swig_patches.rb +31 -3
- data/lib/gosu.rb +2 -2
- data/lib64/SDL2.dll +0 -0
- data/rdoc/gosu.rb +9 -1
- data/src/Audio.cpp +86 -86
- data/src/AudioFile.hpp +6 -6
- data/src/AudioFileAudioToolbox.cpp +1 -1
- data/src/AudioFileSDLSound.cpp +1 -1
- data/src/AudioImpl.hpp +5 -5
- data/src/Bitmap.cpp +13 -13
- data/src/BitmapIO.cpp +0 -20
- data/src/BlockAllocator.cpp +2 -1
- data/src/Channel.cpp +22 -20
- data/src/Color.cpp +62 -55
- data/src/EmptyImageData.hpp +16 -18
- data/src/FileUnix.cpp +1 -1
- data/src/FileWin.cpp +1 -1
- data/src/Font.cpp +52 -57
- data/src/GosuViewController.cpp +2 -0
- data/src/Graphics.cpp +135 -143
- data/src/Image.cpp +42 -42
- data/src/Input.cpp +1 -1
- data/src/InputUIKit.cpp +1 -1
- data/src/LargeImageData.cpp +120 -113
- data/src/LargeImageData.hpp +18 -16
- data/src/Log.hpp +6 -6
- data/src/Macro.cpp +124 -169
- data/src/Macro.hpp +11 -11
- data/src/Math.cpp +8 -1
- data/src/RenderState.hpp +5 -5
- data/src/Resolution.cpp +114 -61
- data/src/RubyGosu.cxx +470 -501
- data/src/RubyGosu.h +3 -2
- data/src/TexChunk.cpp +50 -41
- data/src/TexChunk.hpp +22 -22
- data/src/Text.cpp +58 -59
- data/src/TextBuilder.cpp +60 -57
- data/src/TextBuilder.hpp +20 -20
- data/src/TextInput.cpp +127 -135
- data/src/TrueTypeFont.cpp +108 -108
- data/src/TrueTypeFont.hpp +39 -38
- data/src/TrueTypeFontApple.cpp +27 -23
- data/src/TrueTypeFontUnix.cpp +21 -26
- data/src/TrueTypeFontWin.cpp +30 -30
- data/src/Utility.cpp +82 -23
- data/src/WinUtility.hpp +2 -1
- data/src/Window.cpp +103 -86
- data/src/WindowUIKit.cpp +48 -51
- metadata +8 -20
- data/dependencies/SDL/include/SDL_config_os2.h +0 -188
- data/dependencies/SDL_sound/libmodplug/load_abc.c +0 -4725
- data/dependencies/SDL_sound/libmodplug/load_mid.c +0 -1405
- data/dependencies/SDL_sound/libmodplug/load_pat.c +0 -1143
- data/dependencies/SDL_sound/libmodplug/load_pat.h +0 -25
- data/dependencies/al_soft/AL/alext.h +0 -585
- data/dependencies/al_soft/AL/efx-creative.h +0 -3
- data/dependencies/al_soft/AL/efx-presets.h +0 -402
- data/dependencies/al_soft/AL/efx.h +0 -762
- data/dependencies/al_soft/x64/libOpenAL32.dll.a +0 -0
- data/dependencies/al_soft/x86/libOpenAL32.dll.a +0 -0
- data/lib/OpenAL32.dll +0 -0
- data/lib64/OpenAL32.dll +0 -0
- data/src/UtilityApple.cpp +0 -16
- data/src/UtilityWin.cpp +0 -17
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
@@ -112,31 +112,108 @@ typedef enum
|
|
112
112
|
} SDL_YUV_CONVERSION_MODE;
|
113
113
|
|
114
114
|
/**
|
115
|
-
*
|
115
|
+
* Allocate a new RGB surface.
|
116
116
|
*
|
117
|
-
*
|
118
|
-
*
|
119
|
-
*
|
117
|
+
* If `depth` is 4 or 8 bits, an empty palette is allocated for the surface.
|
118
|
+
* If `depth` is greater than 8 bits, the pixel format is set using the
|
119
|
+
* [RGBA]mask parameters.
|
120
120
|
*
|
121
|
-
*
|
121
|
+
* The [RGBA]mask parameters are the bitmasks used to extract that color from
|
122
|
+
* a pixel. For instance, `Rmask` being 0xFF000000 means the red data is
|
123
|
+
* stored in the most significant byte. Using zeros for the RGB masks sets a
|
124
|
+
* default value, based on the depth. For example:
|
122
125
|
*
|
123
|
-
*
|
124
|
-
*
|
125
|
-
*
|
126
|
-
*
|
127
|
-
*
|
128
|
-
*
|
129
|
-
*
|
130
|
-
*
|
126
|
+
* ```c++
|
127
|
+
* SDL_CreateRGBSurface(0,w,h,32,0,0,0,0);
|
128
|
+
* ```
|
129
|
+
*
|
130
|
+
* However, using zero for the Amask results in an Amask of 0.
|
131
|
+
*
|
132
|
+
* By default surfaces with an alpha mask are set up for blending as with:
|
133
|
+
*
|
134
|
+
* ```c++
|
135
|
+
* SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND)
|
136
|
+
* ```
|
137
|
+
*
|
138
|
+
* You can change this by calling SDL_SetSurfaceBlendMode() and selecting a
|
139
|
+
* different `blendMode`.
|
140
|
+
*
|
141
|
+
* \param flags the flags are unused and should be set to 0
|
142
|
+
* \param width the width of the surface
|
143
|
+
* \param height the height of the surface
|
144
|
+
* \param depth the depth of the surface in bits
|
145
|
+
* \param Rmask the red mask for the pixels
|
146
|
+
* \param Gmask the green mask for the pixels
|
147
|
+
* \param Bmask the blue mask for the pixels
|
148
|
+
* \param Amask the alpha mask for the pixels
|
149
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
150
|
+
* call SDL_GetError() for more information.
|
151
|
+
*
|
152
|
+
* \since This function is available since SDL 2.0.0.
|
153
|
+
*
|
154
|
+
* \sa SDL_CreateRGBSurfaceFrom
|
155
|
+
* \sa SDL_CreateRGBSurfaceWithFormat
|
156
|
+
* \sa SDL_FreeSurface
|
131
157
|
*/
|
132
158
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
|
133
159
|
(Uint32 flags, int width, int height, int depth,
|
134
160
|
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
|
135
161
|
|
162
|
+
|
136
163
|
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Allocate a new RGB surface with a specific pixel format.
|
167
|
+
*
|
168
|
+
* This function operates mostly like SDL_CreateRGBSurface(), except instead
|
169
|
+
* of providing pixel color masks, you provide it with a predefined format
|
170
|
+
* from SDL_PixelFormatEnum.
|
171
|
+
*
|
172
|
+
* \param flags the flags are unused and should be set to 0
|
173
|
+
* \param width the width of the surface
|
174
|
+
* \param height the height of the surface
|
175
|
+
* \param depth the depth of the surface in bits
|
176
|
+
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
|
177
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
178
|
+
* call SDL_GetError() for more information.
|
179
|
+
*
|
180
|
+
* \since This function is available since SDL 2.0.5.
|
181
|
+
*
|
182
|
+
* \sa SDL_CreateRGBSurface
|
183
|
+
* \sa SDL_CreateRGBSurfaceFrom
|
184
|
+
* \sa SDL_FreeSurface
|
185
|
+
*/
|
137
186
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
|
138
187
|
(Uint32 flags, int width, int height, int depth, Uint32 format);
|
139
188
|
|
189
|
+
/**
|
190
|
+
* Allocate a new RGB surface with existing pixel data.
|
191
|
+
*
|
192
|
+
* This function operates mostly like SDL_CreateRGBSurface(), except it does
|
193
|
+
* not allocate memory for the pixel data, instead the caller provides an
|
194
|
+
* existing buffer of data for the surface to use.
|
195
|
+
*
|
196
|
+
* No copy is made of the pixel data. Pixel data is not managed automatically;
|
197
|
+
* you must free the surface before you free the pixel data.
|
198
|
+
*
|
199
|
+
* \param pixels a pointer to existing pixel data
|
200
|
+
* \param width the width of the surface
|
201
|
+
* \param height the height of the surface
|
202
|
+
* \param depth the depth of the surface in bits
|
203
|
+
* \param pitch the pitch of the surface in bytes
|
204
|
+
* \param Rmask the red mask for the pixels
|
205
|
+
* \param Gmask the green mask for the pixels
|
206
|
+
* \param Bmask the blue mask for the pixels
|
207
|
+
* \param Amask the alpha mask for the pixels
|
208
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
209
|
+
* call SDL_GetError() for more information.
|
210
|
+
*
|
211
|
+
* \since This function is available since SDL 2.0.0.
|
212
|
+
*
|
213
|
+
* \sa SDL_CreateRGBSurface
|
214
|
+
* \sa SDL_CreateRGBSurfaceWithFormat
|
215
|
+
* \sa SDL_FreeSurface
|
216
|
+
*/
|
140
217
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
141
218
|
int width,
|
142
219
|
int height,
|
@@ -146,74 +223,154 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
|
|
146
223
|
Uint32 Gmask,
|
147
224
|
Uint32 Bmask,
|
148
225
|
Uint32 Amask);
|
226
|
+
|
227
|
+
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Allocate a new RGB surface with with a specific pixel format and existing
|
231
|
+
* pixel data.
|
232
|
+
*
|
233
|
+
* This function operates mostly like SDL_CreateRGBSurfaceFrom(), except
|
234
|
+
* instead of providing pixel color masks, you provide it with a predefined
|
235
|
+
* format from SDL_PixelFormatEnum.
|
236
|
+
*
|
237
|
+
* No copy is made of the pixel data. Pixel data is not managed automatically;
|
238
|
+
* you must free the surface before you free the pixel data.
|
239
|
+
*
|
240
|
+
* \param pixels a pointer to existing pixel data
|
241
|
+
* \param width the width of the surface
|
242
|
+
* \param height the height of the surface
|
243
|
+
* \param depth the depth of the surface in bits
|
244
|
+
* \param pitch the pitch of the surface in bytes
|
245
|
+
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
|
246
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
247
|
+
* call SDL_GetError() for more information.
|
248
|
+
*
|
249
|
+
* \since This function is available since SDL 2.0.5.
|
250
|
+
*
|
251
|
+
* \sa SDL_CreateRGBSurfaceFrom
|
252
|
+
* \sa SDL_CreateRGBSurfaceWithFormat
|
253
|
+
* \sa SDL_FreeSurface
|
254
|
+
*/
|
149
255
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
|
150
256
|
(void *pixels, int width, int height, int depth, int pitch, Uint32 format);
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Free an RGB surface.
|
260
|
+
*
|
261
|
+
* It is safe to pass NULL to this function.
|
262
|
+
*
|
263
|
+
* \param surface the SDL_Surface to free.
|
264
|
+
*
|
265
|
+
* \since This function is available since SDL 2.0.0.
|
266
|
+
*
|
267
|
+
* \sa SDL_CreateRGBSurface
|
268
|
+
* \sa SDL_CreateRGBSurfaceFrom
|
269
|
+
* \sa SDL_LoadBMP
|
270
|
+
* \sa SDL_LoadBMP_RW
|
271
|
+
*/
|
151
272
|
extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
|
152
273
|
|
153
274
|
/**
|
154
|
-
*
|
275
|
+
* Set the palette used by a surface.
|
276
|
+
*
|
277
|
+
* A single palette can be shared with many surfaces.
|
155
278
|
*
|
156
|
-
*
|
279
|
+
* \param surface the SDL_Surface structure to update
|
280
|
+
* \param palette the SDL_Palette structure to use
|
281
|
+
* \returns 0 on success or a negative error code on failure; call
|
282
|
+
* SDL_GetError() for more information.
|
157
283
|
*
|
158
|
-
*
|
284
|
+
* \since This function is available since SDL 2.0.0.
|
159
285
|
*/
|
160
286
|
extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
|
161
287
|
SDL_Palette * palette);
|
162
288
|
|
163
289
|
/**
|
164
|
-
*
|
290
|
+
* Set up a surface for directly accessing the pixels.
|
165
291
|
*
|
166
|
-
*
|
167
|
-
*
|
168
|
-
*
|
169
|
-
*
|
292
|
+
* Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to
|
293
|
+
* and read from `surface->pixels`, using the pixel format stored in
|
294
|
+
* `surface->format`. Once you are done accessing the surface, you should use
|
295
|
+
* SDL_UnlockSurface() to release it.
|
170
296
|
*
|
171
|
-
*
|
172
|
-
*
|
173
|
-
*
|
297
|
+
* Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to
|
298
|
+
* 0, then you can read and write to the surface at any time, and the pixel
|
299
|
+
* format of the surface will not change.
|
174
300
|
*
|
175
|
-
*
|
176
|
-
*
|
301
|
+
* \param surface the SDL_Surface structure to be locked
|
302
|
+
* \returns 0 on success or a negative error code on failure; call
|
303
|
+
* SDL_GetError() for more information.
|
177
304
|
*
|
178
|
-
*
|
305
|
+
* \since This function is available since SDL 2.0.0.
|
179
306
|
*
|
180
|
-
*
|
307
|
+
* \sa SDL_MUSTLOCK
|
308
|
+
* \sa SDL_UnlockSurface
|
181
309
|
*/
|
182
310
|
extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
|
183
|
-
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Release a surface after directly accessing the pixels.
|
314
|
+
*
|
315
|
+
* \param surface the SDL_Surface structure to be unlocked
|
316
|
+
*
|
317
|
+
* \since This function is available since SDL 2.0.0.
|
318
|
+
*
|
319
|
+
* \sa SDL_LockSurface
|
320
|
+
*/
|
184
321
|
extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
|
185
322
|
|
186
323
|
/**
|
187
|
-
*
|
324
|
+
* Load a BMP image from a seekable SDL data stream.
|
188
325
|
*
|
189
|
-
*
|
326
|
+
* The new surface should be freed with SDL_FreeSurface(). Not doing so will
|
327
|
+
* result in a memory leak.
|
190
328
|
*
|
191
|
-
*
|
329
|
+
* src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
|
330
|
+
* Alternitavely, you might also use the macro SDL_LoadBMP to load a bitmap
|
331
|
+
* from a file, convert it to an SDL_Surface and then close the file.
|
192
332
|
*
|
193
|
-
*
|
333
|
+
* \param src the data stream for the surface
|
334
|
+
* \param freesrc non-zero to close the stream after being read
|
335
|
+
* \returns a pointer to a new SDL_Surface structure or NULL if there was an
|
336
|
+
* error; call SDL_GetError() for more information.
|
337
|
+
*
|
338
|
+
* \since This function is available since SDL 2.0.0.
|
339
|
+
*
|
340
|
+
* \sa SDL_FreeSurface
|
341
|
+
* \sa SDL_RWFromFile
|
342
|
+
* \sa SDL_LoadBMP
|
343
|
+
* \sa SDL_SaveBMP_RW
|
194
344
|
*/
|
195
345
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
|
196
346
|
int freesrc);
|
197
347
|
|
198
348
|
/**
|
199
|
-
*
|
349
|
+
* Load a surface from a file.
|
200
350
|
*
|
201
|
-
*
|
351
|
+
* Convenience macro.
|
202
352
|
*/
|
203
353
|
#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
|
204
354
|
|
205
355
|
/**
|
206
|
-
*
|
356
|
+
* Save a surface to a seekable SDL data stream in BMP format.
|
357
|
+
*
|
358
|
+
* Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
|
359
|
+
* BMP directly. Other RGB formats with 8-bit or higher get converted to a
|
360
|
+
* 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
|
361
|
+
* surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
|
362
|
+
* not supported.
|
207
363
|
*
|
208
|
-
*
|
209
|
-
*
|
210
|
-
*
|
211
|
-
*
|
212
|
-
*
|
364
|
+
* \param surface the SDL_Surface structure containing the image to be saved
|
365
|
+
* \param dst a data stream to save to
|
366
|
+
* \param freedst non-zero to close the stream after being written
|
367
|
+
* \returns 0 on success or a negative error code on failure; call
|
368
|
+
* SDL_GetError() for more information.
|
213
369
|
*
|
214
|
-
*
|
370
|
+
* \since This function is available since SDL 2.0.0.
|
215
371
|
*
|
216
|
-
*
|
372
|
+
* \sa SDL_LoadBMP_RW
|
373
|
+
* \sa SDL_SaveBMP
|
217
374
|
*/
|
218
375
|
extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
219
376
|
(SDL_Surface * surface, SDL_RWops * dst, int freedst);
|
@@ -227,190 +384,335 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
|
227
384
|
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
|
228
385
|
|
229
386
|
/**
|
230
|
-
*
|
387
|
+
* Set the RLE acceleration hint for a surface.
|
231
388
|
*
|
232
|
-
*
|
389
|
+
* If RLE is enabled, color key and alpha blending blits are much faster, but
|
390
|
+
* the surface must be locked before directly accessing the pixels.
|
233
391
|
*
|
234
|
-
*
|
235
|
-
*
|
392
|
+
* \param surface the SDL_Surface structure to optimize
|
393
|
+
* \param flag 0 to disable, non-zero to enable RLE acceleration
|
394
|
+
* \returns 0 on success or a negative error code on failure; call
|
395
|
+
* SDL_GetError() for more information.
|
396
|
+
*
|
397
|
+
* \since This function is available since SDL 2.0.0.
|
398
|
+
*
|
399
|
+
* \sa SDL_BlitSurface
|
400
|
+
* \sa SDL_LockSurface
|
401
|
+
* \sa SDL_UnlockSurface
|
236
402
|
*/
|
237
403
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
|
238
404
|
int flag);
|
239
405
|
|
240
406
|
/**
|
241
|
-
*
|
407
|
+
* Returns whether the surface is RLE enabled
|
408
|
+
*
|
409
|
+
* It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
|
410
|
+
*
|
411
|
+
* \param surface the SDL_Surface structure to query
|
412
|
+
* \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
|
242
413
|
*
|
243
|
-
*
|
414
|
+
* \since This function is available since SDL 2.0.14.
|
415
|
+
*
|
416
|
+
* \sa SDL_SetSurfaceRLE
|
244
417
|
*/
|
245
418
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
|
246
419
|
|
247
420
|
/**
|
248
|
-
*
|
421
|
+
* Set the color key (transparent pixel) in a surface.
|
422
|
+
*
|
423
|
+
* The color key defines a pixel value that will be treated as transparent in
|
424
|
+
* a blit. For example, one can use this to specify that cyan pixels should be
|
425
|
+
* considered transparent, and therefore not rendered.
|
426
|
+
*
|
427
|
+
* It is a pixel of the format used by the surface, as generated by
|
428
|
+
* SDL_MapRGB().
|
429
|
+
*
|
430
|
+
* RLE acceleration can substantially speed up blitting of images with large
|
431
|
+
* horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details.
|
249
432
|
*
|
250
|
-
*
|
251
|
-
*
|
252
|
-
*
|
433
|
+
* \param surface the SDL_Surface structure to update
|
434
|
+
* \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key
|
435
|
+
* \param key the transparent pixel
|
436
|
+
* \returns 0 on success or a negative error code on failure; call
|
437
|
+
* SDL_GetError() for more information.
|
253
438
|
*
|
254
|
-
*
|
439
|
+
* \since This function is available since SDL 2.0.0.
|
255
440
|
*
|
256
|
-
*
|
441
|
+
* \sa SDL_BlitSurface
|
442
|
+
* \sa SDL_GetColorKey
|
257
443
|
*/
|
258
444
|
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
|
259
445
|
int flag, Uint32 key);
|
260
446
|
|
261
447
|
/**
|
262
|
-
*
|
448
|
+
* Returns whether the surface has a color key
|
263
449
|
*
|
264
|
-
*
|
450
|
+
* It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
|
451
|
+
*
|
452
|
+
* \param surface the SDL_Surface structure to query
|
453
|
+
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
|
454
|
+
*
|
455
|
+
* \since This function is available since SDL 2.0.9.
|
456
|
+
*
|
457
|
+
* \sa SDL_SetColorKey
|
458
|
+
* \sa SDL_GetColorKey
|
265
459
|
*/
|
266
460
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
|
267
461
|
|
268
462
|
/**
|
269
|
-
*
|
463
|
+
* Get the color key (transparent pixel) for a surface.
|
464
|
+
*
|
465
|
+
* The color key is a pixel of the format used by the surface, as generated by
|
466
|
+
* SDL_MapRGB().
|
270
467
|
*
|
271
|
-
*
|
272
|
-
* \param key A pointer filled in with the transparent pixel in the native
|
273
|
-
* surface format
|
468
|
+
* If the surface doesn't have color key enabled this function returns -1.
|
274
469
|
*
|
275
|
-
*
|
276
|
-
*
|
470
|
+
* \param surface the SDL_Surface structure to query
|
471
|
+
* \param key a pointer filled in with the transparent pixel
|
472
|
+
* \returns 0 on success or a negative error code on failure; call
|
473
|
+
* SDL_GetError() for more information.
|
474
|
+
*
|
475
|
+
* \since This function is available since SDL 2.0.0.
|
476
|
+
*
|
477
|
+
* \sa SDL_BlitSurface
|
478
|
+
* \sa SDL_SetColorKey
|
277
479
|
*/
|
278
480
|
extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
|
279
481
|
Uint32 * key);
|
280
482
|
|
281
483
|
/**
|
282
|
-
*
|
484
|
+
* Set an additional color value multiplied into blit operations.
|
485
|
+
*
|
486
|
+
* When this surface is blitted, during the blit operation each source color
|
487
|
+
* channel is modulated by the appropriate color value according to the
|
488
|
+
* following formula:
|
489
|
+
*
|
490
|
+
* `srcC = srcC * (color / 255)`
|
283
491
|
*
|
284
|
-
*
|
285
|
-
*
|
286
|
-
*
|
287
|
-
*
|
492
|
+
* \param surface the SDL_Surface structure to update
|
493
|
+
* \param r the red color value multiplied into blit operations
|
494
|
+
* \param g the green color value multiplied into blit operations
|
495
|
+
* \param b the blue color value multiplied into blit operations
|
496
|
+
* \returns 0 on success or a negative error code on failure; call
|
497
|
+
* SDL_GetError() for more information.
|
288
498
|
*
|
289
|
-
*
|
499
|
+
* \since This function is available since SDL 2.0.0.
|
290
500
|
*
|
291
|
-
*
|
501
|
+
* \sa SDL_GetSurfaceColorMod
|
502
|
+
* \sa SDL_SetSurfaceAlphaMod
|
292
503
|
*/
|
293
504
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
|
294
505
|
Uint8 r, Uint8 g, Uint8 b);
|
295
506
|
|
296
507
|
|
297
508
|
/**
|
298
|
-
*
|
509
|
+
* Get the additional color value multiplied into blit operations.
|
299
510
|
*
|
300
|
-
*
|
301
|
-
*
|
302
|
-
*
|
303
|
-
*
|
511
|
+
* \param surface the SDL_Surface structure to query
|
512
|
+
* \param r a pointer filled in with the current red color value
|
513
|
+
* \param g a pointer filled in with the current green color value
|
514
|
+
* \param b a pointer filled in with the current blue color value
|
515
|
+
* \returns 0 on success or a negative error code on failure; call
|
516
|
+
* SDL_GetError() for more information.
|
304
517
|
*
|
305
|
-
*
|
518
|
+
* \since This function is available since SDL 2.0.0.
|
306
519
|
*
|
307
|
-
*
|
520
|
+
* \sa SDL_GetSurfaceAlphaMod
|
521
|
+
* \sa SDL_SetSurfaceColorMod
|
308
522
|
*/
|
309
523
|
extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
|
310
524
|
Uint8 * r, Uint8 * g,
|
311
525
|
Uint8 * b);
|
312
526
|
|
313
527
|
/**
|
314
|
-
*
|
528
|
+
* Set an additional alpha value used in blit operations.
|
315
529
|
*
|
316
|
-
*
|
317
|
-
*
|
530
|
+
* When this surface is blitted, during the blit operation the source alpha
|
531
|
+
* value is modulated by this alpha value according to the following formula:
|
318
532
|
*
|
319
|
-
*
|
533
|
+
* `srcA = srcA * (alpha / 255)`
|
320
534
|
*
|
321
|
-
*
|
535
|
+
* \param surface the SDL_Surface structure to update
|
536
|
+
* \param alpha the alpha value multiplied into blit operations
|
537
|
+
* \returns 0 on success or a negative error code on failure; call
|
538
|
+
* SDL_GetError() for more information.
|
539
|
+
*
|
540
|
+
* \since This function is available since SDL 2.0.0.
|
541
|
+
*
|
542
|
+
* \sa SDL_GetSurfaceAlphaMod
|
543
|
+
* \sa SDL_SetSurfaceColorMod
|
322
544
|
*/
|
323
545
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
|
324
546
|
Uint8 alpha);
|
325
547
|
|
326
548
|
/**
|
327
|
-
*
|
549
|
+
* Get the additional alpha value used in blit operations.
|
328
550
|
*
|
329
|
-
*
|
330
|
-
*
|
551
|
+
* \param surface the SDL_Surface structure to query
|
552
|
+
* \param alpha a pointer filled in with the current alpha value
|
553
|
+
* \returns 0 on success or a negative error code on failure; call
|
554
|
+
* SDL_GetError() for more information.
|
331
555
|
*
|
332
|
-
*
|
556
|
+
* \since This function is available since SDL 2.0.0.
|
333
557
|
*
|
334
|
-
*
|
558
|
+
* \sa SDL_GetSurfaceColorMod
|
559
|
+
* \sa SDL_SetSurfaceAlphaMod
|
335
560
|
*/
|
336
561
|
extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
|
337
562
|
Uint8 * alpha);
|
338
563
|
|
339
564
|
/**
|
340
|
-
*
|
565
|
+
* Set the blend mode used for blit operations.
|
566
|
+
*
|
567
|
+
* To copy a surface to another surface (or texture) without blending with the
|
568
|
+
* existing data, the blendmode of the SOURCE surface should be set to
|
569
|
+
* `SDL_BLENDMODE_NONE`.
|
341
570
|
*
|
342
|
-
*
|
343
|
-
*
|
571
|
+
* \param surface the SDL_Surface structure to update
|
572
|
+
* \param blendMode the SDL_BlendMode to use for blit blending
|
573
|
+
* \returns 0 on success or a negative error code on failure; call
|
574
|
+
* SDL_GetError() for more information.
|
344
575
|
*
|
345
|
-
*
|
576
|
+
* \since This function is available since SDL 2.0.0.
|
346
577
|
*
|
347
|
-
*
|
578
|
+
* \sa SDL_GetSurfaceBlendMode
|
348
579
|
*/
|
349
580
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
|
350
581
|
SDL_BlendMode blendMode);
|
351
582
|
|
352
583
|
/**
|
353
|
-
*
|
584
|
+
* Get the blend mode used for blit operations.
|
354
585
|
*
|
355
|
-
*
|
356
|
-
*
|
586
|
+
* \param surface the SDL_Surface structure to query
|
587
|
+
* \param blendMode a pointer filled in with the current SDL_BlendMode
|
588
|
+
* \returns 0 on success or a negative error code on failure; call
|
589
|
+
* SDL_GetError() for more information.
|
357
590
|
*
|
358
|
-
*
|
591
|
+
* \since This function is available since SDL 2.0.0.
|
359
592
|
*
|
360
|
-
*
|
593
|
+
* \sa SDL_SetSurfaceBlendMode
|
361
594
|
*/
|
362
595
|
extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
|
363
596
|
SDL_BlendMode *blendMode);
|
364
597
|
|
365
598
|
/**
|
366
|
-
*
|
599
|
+
* Set the clipping rectangle for a surface.
|
600
|
+
*
|
601
|
+
* When `surface` is the destination of a blit, only the area within the clip
|
602
|
+
* rectangle is drawn into.
|
603
|
+
*
|
604
|
+
* Note that blits are automatically clipped to the edges of the source and
|
605
|
+
* destination surfaces.
|
367
606
|
*
|
368
|
-
*
|
607
|
+
* \param surface the SDL_Surface structure to be clipped
|
608
|
+
* \param rect the SDL_Rect structure representing the clipping rectangle, or
|
609
|
+
* NULL to disable clipping
|
610
|
+
* \returns SDL_TRUE if the rectangle intersects the surface, otherwise
|
611
|
+
* SDL_FALSE and blits will be completely clipped.
|
369
612
|
*
|
370
|
-
*
|
371
|
-
* return SDL_FALSE and blits will be completely clipped. Otherwise the
|
372
|
-
* function returns SDL_TRUE and blits to the surface will be clipped to
|
373
|
-
* the intersection of the surface area and the clipping rectangle.
|
613
|
+
* \since This function is available since SDL 2.0.0.
|
374
614
|
*
|
375
|
-
*
|
376
|
-
*
|
615
|
+
* \sa SDL_BlitSurface
|
616
|
+
* \sa SDL_GetClipRect
|
377
617
|
*/
|
378
618
|
extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
|
379
619
|
const SDL_Rect * rect);
|
380
620
|
|
381
621
|
/**
|
382
|
-
*
|
622
|
+
* Get the clipping rectangle for a surface.
|
383
623
|
*
|
384
|
-
*
|
385
|
-
*
|
624
|
+
* When `surface` is the destination of a blit, only the area within the clip
|
625
|
+
* rectangle is drawn into.
|
626
|
+
*
|
627
|
+
* \param surface the SDL_Surface structure representing the surface to be
|
628
|
+
* clipped
|
629
|
+
* \param rect an SDL_Rect structure filled in with the clipping rectangle for
|
630
|
+
* the surface
|
631
|
+
*
|
632
|
+
* \since This function is available since SDL 2.0.0.
|
633
|
+
*
|
634
|
+
* \sa SDL_BlitSurface
|
635
|
+
* \sa SDL_SetClipRect
|
386
636
|
*/
|
387
637
|
extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface,
|
388
638
|
SDL_Rect * rect);
|
389
639
|
|
390
640
|
/*
|
391
|
-
* Creates a new surface identical to the existing surface
|
641
|
+
* Creates a new surface identical to the existing surface.
|
642
|
+
*
|
643
|
+
* The returned surface should be freed with SDL_FreeSurface().
|
644
|
+
*
|
645
|
+
* \param surface the surface to duplicate.
|
646
|
+
* \returns a copy of the surface, or NULL on failure; call SDL_GetError() for
|
647
|
+
* more information.
|
392
648
|
*/
|
393
649
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface);
|
394
650
|
|
395
651
|
/**
|
396
|
-
*
|
397
|
-
*
|
398
|
-
*
|
652
|
+
* Copy an existing surface to a new surface of the specified format.
|
653
|
+
*
|
654
|
+
* This function is used to optimize images for faster *repeat* blitting. This
|
655
|
+
* is accomplished by converting the original and storing the result as a new
|
656
|
+
* surface. The new, optimized surface can then be used as the source for
|
657
|
+
* future blits, making them faster.
|
658
|
+
*
|
659
|
+
* \param src the existing SDL_Surface structure to convert
|
660
|
+
* \param fmt the SDL_PixelFormat structure that the new surface is optimized
|
661
|
+
* for
|
662
|
+
* \param flags the flags are unused and should be set to 0; this is a
|
663
|
+
* leftover from SDL 1.2's API
|
664
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
665
|
+
* call SDL_GetError() for more information.
|
666
|
+
*
|
667
|
+
* \since This function is available since SDL 2.0.0.
|
399
668
|
*
|
400
|
-
*
|
401
|
-
*
|
402
|
-
*
|
403
|
-
* surface.
|
669
|
+
* \sa SDL_AllocFormat
|
670
|
+
* \sa SDL_ConvertSurfaceFormat
|
671
|
+
* \sa SDL_CreateRGBSurface
|
404
672
|
*/
|
405
673
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
|
406
674
|
(SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
|
675
|
+
|
676
|
+
/**
|
677
|
+
* Copy an existing surface to a new surface of the specified format enum.
|
678
|
+
*
|
679
|
+
* This function operates just like SDL_ConvertSurface(), but accepts an
|
680
|
+
* SDL_PixelFormatEnum value instead of an SDL_PixelFormat structure. As such,
|
681
|
+
* it might be easier to call but it doesn't have access to palette
|
682
|
+
* information for the destination surface, in case that would be important.
|
683
|
+
*
|
684
|
+
* \param src the existing SDL_Surface structure to convert
|
685
|
+
* \param pixel_format the SDL_PixelFormatEnum that the new surface is
|
686
|
+
* optimized for
|
687
|
+
* \param flags the flags are unused and should be set to 0; this is a
|
688
|
+
* leftover from SDL 1.2's API
|
689
|
+
* \returns the new SDL_Surface structure that is created or NULL if it fails;
|
690
|
+
* call SDL_GetError() for more information.
|
691
|
+
*
|
692
|
+
* \since This function is available since SDL 2.0.0.
|
693
|
+
*
|
694
|
+
* \sa SDL_AllocFormat
|
695
|
+
* \sa SDL_ConvertSurface
|
696
|
+
* \sa SDL_CreateRGBSurface
|
697
|
+
*/
|
407
698
|
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
|
408
699
|
(SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
|
409
700
|
|
410
701
|
/**
|
411
|
-
*
|
702
|
+
* Copy a block of pixels of one format to another format.
|
703
|
+
*
|
704
|
+
* \param width the width of the block to copy, in pixels
|
705
|
+
* \param height the height of the block to copy, in pixels
|
706
|
+
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
|
707
|
+
* \param src a pointer to the source pixels
|
708
|
+
* \param src_pitch the pitch of the source pixels, in bytes
|
709
|
+
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
|
710
|
+
* \param dst a pointer to be filled in with new pixel data
|
711
|
+
* \param dst_pitch the pitch of the destination pixels, in bytes
|
712
|
+
* \returns 0 on success or a negative error code on failure; call
|
713
|
+
* SDL_GetError() for more information.
|
412
714
|
*
|
413
|
-
*
|
715
|
+
* \since This function is available since SDL 2.0.0.
|
414
716
|
*/
|
415
717
|
extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
416
718
|
Uint32 src_format,
|
@@ -419,20 +721,84 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
|
|
419
721
|
void * dst, int dst_pitch);
|
420
722
|
|
421
723
|
/**
|
422
|
-
*
|
724
|
+
* Premultiply the alpha on a block of pixels.
|
725
|
+
*
|
726
|
+
* This is safe to use with src == dst, but not for other overlapping areas.
|
727
|
+
*
|
728
|
+
* This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
|
729
|
+
*
|
730
|
+
* \param width the width of the block to convert, in pixels
|
731
|
+
* \param height the height of the block to convert, in pixels
|
732
|
+
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
|
733
|
+
* \param src a pointer to the source pixels
|
734
|
+
* \param src_pitch the pitch of the source pixels, in bytes
|
735
|
+
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
|
736
|
+
* \param dst a pointer to be filled in with premultiplied pixel data
|
737
|
+
* \param dst_pitch the pitch of the destination pixels, in bytes
|
738
|
+
* \returns 0 on success or a negative error code on failure; call
|
739
|
+
* SDL_GetError() for more information.
|
740
|
+
*
|
741
|
+
* \since This function is available since SDL 2.0.18.
|
742
|
+
*/
|
743
|
+
extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
|
744
|
+
Uint32 src_format,
|
745
|
+
const void * src, int src_pitch,
|
746
|
+
Uint32 dst_format,
|
747
|
+
void * dst, int dst_pitch);
|
748
|
+
|
749
|
+
/**
|
750
|
+
* Perform a fast fill of a rectangle with a specific color.
|
751
|
+
*
|
752
|
+
* `color` should be a pixel of the format used by the surface, and can be
|
753
|
+
* generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
|
754
|
+
* alpha component then the destination is simply filled with that alpha
|
755
|
+
* information, no blending takes place.
|
423
756
|
*
|
424
|
-
*
|
757
|
+
* If there is a clip rectangle set on the destination (set via
|
758
|
+
* SDL_SetClipRect()), then this function will fill based on the intersection
|
759
|
+
* of the clip rectangle and `rect`.
|
425
760
|
*
|
426
|
-
*
|
427
|
-
*
|
761
|
+
* \param dst the SDL_Surface structure that is the drawing target
|
762
|
+
* \param rect the SDL_Rect structure representing the rectangle to fill, or
|
763
|
+
* NULL to fill the entire surface
|
764
|
+
* \param color the color to fill with
|
765
|
+
* \returns 0 on success or a negative error code on failure; call
|
766
|
+
* SDL_GetError() for more information.
|
428
767
|
*
|
429
|
-
*
|
768
|
+
* \since This function is available since SDL 2.0.0.
|
769
|
+
*
|
770
|
+
* \sa SDL_FillRects
|
430
771
|
*/
|
431
772
|
extern DECLSPEC int SDLCALL SDL_FillRect
|
432
773
|
(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color);
|
774
|
+
|
775
|
+
/**
|
776
|
+
* Perform a fast fill of a set of rectangles with a specific color.
|
777
|
+
*
|
778
|
+
* `color` should be a pixel of the format used by the surface, and can be
|
779
|
+
* generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
|
780
|
+
* alpha component then the destination is simply filled with that alpha
|
781
|
+
* information, no blending takes place.
|
782
|
+
*
|
783
|
+
* If there is a clip rectangle set on the destination (set via
|
784
|
+
* SDL_SetClipRect()), then this function will fill based on the intersection
|
785
|
+
* of the clip rectangle and `rect`.
|
786
|
+
*
|
787
|
+
* \param dst the SDL_Surface structure that is the drawing target
|
788
|
+
* \param rects an array of SDL_Rects representing the rectangles to fill.
|
789
|
+
* \param count the number of rectangles in the array
|
790
|
+
* \param color the color to fill with
|
791
|
+
* \returns 0 on success or a negative error code on failure; call
|
792
|
+
* SDL_GetError() for more information.
|
793
|
+
*
|
794
|
+
* \since This function is available since SDL 2.0.0.
|
795
|
+
*
|
796
|
+
* \sa SDL_FillRect
|
797
|
+
*/
|
433
798
|
extern DECLSPEC int SDLCALL SDL_FillRects
|
434
799
|
(SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
|
435
800
|
|
801
|
+
/* !!! FIXME: merge this documentation with the wiki */
|
436
802
|
/**
|
437
803
|
* Performs a fast blit from the source surface to the destination surface.
|
438
804
|
*
|
@@ -441,7 +807,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|
441
807
|
* surface (\c src or \c dst) is copied. The final blit rectangles are saved
|
442
808
|
* in \c srcrect and \c dstrect after all clipping is performed.
|
443
809
|
*
|
444
|
-
* \
|
810
|
+
* \returns 0 if the blit is successful, otherwise it returns -1.
|
445
811
|
*
|
446
812
|
* The blit function should not be called on a locked surface.
|
447
813
|
*
|
@@ -493,62 +859,128 @@ extern DECLSPEC int SDLCALL SDL_FillRects
|
|
493
859
|
#define SDL_BlitSurface SDL_UpperBlit
|
494
860
|
|
495
861
|
/**
|
496
|
-
*
|
497
|
-
*
|
862
|
+
* Perform a fast blit from the source surface to the destination surface.
|
863
|
+
*
|
864
|
+
* SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a
|
865
|
+
* macro for this function with a less confusing name.
|
866
|
+
*
|
867
|
+
* \since This function is available since SDL 2.0.0.
|
868
|
+
*
|
869
|
+
* \sa SDL_BlitSurface
|
498
870
|
*/
|
499
871
|
extern DECLSPEC int SDLCALL SDL_UpperBlit
|
500
872
|
(SDL_Surface * src, const SDL_Rect * srcrect,
|
501
873
|
SDL_Surface * dst, SDL_Rect * dstrect);
|
502
874
|
|
503
875
|
/**
|
504
|
-
*
|
505
|
-
*
|
876
|
+
* Perform low-level surface blitting only.
|
877
|
+
*
|
878
|
+
* This is a semi-private blit function and it performs low-level surface
|
879
|
+
* blitting, assuming the input rectangles have already been clipped.
|
880
|
+
*
|
881
|
+
* Unless you know what you're doing, you should be using SDL_BlitSurface()
|
882
|
+
* instead.
|
883
|
+
*
|
884
|
+
* \param src the SDL_Surface structure to be copied from
|
885
|
+
* \param srcrect the SDL_Rect structure representing the rectangle to be
|
886
|
+
* copied, or NULL to copy the entire surface
|
887
|
+
* \param dst the SDL_Surface structure that is the blit target
|
888
|
+
* \param dstrect the SDL_Rect structure representing the rectangle that is
|
889
|
+
* copied into
|
890
|
+
* \returns 0 on success or a negative error code on failure; call
|
891
|
+
* SDL_GetError() for more information.
|
892
|
+
*
|
893
|
+
* \since This function is available since SDL 2.0.0.
|
894
|
+
*
|
895
|
+
* \sa SDL_BlitSurface
|
506
896
|
*/
|
507
897
|
extern DECLSPEC int SDLCALL SDL_LowerBlit
|
508
898
|
(SDL_Surface * src, SDL_Rect * srcrect,
|
509
899
|
SDL_Surface * dst, SDL_Rect * dstrect);
|
510
900
|
|
901
|
+
|
511
902
|
/**
|
512
|
-
*
|
513
|
-
*
|
903
|
+
* Perform a fast, low quality, stretch blit between two surfaces of the same
|
904
|
+
* format.
|
905
|
+
*
|
906
|
+
* Please use SDL_BlitScaled() instead.
|
514
907
|
*
|
515
|
-
*
|
908
|
+
* \since This function is available since SDL 2.0.0.
|
516
909
|
*/
|
517
910
|
extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src,
|
518
911
|
const SDL_Rect * srcrect,
|
519
912
|
SDL_Surface * dst,
|
520
913
|
const SDL_Rect * dstrect);
|
521
914
|
|
915
|
+
/**
|
916
|
+
* Perform bilinear scaling between two surfaces of the same format, 32BPP.
|
917
|
+
*
|
918
|
+
* \since This function is available since SDL 2.0.16.
|
919
|
+
*/
|
920
|
+
extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
|
921
|
+
const SDL_Rect * srcrect,
|
922
|
+
SDL_Surface * dst,
|
923
|
+
const SDL_Rect * dstrect);
|
924
|
+
|
925
|
+
|
522
926
|
#define SDL_BlitScaled SDL_UpperBlitScaled
|
523
927
|
|
524
928
|
/**
|
525
|
-
*
|
526
|
-
*
|
929
|
+
* Perform a scaled surface copy to a destination surface.
|
930
|
+
*
|
931
|
+
* SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is
|
932
|
+
* merely a macro for this function with a less confusing name.
|
933
|
+
*
|
934
|
+
* \since This function is available since SDL 2.0.0.
|
935
|
+
*
|
936
|
+
* \sa SDL_BlitScaled
|
527
937
|
*/
|
528
938
|
extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
|
529
939
|
(SDL_Surface * src, const SDL_Rect * srcrect,
|
530
940
|
SDL_Surface * dst, SDL_Rect * dstrect);
|
531
941
|
|
532
942
|
/**
|
533
|
-
*
|
534
|
-
*
|
943
|
+
* Perform low-level surface scaled blitting only.
|
944
|
+
*
|
945
|
+
* This is a semi-private function and it performs low-level surface blitting,
|
946
|
+
* assuming the input rectangles have already been clipped.
|
947
|
+
*
|
948
|
+
* \param src the SDL_Surface structure to be copied from
|
949
|
+
* \param srcrect the SDL_Rect structure representing the rectangle to be
|
950
|
+
* copied
|
951
|
+
* \param dst the SDL_Surface structure that is the blit target
|
952
|
+
* \param dstrect the SDL_Rect structure representing the rectangle that is
|
953
|
+
* copied into
|
954
|
+
* \returns 0 on success or a negative error code on failure; call
|
955
|
+
* SDL_GetError() for more information.
|
956
|
+
*
|
957
|
+
* \since This function is available since SDL 2.0.0.
|
958
|
+
*
|
959
|
+
* \sa SDL_BlitScaled
|
535
960
|
*/
|
536
961
|
extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
537
962
|
(SDL_Surface * src, SDL_Rect * srcrect,
|
538
963
|
SDL_Surface * dst, SDL_Rect * dstrect);
|
539
964
|
|
540
965
|
/**
|
541
|
-
*
|
966
|
+
* Set the YUV conversion mode
|
967
|
+
*
|
968
|
+
* \since This function is available since SDL 2.0.8.
|
542
969
|
*/
|
543
970
|
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
|
544
971
|
|
545
972
|
/**
|
546
|
-
*
|
973
|
+
* Get the YUV conversion mode
|
974
|
+
*
|
975
|
+
* \since This function is available since SDL 2.0.8.
|
547
976
|
*/
|
548
977
|
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
|
549
978
|
|
550
979
|
/**
|
551
|
-
*
|
980
|
+
* Get the YUV conversion mode, returning the correct mode for the resolution
|
981
|
+
* when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
|
982
|
+
*
|
983
|
+
* \since This function is available since SDL 2.0.8.
|
552
984
|
*/
|
553
985
|
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
|
554
986
|
|