SDL 3.0
SDL_surface.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * # CategorySurface
24 *
25 * SDL surfaces are buffers of pixels in system RAM. These are useful for
26 * passing around and manipulating images that are not stored in GPU memory.
27 *
28 * SDL_Surface makes serious efforts to manage images in various formats, and
29 * provides a reasonable toolbox for transforming the data, including copying
30 * between surfaces, filling rectangles in the image data, etc.
31 *
32 * There is also a simple .bmp loader, SDL_LoadBMP(). SDL itself does not
33 * provide loaders for various other file formats, but there are several
34 * excellent external libraries that do, including its own satellite library,
35 * [SDL_image](https://wiki.libsdl.org/SDL3_image)
36 * :
37 *
38 * https://github.com/libsdl-org/SDL_image
39 */
40
41#ifndef SDL_surface_h_
42#define SDL_surface_h_
43
44#include <SDL3/SDL_stdinc.h>
45#include <SDL3/SDL_error.h>
46#include <SDL3/SDL_blendmode.h>
47#include <SDL3/SDL_pixels.h>
48#include <SDL3/SDL_properties.h>
49#include <SDL3/SDL_rect.h>
50#include <SDL3/SDL_iostream.h>
51
52#include <SDL3/SDL_begin_code.h>
53/* Set up for C function definitions, even when using C++ */
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/**
59 * The flags on an SDL_Surface.
60 *
61 * These are generally considered read-only.
62 *
63 * \since This datatype is available since SDL 3.2.0.
64 */
66
67#define SDL_SURFACE_PREALLOCATED 0x00000001u /**< Surface uses preallocated pixel memory */
68#define SDL_SURFACE_LOCK_NEEDED 0x00000002u /**< Surface needs to be locked to access pixels */
69#define SDL_SURFACE_LOCKED 0x00000004u /**< Surface is currently locked */
70#define SDL_SURFACE_SIMD_ALIGNED 0x00000008u /**< Surface uses pixel memory allocated with SDL_aligned_alloc() */
71
72/**
73 * Evaluates to true if the surface needs to be locked before access.
74 *
75 * \since This macro is available since SDL 3.2.0.
76 */
77#define SDL_MUSTLOCK(S) (((S)->flags & SDL_SURFACE_LOCK_NEEDED) == SDL_SURFACE_LOCK_NEEDED)
78
79/**
80 * The scaling mode.
81 *
82 * \since This enum is available since SDL 3.2.0.
83 */
84typedef enum SDL_ScaleMode
85{
87 SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
88 SDL_SCALEMODE_LINEAR, /**< linear filtering */
89 SDL_SCALEMODE_PIXELART /**< nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0 */
91
92/**
93 * The flip mode.
94 *
95 * \since This enum is available since SDL 3.2.0.
96 */
97typedef enum SDL_FlipMode
98{
99 SDL_FLIP_NONE, /**< Do not flip */
100 SDL_FLIP_HORIZONTAL, /**< flip horizontally */
101 SDL_FLIP_VERTICAL, /**< flip vertically */
102 SDL_FLIP_HORIZONTAL_AND_VERTICAL = (SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL) /**< flip horizontally and vertically (not a diagonal flip) */
104
105#ifndef SDL_INTERNAL
106
107/**
108 * A collection of pixels used in software blitting.
109 *
110 * Pixels are arranged in memory in rows, with the top row first. Each row
111 * occupies an amount of memory given by the pitch (sometimes known as the row
112 * stride in non-SDL APIs).
113 *
114 * Within each row, pixels are arranged from left to right until the width is
115 * reached. Each pixel occupies a number of bits appropriate for its format,
116 * with most formats representing each pixel as one or more whole bytes (in
117 * some indexed formats, instead multiple pixels are packed into each byte),
118 * and a byte order given by the format. After encoding all pixels, any
119 * remaining bytes to reach the pitch are used as padding to reach a desired
120 * alignment, and have undefined contents.
121 *
122 * When a surface holds YUV format data, the planes are assumed to be
123 * contiguous without padding between them, e.g. a 32x32 surface in NV12
124 * format with a pitch of 32 would consist of 32x32 bytes of Y plane followed
125 * by 32x16 bytes of UV plane.
126 *
127 * When a surface holds MJPG format data, pixels points at the compressed JPEG
128 * image and pitch is the length of that data.
129 *
130 * \since This struct is available since SDL 3.2.0.
131 *
132 * \sa SDL_CreateSurface
133 * \sa SDL_DestroySurface
134 */
136{
137 SDL_SurfaceFlags flags; /**< The flags of the surface, read-only */
138 SDL_PixelFormat format; /**< The format of the surface, read-only */
139 int w; /**< The width of the surface, read-only. */
140 int h; /**< The height of the surface, read-only. */
141 int pitch; /**< The distance in bytes between rows of pixels, read-only */
142 void *pixels; /**< A pointer to the pixels of the surface, the pixels are writeable if non-NULL */
143
144 int refcount; /**< Application reference count, used when freeing surface */
145
146 void *reserved; /**< Reserved for internal use */
147};
148#endif /* !SDL_INTERNAL */
149
150typedef struct SDL_Surface SDL_Surface;
151
152/**
153 * Allocate a new surface with a specific pixel format.
154 *
155 * The pixels of the new surface are initialized to zero.
156 *
157 * \param width the width of the surface.
158 * \param height the height of the surface.
159 * \param format the SDL_PixelFormat for the new surface's pixel format.
160 * \returns the new SDL_Surface structure that is created or NULL on failure;
161 * call SDL_GetError() for more information.
162 *
163 * \threadsafety It is safe to call this function from any thread.
164 *
165 * \since This function is available since SDL 3.2.0.
166 *
167 * \sa SDL_CreateSurfaceFrom
168 * \sa SDL_DestroySurface
169 */
170extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormat format);
171
172/**
173 * Allocate a new surface with a specific pixel format and existing pixel
174 * data.
175 *
176 * No copy is made of the pixel data. Pixel data is not managed automatically;
177 * you must free the surface before you free the pixel data.
178 *
179 * Pitch is the offset in bytes from one row of pixels to the next, e.g.
180 * `width*4` for `SDL_PIXELFORMAT_RGBA8888`.
181 *
182 * You may pass NULL for pixels and 0 for pitch to create a surface that you
183 * will fill in with valid values later.
184 *
185 * \param width the width of the surface.
186 * \param height the height of the surface.
187 * \param format the SDL_PixelFormat for the new surface's pixel format.
188 * \param pixels a pointer to existing pixel data.
189 * \param pitch the number of bytes between each row, including padding.
190 * \returns the new SDL_Surface structure that is created or NULL on failure;
191 * call SDL_GetError() for more information.
192 *
193 * \threadsafety It is safe to call this function from any thread.
194 *
195 * \since This function is available since SDL 3.2.0.
196 *
197 * \sa SDL_CreateSurface
198 * \sa SDL_DestroySurface
199 */
200extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_CreateSurfaceFrom(int width, int height, SDL_PixelFormat format, void *pixels, int pitch);
201
202/**
203 * Free a surface.
204 *
205 * It is safe to pass NULL to this function.
206 *
207 * \param surface the SDL_Surface to free.
208 *
209 * \threadsafety No other thread should be using the surface when it is freed.
210 *
211 * \since This function is available since SDL 3.2.0.
212 *
213 * \sa SDL_CreateSurface
214 * \sa SDL_CreateSurfaceFrom
215 */
216extern SDL_DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);
217
218/**
219 * Get the properties associated with a surface.
220 *
221 * The following properties are understood by SDL:
222 *
223 * - `SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
224 * surfaces, this defines the value of 100% diffuse white, with higher
225 * values being displayed in the High Dynamic Range headroom. This defaults
226 * to 203 for HDR10 surfaces and 1.0 for floating point surfaces.
227 * - `SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
228 * surfaces, this defines the maximum dynamic range used by the content, in
229 * terms of the SDR white point. This defaults to 0.0, which disables tone
230 * mapping.
231 * - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator
232 * used when compressing from a surface with high dynamic range to another
233 * with lower dynamic range. Currently this supports "chrome", which uses
234 * the same tone mapping that Chrome uses for HDR content, the form "*=N",
235 * where N is a floating point scale factor applied in linear space, and
236 * "none", which disables tone mapping. This defaults to "chrome".
237 * - `SDL_PROP_SURFACE_HOTSPOT_X_NUMBER`: the hotspot pixel offset from the
238 * left edge of the image, if this surface is being used as a cursor.
239 * - `SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER`: the hotspot pixel offset from the
240 * top edge of the image, if this surface is being used as a cursor.
241 *
242 * \param surface the SDL_Surface structure to query.
243 * \returns a valid property ID on success or 0 on failure; call
244 * SDL_GetError() for more information.
245 *
246 * \threadsafety It is safe to call this function from any thread.
247 *
248 * \since This function is available since SDL 3.2.0.
249 */
250extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface);
251
252#define SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT "SDL.surface.SDR_white_point"
253#define SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT "SDL.surface.HDR_headroom"
254#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING "SDL.surface.tonemap"
255#define SDL_PROP_SURFACE_HOTSPOT_X_NUMBER "SDL.surface.hotspot.x"
256#define SDL_PROP_SURFACE_HOTSPOT_Y_NUMBER "SDL.surface.hotspot.y"
257
258/**
259 * Set the colorspace used by a surface.
260 *
261 * Setting the colorspace doesn't change the pixels, only how they are
262 * interpreted in color operations.
263 *
264 * \param surface the SDL_Surface structure to update.
265 * \param colorspace an SDL_Colorspace value describing the surface
266 * colorspace.
267 * \returns true on success or false on failure; call SDL_GetError() for more
268 * information.
269 *
270 * \threadsafety This function is not thread safe.
271 *
272 * \since This function is available since SDL 3.2.0.
273 *
274 * \sa SDL_GetSurfaceColorspace
275 */
276extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
277
278/**
279 * Get the colorspace used by a surface.
280 *
281 * The colorspace defaults to SDL_COLORSPACE_SRGB_LINEAR for floating point
282 * formats, SDL_COLORSPACE_HDR10 for 10-bit formats, SDL_COLORSPACE_SRGB for
283 * other RGB surfaces and SDL_COLORSPACE_BT709_FULL for YUV textures.
284 *
285 * \param surface the SDL_Surface structure to query.
286 * \returns the colorspace used by the surface, or SDL_COLORSPACE_UNKNOWN if
287 * the surface is NULL.
288 *
289 * \threadsafety This function is not thread safe.
290 *
291 * \since This function is available since SDL 3.2.0.
292 *
293 * \sa SDL_SetSurfaceColorspace
294 */
295extern SDL_DECLSPEC SDL_Colorspace SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface);
296
297/**
298 * Create a palette and associate it with a surface.
299 *
300 * This function creates a palette compatible with the provided surface. The
301 * palette is then returned for you to modify, and the surface will
302 * automatically use the new palette in future operations. You do not need to
303 * destroy the returned palette, it will be freed when the reference count
304 * reaches 0, usually when the surface is destroyed.
305 *
306 * Bitmap surfaces (with format SDL_PIXELFORMAT_INDEX1LSB or
307 * SDL_PIXELFORMAT_INDEX1MSB) will have the palette initialized with 0 as
308 * white and 1 as black. Other surfaces will get a palette initialized with
309 * white in every entry.
310 *
311 * If this function is called for a surface that already has a palette, a new
312 * palette will be created to replace it.
313 *
314 * \param surface the SDL_Surface structure to update.
315 * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
316 * the surface didn't have an index format); call SDL_GetError() for
317 * more information.
318 *
319 * \threadsafety This function is not thread safe.
320 *
321 * \since This function is available since SDL 3.2.0.
322 *
323 * \sa SDL_SetPaletteColors
324 */
325extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreateSurfacePalette(SDL_Surface *surface);
326
327/**
328 * Set the palette used by a surface.
329 *
330 * Setting the palette keeps an internal reference to the palette, which can
331 * be safely destroyed afterwards.
332 *
333 * A single palette can be shared with many surfaces.
334 *
335 * \param surface the SDL_Surface structure to update.
336 * \param palette the SDL_Palette structure to use.
337 * \returns true on success or false on failure; call SDL_GetError() for more
338 * information.
339 *
340 * \threadsafety This function is not thread safe.
341 *
342 * \since This function is available since SDL 3.2.0.
343 *
344 * \sa SDL_CreatePalette
345 * \sa SDL_GetSurfacePalette
346 */
347extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
348
349/**
350 * Get the palette used by a surface.
351 *
352 * \param surface the SDL_Surface structure to query.
353 * \returns a pointer to the palette used by the surface, or NULL if there is
354 * no palette used.
355 *
356 * \threadsafety It is safe to call this function from any thread.
357 *
358 * \since This function is available since SDL 3.2.0.
359 *
360 * \sa SDL_SetSurfacePalette
361 */
362extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *surface);
363
364/**
365 * Add an alternate version of a surface.
366 *
367 * This function adds an alternate version of this surface, usually used for
368 * content with high DPI representations like cursors or icons. The size,
369 * format, and content do not need to match the original surface, and these
370 * alternate versions will not be updated when the original surface changes.
371 *
372 * This function adds a reference to the alternate version, so you should call
373 * SDL_DestroySurface() on the image after this call.
374 *
375 * \param surface the SDL_Surface structure to update.
376 * \param image a pointer to an alternate SDL_Surface to associate with this
377 * surface.
378 * \returns true on success or false on failure; call SDL_GetError() for more
379 * information.
380 *
381 * \threadsafety This function is not thread safe.
382 *
383 * \since This function is available since SDL 3.2.0.
384 *
385 * \sa SDL_RemoveSurfaceAlternateImages
386 * \sa SDL_GetSurfaceImages
387 * \sa SDL_SurfaceHasAlternateImages
388 */
389extern SDL_DECLSPEC bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image);
390
391/**
392 * Return whether a surface has alternate versions available.
393 *
394 * \param surface the SDL_Surface structure to query.
395 * \returns true if alternate versions are available or false otherwise.
396 *
397 * \threadsafety It is safe to call this function from any thread.
398 *
399 * \since This function is available since SDL 3.2.0.
400 *
401 * \sa SDL_AddSurfaceAlternateImage
402 * \sa SDL_RemoveSurfaceAlternateImages
403 * \sa SDL_GetSurfaceImages
404 */
405extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surface);
406
407/**
408 * Get an array including all versions of a surface.
409 *
410 * This returns all versions of a surface, with the surface being queried as
411 * the first element in the returned array.
412 *
413 * Freeing the array of surfaces does not affect the surfaces in the array.
414 * They are still referenced by the surface being queried and will be cleaned
415 * up normally.
416 *
417 * \param surface the SDL_Surface structure to query.
418 * \param count a pointer filled in with the number of surface pointers
419 * returned, may be NULL.
420 * \returns a NULL terminated array of SDL_Surface pointers or NULL on
421 * failure; call SDL_GetError() for more information. This should be
422 * freed with SDL_free() when it is no longer needed.
423 *
424 * \threadsafety This function is not thread safe.
425 *
426 * \since This function is available since SDL 3.2.0.
427 *
428 * \sa SDL_AddSurfaceAlternateImage
429 * \sa SDL_RemoveSurfaceAlternateImages
430 * \sa SDL_SurfaceHasAlternateImages
431 */
432extern SDL_DECLSPEC SDL_Surface ** SDLCALL SDL_GetSurfaceImages(SDL_Surface *surface, int *count);
433
434/**
435 * Remove all alternate versions of a surface.
436 *
437 * This function removes a reference from all the alternative versions,
438 * destroying them if this is the last reference to them.
439 *
440 * \param surface the SDL_Surface structure to update.
441 *
442 * \threadsafety This function is not thread safe.
443 *
444 * \since This function is available since SDL 3.2.0.
445 *
446 * \sa SDL_AddSurfaceAlternateImage
447 * \sa SDL_GetSurfaceImages
448 * \sa SDL_SurfaceHasAlternateImages
449 */
450extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface);
451
452/**
453 * Set up a surface for directly accessing the pixels.
454 *
455 * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to
456 * and read from `surface->pixels`, using the pixel format stored in
457 * `surface->format`. Once you are done accessing the surface, you should use
458 * SDL_UnlockSurface() to release it.
459 *
460 * Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to
461 * 0, then you can read and write to the surface at any time, and the pixel
462 * format of the surface will not change.
463 *
464 * \param surface the SDL_Surface structure to be locked.
465 * \returns true on success or false on failure; call SDL_GetError() for more
466 * information.
467 *
468 * \threadsafety This function is not thread safe. The locking referred to by
469 * this function is making the pixels available for direct
470 * access, not thread-safe locking.
471 *
472 * \since This function is available since SDL 3.2.0.
473 *
474 * \sa SDL_MUSTLOCK
475 * \sa SDL_UnlockSurface
476 */
477extern SDL_DECLSPEC bool SDLCALL SDL_LockSurface(SDL_Surface *surface);
478
479/**
480 * Release a surface after directly accessing the pixels.
481 *
482 * \param surface the SDL_Surface structure to be unlocked.
483 *
484 * \threadsafety This function is not thread safe. The locking referred to by
485 * this function is making the pixels available for direct
486 * access, not thread-safe locking.
487 *
488 * \since This function is available since SDL 3.2.0.
489 *
490 * \sa SDL_LockSurface
491 */
492extern SDL_DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
493
494/**
495 * Load a BMP image from a seekable SDL data stream.
496 *
497 * The new surface should be freed with SDL_DestroySurface(). Not doing so
498 * will result in a memory leak.
499 *
500 * \param src the data stream for the surface.
501 * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even
502 * in the case of an error.
503 * \returns a pointer to a new SDL_Surface structure or NULL on failure; call
504 * SDL_GetError() for more information.
505 *
506 * \threadsafety It is safe to call this function from any thread.
507 *
508 * \since This function is available since SDL 3.2.0.
509 *
510 * \sa SDL_DestroySurface
511 * \sa SDL_LoadBMP
512 * \sa SDL_SaveBMP_IO
513 */
514extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio);
515
516/**
517 * Load a BMP image from a file.
518 *
519 * The new surface should be freed with SDL_DestroySurface(). Not doing so
520 * will result in a memory leak.
521 *
522 * \param file the BMP file to load.
523 * \returns a pointer to a new SDL_Surface structure or NULL on failure; call
524 * SDL_GetError() for more information.
525 *
526 * \threadsafety It is safe to call this function from any thread.
527 *
528 * \since This function is available since SDL 3.2.0.
529 *
530 * \sa SDL_DestroySurface
531 * \sa SDL_LoadBMP_IO
532 * \sa SDL_SaveBMP
533 */
534extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file);
535
536/**
537 * Save a surface to a seekable SDL data stream in BMP format.
538 *
539 * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
540 * BMP directly. Other RGB formats with 8-bit or higher get converted to a
541 * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
542 * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
543 * not supported.
544 *
545 * \param surface the SDL_Surface structure containing the image to be saved.
546 * \param dst a data stream to save to.
547 * \param closeio if true, calls SDL_CloseIO() on `dst` before returning, even
548 * in the case of an error.
549 * \returns true on success or false on failure; call SDL_GetError() for more
550 * information.
551 *
552 * \threadsafety This function is not thread safe.
553 *
554 * \since This function is available since SDL 3.2.0.
555 *
556 * \sa SDL_LoadBMP_IO
557 * \sa SDL_SaveBMP
558 */
559extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio);
560
561/**
562 * Save a surface to a file.
563 *
564 * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
565 * BMP directly. Other RGB formats with 8-bit or higher get converted to a
566 * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
567 * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
568 * not supported.
569 *
570 * \param surface the SDL_Surface structure containing the image to be saved.
571 * \param file a file to save to.
572 * \returns true on success or false on failure; call SDL_GetError() for more
573 * information.
574 *
575 * \threadsafety This function is not thread safe.
576 *
577 * \since This function is available since SDL 3.2.0.
578 *
579 * \sa SDL_LoadBMP
580 * \sa SDL_SaveBMP_IO
581 */
582extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
583
584/**
585 * Set the RLE acceleration hint for a surface.
586 *
587 * If RLE is enabled, color key and alpha blending blits are much faster, but
588 * the surface must be locked before directly accessing the pixels.
589 *
590 * \param surface the SDL_Surface structure to optimize.
591 * \param enabled true to enable RLE acceleration, false to disable it.
592 * \returns true on success or false on failure; call SDL_GetError() for more
593 * information.
594 *
595 * \threadsafety This function is not thread safe.
596 *
597 * \since This function is available since SDL 3.2.0.
598 *
599 * \sa SDL_BlitSurface
600 * \sa SDL_LockSurface
601 * \sa SDL_UnlockSurface
602 */
603extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled);
604
605/**
606 * Returns whether the surface is RLE enabled.
607 *
608 * It is safe to pass a NULL `surface` here; it will return false.
609 *
610 * \param surface the SDL_Surface structure to query.
611 * \returns true if the surface is RLE enabled, false otherwise.
612 *
613 * \threadsafety It is safe to call this function from any thread.
614 *
615 * \since This function is available since SDL 3.2.0.
616 *
617 * \sa SDL_SetSurfaceRLE
618 */
619extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
620
621/**
622 * Set the color key (transparent pixel) in a surface.
623 *
624 * The color key defines a pixel value that will be treated as transparent in
625 * a blit. For example, one can use this to specify that cyan pixels should be
626 * considered transparent, and therefore not rendered.
627 *
628 * It is a pixel of the format used by the surface, as generated by
629 * SDL_MapRGB().
630 *
631 * \param surface the SDL_Surface structure to update.
632 * \param enabled true to enable color key, false to disable color key.
633 * \param key the transparent pixel.
634 * \returns true on success or false on failure; call SDL_GetError() for more
635 * information.
636 *
637 * \threadsafety This function is not thread safe.
638 *
639 * \since This function is available since SDL 3.2.0.
640 *
641 * \sa SDL_GetSurfaceColorKey
642 * \sa SDL_SetSurfaceRLE
643 * \sa SDL_SurfaceHasColorKey
644 */
645extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, bool enabled, Uint32 key);
646
647/**
648 * Returns whether the surface has a color key.
649 *
650 * It is safe to pass a NULL `surface` here; it will return false.
651 *
652 * \param surface the SDL_Surface structure to query.
653 * \returns true if the surface has a color key, false otherwise.
654 *
655 * \threadsafety It is safe to call this function from any thread.
656 *
657 * \since This function is available since SDL 3.2.0.
658 *
659 * \sa SDL_SetSurfaceColorKey
660 * \sa SDL_GetSurfaceColorKey
661 */
662extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface);
663
664/**
665 * Get the color key (transparent pixel) for a surface.
666 *
667 * The color key is a pixel of the format used by the surface, as generated by
668 * SDL_MapRGB().
669 *
670 * If the surface doesn't have color key enabled this function returns false.
671 *
672 * \param surface the SDL_Surface structure to query.
673 * \param key a pointer filled in with the transparent pixel.
674 * \returns true on success or false on failure; call SDL_GetError() for more
675 * information.
676 *
677 * \threadsafety It is safe to call this function from any thread.
678 *
679 * \since This function is available since SDL 3.2.0.
680 *
681 * \sa SDL_SetSurfaceColorKey
682 * \sa SDL_SurfaceHasColorKey
683 */
684extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
685
686/**
687 * Set an additional color value multiplied into blit operations.
688 *
689 * When this surface is blitted, during the blit operation each source color
690 * channel is modulated by the appropriate color value according to the
691 * following formula:
692 *
693 * `srcC = srcC * (color / 255)`
694 *
695 * \param surface the SDL_Surface structure to update.
696 * \param r the red color value multiplied into blit operations.
697 * \param g the green color value multiplied into blit operations.
698 * \param b the blue color value multiplied into blit operations.
699 * \returns true on success or false on failure; call SDL_GetError() for more
700 * information.
701 *
702 * \threadsafety This function is not thread safe.
703 *
704 * \since This function is available since SDL 3.2.0.
705 *
706 * \sa SDL_GetSurfaceColorMod
707 * \sa SDL_SetSurfaceAlphaMod
708 */
709extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
710
711
712/**
713 * Get the additional color value multiplied into blit operations.
714 *
715 * \param surface the SDL_Surface structure to query.
716 * \param r a pointer filled in with the current red color value.
717 * \param g a pointer filled in with the current green color value.
718 * \param b a pointer filled in with the current blue color value.
719 * \returns true on success or false on failure; call SDL_GetError() for more
720 * information.
721 *
722 * \threadsafety This function is not thread safe.
723 *
724 * \since This function is available since SDL 3.2.0.
725 *
726 * \sa SDL_GetSurfaceAlphaMod
727 * \sa SDL_SetSurfaceColorMod
728 */
729extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
730
731/**
732 * Set an additional alpha value used in blit operations.
733 *
734 * When this surface is blitted, during the blit operation the source alpha
735 * value is modulated by this alpha value according to the following formula:
736 *
737 * `srcA = srcA * (alpha / 255)`
738 *
739 * \param surface the SDL_Surface structure to update.
740 * \param alpha the alpha value multiplied into blit operations.
741 * \returns true on success or false on failure; call SDL_GetError() for more
742 * information.
743 *
744 * \threadsafety This function is not thread safe.
745 *
746 * \since This function is available since SDL 3.2.0.
747 *
748 * \sa SDL_GetSurfaceAlphaMod
749 * \sa SDL_SetSurfaceColorMod
750 */
751extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
752
753/**
754 * Get the additional alpha value used in blit operations.
755 *
756 * \param surface the SDL_Surface structure to query.
757 * \param alpha a pointer filled in with the current alpha value.
758 * \returns true on success or false on failure; call SDL_GetError() for more
759 * information.
760 *
761 * \threadsafety It is safe to call this function from any thread.
762 *
763 * \since This function is available since SDL 3.2.0.
764 *
765 * \sa SDL_GetSurfaceColorMod
766 * \sa SDL_SetSurfaceAlphaMod
767 */
768extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
769
770/**
771 * Set the blend mode used for blit operations.
772 *
773 * To copy a surface to another surface (or texture) without blending with the
774 * existing data, the blendmode of the SOURCE surface should be set to
775 * `SDL_BLENDMODE_NONE`.
776 *
777 * \param surface the SDL_Surface structure to update.
778 * \param blendMode the SDL_BlendMode to use for blit blending.
779 * \returns true on success or false on failure; call SDL_GetError() for more
780 * information.
781 *
782 * \threadsafety This function is not thread safe.
783 *
784 * \since This function is available since SDL 3.2.0.
785 *
786 * \sa SDL_GetSurfaceBlendMode
787 */
788extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
789
790/**
791 * Get the blend mode used for blit operations.
792 *
793 * \param surface the SDL_Surface structure to query.
794 * \param blendMode a pointer filled in with the current SDL_BlendMode.
795 * \returns true on success or false on failure; call SDL_GetError() for more
796 * information.
797 *
798 * \threadsafety It is safe to call this function from any thread.
799 *
800 * \since This function is available since SDL 3.2.0.
801 *
802 * \sa SDL_SetSurfaceBlendMode
803 */
804extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
805
806/**
807 * Set the clipping rectangle for a surface.
808 *
809 * When `surface` is the destination of a blit, only the area within the clip
810 * rectangle is drawn into.
811 *
812 * Note that blits are automatically clipped to the edges of the source and
813 * destination surfaces.
814 *
815 * \param surface the SDL_Surface structure to be clipped.
816 * \param rect the SDL_Rect structure representing the clipping rectangle, or
817 * NULL to disable clipping.
818 * \returns true if the rectangle intersects the surface, otherwise false and
819 * blits will be completely clipped.
820 *
821 * \threadsafety This function is not thread safe.
822 *
823 * \since This function is available since SDL 3.2.0.
824 *
825 * \sa SDL_GetSurfaceClipRect
826 */
827extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect);
828
829/**
830 * Get the clipping rectangle for a surface.
831 *
832 * When `surface` is the destination of a blit, only the area within the clip
833 * rectangle is drawn into.
834 *
835 * \param surface the SDL_Surface structure representing the surface to be
836 * clipped.
837 * \param rect an SDL_Rect structure filled in with the clipping rectangle for
838 * the surface.
839 * \returns true on success or false on failure; call SDL_GetError() for more
840 * information.
841 *
842 * \threadsafety This function is not thread safe.
843 *
844 * \since This function is available since SDL 3.2.0.
845 *
846 * \sa SDL_SetSurfaceClipRect
847 */
848extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
849
850/**
851 * Flip a surface vertically or horizontally.
852 *
853 * \param surface the surface to flip.
854 * \param flip the direction to flip.
855 * \returns true on success or false on failure; call SDL_GetError() for more
856 * information.
857 *
858 * \threadsafety This function is not thread safe.
859 *
860 * \since This function is available since SDL 3.2.0.
861 */
862extern SDL_DECLSPEC bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
863
864/**
865 * Creates a new surface identical to the existing surface.
866 *
867 * If the original surface has alternate images, the new surface will have a
868 * reference to them as well.
869 *
870 * The returned surface should be freed with SDL_DestroySurface().
871 *
872 * \param surface the surface to duplicate.
873 * \returns a copy of the surface or NULL on failure; call SDL_GetError() for
874 * more information.
875 *
876 * \threadsafety This function is not thread safe.
877 *
878 * \since This function is available since SDL 3.2.0.
879 *
880 * \sa SDL_DestroySurface
881 */
882extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_DuplicateSurface(SDL_Surface *surface);
883
884/**
885 * Creates a new surface identical to the existing surface, scaled to the
886 * desired size.
887 *
888 * The returned surface should be freed with SDL_DestroySurface().
889 *
890 * \param surface the surface to duplicate and scale.
891 * \param width the width of the new surface.
892 * \param height the height of the new surface.
893 * \param scaleMode the SDL_ScaleMode to be used.
894 * \returns a copy of the surface or NULL on failure; call SDL_GetError() for
895 * more information.
896 *
897 * \threadsafety This function is not thread safe.
898 *
899 * \since This function is available since SDL 3.2.0.
900 *
901 * \sa SDL_DestroySurface
902 */
903extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode);
904
905/**
906 * Copy an existing surface to a new surface of the specified format.
907 *
908 * This function is used to optimize images for faster *repeat* blitting. This
909 * is accomplished by converting the original and storing the result as a new
910 * surface. The new, optimized surface can then be used as the source for
911 * future blits, making them faster.
912 *
913 * If you are converting to an indexed surface and want to map colors to a
914 * palette, you can use SDL_ConvertSurfaceAndColorspace() instead.
915 *
916 * If the original surface has alternate images, the new surface will have a
917 * reference to them as well.
918 *
919 * \param surface the existing SDL_Surface structure to convert.
920 * \param format the new pixel format.
921 * \returns the new SDL_Surface structure that is created or NULL on failure;
922 * call SDL_GetError() for more information.
923 *
924 * \threadsafety This function is not thread safe.
925 *
926 * \since This function is available since SDL 3.2.0.
927 *
928 * \sa SDL_ConvertSurfaceAndColorspace
929 * \sa SDL_DestroySurface
930 */
931extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface(SDL_Surface *surface, SDL_PixelFormat format);
932
933/**
934 * Copy an existing surface to a new surface of the specified format and
935 * colorspace.
936 *
937 * This function converts an existing surface to a new format and colorspace
938 * and returns the new surface. This will perform any pixel format and
939 * colorspace conversion needed.
940 *
941 * If the original surface has alternate images, the new surface will have a
942 * reference to them as well.
943 *
944 * \param surface the existing SDL_Surface structure to convert.
945 * \param format the new pixel format.
946 * \param palette an optional palette to use for indexed formats, may be NULL.
947 * \param colorspace the new colorspace.
948 * \param props an SDL_PropertiesID with additional color properties, or 0.
949 * \returns the new SDL_Surface structure that is created or NULL on failure;
950 * call SDL_GetError() for more information.
951 *
952 * \threadsafety This function is not thread safe.
953 *
954 * \since This function is available since SDL 3.2.0.
955 *
956 * \sa SDL_ConvertSurface
957 * \sa SDL_DestroySurface
958 */
960
961/**
962 * Copy a block of pixels of one format to another format.
963 *
964 * \param width the width of the block to copy, in pixels.
965 * \param height the height of the block to copy, in pixels.
966 * \param src_format an SDL_PixelFormat value of the `src` pixels format.
967 * \param src a pointer to the source pixels.
968 * \param src_pitch the pitch of the source pixels, in bytes.
969 * \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
970 * \param dst a pointer to be filled in with new pixel data.
971 * \param dst_pitch the pitch of the destination pixels, in bytes.
972 * \returns true on success or false on failure; call SDL_GetError() for more
973 * information.
974 *
975 * \threadsafety The same destination pixels should not be used from two
976 * threads at once. It is safe to use the same source pixels
977 * from multiple threads.
978 *
979 * \since This function is available since SDL 3.2.0.
980 *
981 * \sa SDL_ConvertPixelsAndColorspace
982 */
983extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch);
984
985/**
986 * Copy a block of pixels of one format and colorspace to another format and
987 * colorspace.
988 *
989 * \param width the width of the block to copy, in pixels.
990 * \param height the height of the block to copy, in pixels.
991 * \param src_format an SDL_PixelFormat value of the `src` pixels format.
992 * \param src_colorspace an SDL_Colorspace value describing the colorspace of
993 * the `src` pixels.
994 * \param src_properties an SDL_PropertiesID with additional source color
995 * properties, or 0.
996 * \param src a pointer to the source pixels.
997 * \param src_pitch the pitch of the source pixels, in bytes.
998 * \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
999 * \param dst_colorspace an SDL_Colorspace value describing the colorspace of
1000 * the `dst` pixels.
1001 * \param dst_properties an SDL_PropertiesID with additional destination color
1002 * properties, or 0.
1003 * \param dst a pointer to be filled in with new pixel data.
1004 * \param dst_pitch the pitch of the destination pixels, in bytes.
1005 * \returns true on success or false on failure; call SDL_GetError() for more
1006 * information.
1007 *
1008 * \threadsafety The same destination pixels should not be used from two
1009 * threads at once. It is safe to use the same source pixels
1010 * from multiple threads.
1011 *
1012 * \since This function is available since SDL 3.2.0.
1013 *
1014 * \sa SDL_ConvertPixels
1015 */
1016extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
1017
1018/**
1019 * Premultiply the alpha on a block of pixels.
1020 *
1021 * This is safe to use with src == dst, but not for other overlapping areas.
1022 *
1023 * \param width the width of the block to convert, in pixels.
1024 * \param height the height of the block to convert, in pixels.
1025 * \param src_format an SDL_PixelFormat value of the `src` pixels format.
1026 * \param src a pointer to the source pixels.
1027 * \param src_pitch the pitch of the source pixels, in bytes.
1028 * \param dst_format an SDL_PixelFormat value of the `dst` pixels format.
1029 * \param dst a pointer to be filled in with premultiplied pixel data.
1030 * \param dst_pitch the pitch of the destination pixels, in bytes.
1031 * \param linear true to convert from sRGB to linear space for the alpha
1032 * multiplication, false to do multiplication in sRGB space.
1033 * \returns true on success or false on failure; call SDL_GetError() for more
1034 * information.
1035 *
1036 * \threadsafety The same destination pixels should not be used from two
1037 * threads at once. It is safe to use the same source pixels
1038 * from multiple threads.
1039 *
1040 * \since This function is available since SDL 3.2.0.
1041 */
1042extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, bool linear);
1043
1044/**
1045 * Premultiply the alpha in a surface.
1046 *
1047 * This is safe to use with src == dst, but not for other overlapping areas.
1048 *
1049 * \param surface the surface to modify.
1050 * \param linear true to convert from sRGB to linear space for the alpha
1051 * multiplication, false to do multiplication in sRGB space.
1052 * \returns true on success or false on failure; call SDL_GetError() for more
1053 * information.
1054 *
1055 * \threadsafety This function is not thread safe.
1056 *
1057 * \since This function is available since SDL 3.2.0.
1058 */
1059extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear);
1060
1061/**
1062 * Clear a surface with a specific color, with floating point precision.
1063 *
1064 * This function handles all surface formats, and ignores any clip rectangle.
1065 *
1066 * If the surface is YUV, the color is assumed to be in the sRGB colorspace,
1067 * otherwise the color is assumed to be in the colorspace of the suface.
1068 *
1069 * \param surface the SDL_Surface to clear.
1070 * \param r the red component of the pixel, normally in the range 0-1.
1071 * \param g the green component of the pixel, normally in the range 0-1.
1072 * \param b the blue component of the pixel, normally in the range 0-1.
1073 * \param a the alpha component of the pixel, normally in the range 0-1.
1074 * \returns true on success or false on failure; call SDL_GetError() for more
1075 * information.
1076 *
1077 * \threadsafety This function is not thread safe.
1078 *
1079 * \since This function is available since SDL 3.2.0.
1080 */
1081extern SDL_DECLSPEC bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a);
1082
1083/**
1084 * Perform a fast fill of a rectangle with a specific color.
1085 *
1086 * `color` should be a pixel of the format used by the surface, and can be
1087 * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
1088 * alpha component then the destination is simply filled with that alpha
1089 * information, no blending takes place.
1090 *
1091 * If there is a clip rectangle set on the destination (set via
1092 * SDL_SetSurfaceClipRect()), then this function will fill based on the
1093 * intersection of the clip rectangle and `rect`.
1094 *
1095 * \param dst the SDL_Surface structure that is the drawing target.
1096 * \param rect the SDL_Rect structure representing the rectangle to fill, or
1097 * NULL to fill the entire surface.
1098 * \param color the color to fill with.
1099 * \returns true on success or false on failure; call SDL_GetError() for more
1100 * information.
1101 *
1102 * \threadsafety This function is not thread safe.
1103 *
1104 * \since This function is available since SDL 3.2.0.
1105 *
1106 * \sa SDL_FillSurfaceRects
1107 */
1108extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
1109
1110/**
1111 * Perform a fast fill of a set of rectangles with a specific color.
1112 *
1113 * `color` should be a pixel of the format used by the surface, and can be
1114 * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
1115 * alpha component then the destination is simply filled with that alpha
1116 * information, no blending takes place.
1117 *
1118 * If there is a clip rectangle set on the destination (set via
1119 * SDL_SetSurfaceClipRect()), then this function will fill based on the
1120 * intersection of the clip rectangle and `rect`.
1121 *
1122 * \param dst the SDL_Surface structure that is the drawing target.
1123 * \param rects an array of SDL_Rects representing the rectangles to fill.
1124 * \param count the number of rectangles in the array.
1125 * \param color the color to fill with.
1126 * \returns true on success or false on failure; call SDL_GetError() for more
1127 * information.
1128 *
1129 * \threadsafety This function is not thread safe.
1130 *
1131 * \since This function is available since SDL 3.2.0.
1132 *
1133 * \sa SDL_FillSurfaceRect
1134 */
1135extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
1136
1137/**
1138 * Performs a fast blit from the source surface to the destination surface
1139 * with clipping.
1140 *
1141 * If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
1142 * `dst`) is copied while ensuring clipping to `dst->clip_rect`.
1143 *
1144 * The blit function should not be called on a locked surface.
1145 *
1146 * The blit semantics for surfaces with and without blending and colorkey are
1147 * defined as follows:
1148 *
1149 * ```
1150 * RGBA->RGB:
1151 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
1152 * alpha-blend (using the source alpha-channel and per-surface alpha)
1153 * SDL_SRCCOLORKEY ignored.
1154 * Source surface blend mode set to SDL_BLENDMODE_NONE:
1155 * copy RGB.
1156 * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the
1157 * RGB values of the source color key, ignoring alpha in the
1158 * comparison.
1159 *
1160 * RGB->RGBA:
1161 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
1162 * alpha-blend (using the source per-surface alpha)
1163 * Source surface blend mode set to SDL_BLENDMODE_NONE:
1164 * copy RGB, set destination alpha to source per-surface alpha value.
1165 * both:
1166 * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the
1167 * source color key.
1168 *
1169 * RGBA->RGBA:
1170 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
1171 * alpha-blend (using the source alpha-channel and per-surface alpha)
1172 * SDL_SRCCOLORKEY ignored.
1173 * Source surface blend mode set to SDL_BLENDMODE_NONE:
1174 * copy all of RGBA to the destination.
1175 * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the
1176 * RGB values of the source color key, ignoring alpha in the
1177 * comparison.
1178 *
1179 * RGB->RGB:
1180 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
1181 * alpha-blend (using the source per-surface alpha)
1182 * Source surface blend mode set to SDL_BLENDMODE_NONE:
1183 * copy RGB.
1184 * both:
1185 * if SDL_SRCCOLORKEY set, only copy the pixels that do not match the
1186 * source color key.
1187 * ```
1188 *
1189 * \param src the SDL_Surface structure to be copied from.
1190 * \param srcrect the SDL_Rect structure representing the rectangle to be
1191 * copied, or NULL to copy the entire surface.
1192 * \param dst the SDL_Surface structure that is the blit target.
1193 * \param dstrect the SDL_Rect structure representing the x and y position in
1194 * the destination surface, or NULL for (0,0). The width and
1195 * height are ignored, and are copied from `srcrect`. If you
1196 * want a specific width and height, you should use
1197 * SDL_BlitSurfaceScaled().
1198 * \returns true on success or false on failure; call SDL_GetError() for more
1199 * information.
1200 *
1201 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1202 * at any given time.
1203 *
1204 * \since This function is available since SDL 3.2.0.
1205 *
1206 * \sa SDL_BlitSurfaceScaled
1207 */
1208extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
1209
1210/**
1211 * Perform low-level surface blitting only.
1212 *
1213 * This is a semi-private blit function and it performs low-level surface
1214 * blitting, assuming the input rectangles have already been clipped.
1215 *
1216 * \param src the SDL_Surface structure to be copied from.
1217 * \param srcrect the SDL_Rect structure representing the rectangle to be
1218 * copied, may not be NULL.
1219 * \param dst the SDL_Surface structure that is the blit target.
1220 * \param dstrect the SDL_Rect structure representing the target rectangle in
1221 * the destination surface, may not be NULL.
1222 * \returns true on success or false on failure; call SDL_GetError() for more
1223 * information.
1224 *
1225 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1226 * at any given time.
1227 *
1228 * \since This function is available since SDL 3.2.0.
1229 *
1230 * \sa SDL_BlitSurface
1231 */
1232extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
1233
1234/**
1235 * Perform a scaled blit to a destination surface, which may be of a different
1236 * format.
1237 *
1238 * \param src the SDL_Surface structure to be copied from.
1239 * \param srcrect the SDL_Rect structure representing the rectangle to be
1240 * copied, or NULL to copy the entire surface.
1241 * \param dst the SDL_Surface structure that is the blit target.
1242 * \param dstrect the SDL_Rect structure representing the target rectangle in
1243 * the destination surface, or NULL to fill the entire
1244 * destination surface.
1245 * \param scaleMode the SDL_ScaleMode to be used.
1246 * \returns true on success or false on failure; call SDL_GetError() for more
1247 * information.
1248 *
1249 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1250 * at any given time.
1251 *
1252 * \since This function is available since SDL 3.2.0.
1253 *
1254 * \sa SDL_BlitSurface
1255 */
1256extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
1257
1258/**
1259 * Perform low-level surface scaled blitting only.
1260 *
1261 * This is a semi-private function and it performs low-level surface blitting,
1262 * assuming the input rectangles have already been clipped.
1263 *
1264 * \param src the SDL_Surface structure to be copied from.
1265 * \param srcrect the SDL_Rect structure representing the rectangle to be
1266 * copied, may not be NULL.
1267 * \param dst the SDL_Surface structure that is the blit target.
1268 * \param dstrect the SDL_Rect structure representing the target rectangle in
1269 * the destination surface, may not be NULL.
1270 * \param scaleMode the SDL_ScaleMode to be used.
1271 * \returns true on success or false on failure; call SDL_GetError() for more
1272 * information.
1273 *
1274 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1275 * at any given time.
1276 *
1277 * \since This function is available since SDL 3.2.0.
1278 *
1279 * \sa SDL_BlitSurfaceScaled
1280 */
1281extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
1282
1283/**
1284 * Perform a stretched pixel copy from one surface to another.
1285 *
1286 * \param src the SDL_Surface structure to be copied from.
1287 * \param srcrect the SDL_Rect structure representing the rectangle to be
1288 * copied, or NULL to copy the entire surface.
1289 * \param dst the SDL_Surface structure that is the blit target.
1290 * \param dstrect the SDL_Rect structure representing the target rectangle in
1291 * the destination surface, or NULL to fill the entire
1292 * destination surface.
1293 * \param scaleMode the SDL_ScaleMode to be used.
1294 * \returns true on success or false on failure; call SDL_GetError() for more
1295 * information.
1296 *
1297 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1298 * at any given time.
1299 *
1300 * \since This function is available since SDL 3.4.0.
1301 *
1302 * \sa SDL_BlitSurfaceScaled
1303 */
1304extern SDL_DECLSPEC bool SDLCALL SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
1305
1306/**
1307 * Perform a tiled blit to a destination surface, which may be of a different
1308 * format.
1309 *
1310 * The pixels in `srcrect` will be repeated as many times as needed to
1311 * completely fill `dstrect`.
1312 *
1313 * \param src the SDL_Surface structure to be copied from.
1314 * \param srcrect the SDL_Rect structure representing the rectangle to be
1315 * copied, or NULL to copy the entire surface.
1316 * \param dst the SDL_Surface structure that is the blit target.
1317 * \param dstrect the SDL_Rect structure representing the target rectangle in
1318 * the destination surface, or NULL to fill the entire surface.
1319 * \returns true on success or false on failure; call SDL_GetError() for more
1320 * information.
1321 *
1322 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1323 * at any given time.
1324 *
1325 * \since This function is available since SDL 3.2.0.
1326 *
1327 * \sa SDL_BlitSurface
1328 */
1329extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
1330
1331/**
1332 * Perform a scaled and tiled blit to a destination surface, which may be of a
1333 * different format.
1334 *
1335 * The pixels in `srcrect` will be scaled and repeated as many times as needed
1336 * to completely fill `dstrect`.
1337 *
1338 * \param src the SDL_Surface structure to be copied from.
1339 * \param srcrect the SDL_Rect structure representing the rectangle to be
1340 * copied, or NULL to copy the entire surface.
1341 * \param scale the scale used to transform srcrect into the destination
1342 * rectangle, e.g. a 32x32 texture with a scale of 2 would fill
1343 * 64x64 tiles.
1344 * \param scaleMode scale algorithm to be used.
1345 * \param dst the SDL_Surface structure that is the blit target.
1346 * \param dstrect the SDL_Rect structure representing the target rectangle in
1347 * the destination surface, or NULL to fill the entire surface.
1348 * \returns true on success or false on failure; call SDL_GetError() for more
1349 * information.
1350 *
1351 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1352 * at any given time.
1353 *
1354 * \since This function is available since SDL 3.2.0.
1355 *
1356 * \sa SDL_BlitSurface
1357 */
1358extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
1359
1360/**
1361 * Perform a scaled blit using the 9-grid algorithm to a destination surface,
1362 * which may be of a different format.
1363 *
1364 * The pixels in the source surface are split into a 3x3 grid, using the
1365 * different corner sizes for each corner, and the sides and center making up
1366 * the remaining pixels. The corners are then scaled using `scale` and fit
1367 * into the corners of the destination rectangle. The sides and center are
1368 * then stretched into place to cover the remaining destination rectangle.
1369 *
1370 * \param src the SDL_Surface structure to be copied from.
1371 * \param srcrect the SDL_Rect structure representing the rectangle to be used
1372 * for the 9-grid, or NULL to use the entire surface.
1373 * \param left_width the width, in pixels, of the left corners in `srcrect`.
1374 * \param right_width the width, in pixels, of the right corners in `srcrect`.
1375 * \param top_height the height, in pixels, of the top corners in `srcrect`.
1376 * \param bottom_height the height, in pixels, of the bottom corners in
1377 * `srcrect`.
1378 * \param scale the scale used to transform the corner of `srcrect` into the
1379 * corner of `dstrect`, or 0.0f for an unscaled blit.
1380 * \param scaleMode scale algorithm to be used.
1381 * \param dst the SDL_Surface structure that is the blit target.
1382 * \param dstrect the SDL_Rect structure representing the target rectangle in
1383 * the destination surface, or NULL to fill the entire surface.
1384 * \returns true on success or false on failure; call SDL_GetError() for more
1385 * information.
1386 *
1387 * \threadsafety Only one thread should be using the `src` and `dst` surfaces
1388 * at any given time.
1389 *
1390 * \since This function is available since SDL 3.2.0.
1391 *
1392 * \sa SDL_BlitSurface
1393 */
1394extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect);
1395
1396/**
1397 * Map an RGB triple to an opaque pixel value for a surface.
1398 *
1399 * This function maps the RGB color value to the specified pixel format and
1400 * returns the pixel value best approximating the given RGB color value for
1401 * the given pixel format.
1402 *
1403 * If the surface has a palette, the index of the closest matching color in
1404 * the palette will be returned.
1405 *
1406 * If the surface pixel format has an alpha component it will be returned as
1407 * all 1 bits (fully opaque).
1408 *
1409 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
1410 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
1411 * format the return value can be assigned to a Uint16, and similarly a Uint8
1412 * for an 8-bpp format).
1413 *
1414 * \param surface the surface to use for the pixel format and palette.
1415 * \param r the red component of the pixel in the range 0-255.
1416 * \param g the green component of the pixel in the range 0-255.
1417 * \param b the blue component of the pixel in the range 0-255.
1418 * \returns a pixel value.
1419 *
1420 * \threadsafety It is safe to call this function from any thread.
1421 *
1422 * \since This function is available since SDL 3.2.0.
1423 *
1424 * \sa SDL_MapSurfaceRGBA
1425 */
1426extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGB(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
1427
1428/**
1429 * Map an RGBA quadruple to a pixel value for a surface.
1430 *
1431 * This function maps the RGBA color value to the specified pixel format and
1432 * returns the pixel value best approximating the given RGBA color value for
1433 * the given pixel format.
1434 *
1435 * If the surface pixel format has no alpha component the alpha value will be
1436 * ignored (as it will be in formats with a palette).
1437 *
1438 * If the surface has a palette, the index of the closest matching color in
1439 * the palette will be returned.
1440 *
1441 * If the pixel format bpp (color depth) is less than 32-bpp then the unused
1442 * upper bits of the return value can safely be ignored (e.g., with a 16-bpp
1443 * format the return value can be assigned to a Uint16, and similarly a Uint8
1444 * for an 8-bpp format).
1445 *
1446 * \param surface the surface to use for the pixel format and palette.
1447 * \param r the red component of the pixel in the range 0-255.
1448 * \param g the green component of the pixel in the range 0-255.
1449 * \param b the blue component of the pixel in the range 0-255.
1450 * \param a the alpha component of the pixel in the range 0-255.
1451 * \returns a pixel value.
1452 *
1453 * \threadsafety It is safe to call this function from any thread.
1454 *
1455 * \since This function is available since SDL 3.2.0.
1456 *
1457 * \sa SDL_MapSurfaceRGB
1458 */
1459extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1460
1461/**
1462 * Retrieves a single pixel from a surface.
1463 *
1464 * This function prioritizes correctness over speed: it is suitable for unit
1465 * tests, but is not intended for use in a game engine.
1466 *
1467 * Like SDL_GetRGBA, this uses the entire 0..255 range when converting color
1468 * components from pixel formats with less than 8 bits per RGB component.
1469 *
1470 * \param surface the surface to read.
1471 * \param x the horizontal coordinate, 0 <= x < width.
1472 * \param y the vertical coordinate, 0 <= y < height.
1473 * \param r a pointer filled in with the red channel, 0-255, or NULL to ignore
1474 * this channel.
1475 * \param g a pointer filled in with the green channel, 0-255, or NULL to
1476 * ignore this channel.
1477 * \param b a pointer filled in with the blue channel, 0-255, or NULL to
1478 * ignore this channel.
1479 * \param a a pointer filled in with the alpha channel, 0-255, or NULL to
1480 * ignore this channel.
1481 * \returns true on success or false on failure; call SDL_GetError() for more
1482 * information.
1483 *
1484 * \threadsafety This function is not thread safe.
1485 *
1486 * \since This function is available since SDL 3.2.0.
1487 */
1488extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1489
1490/**
1491 * Retrieves a single pixel from a surface.
1492 *
1493 * This function prioritizes correctness over speed: it is suitable for unit
1494 * tests, but is not intended for use in a game engine.
1495 *
1496 * \param surface the surface to read.
1497 * \param x the horizontal coordinate, 0 <= x < width.
1498 * \param y the vertical coordinate, 0 <= y < height.
1499 * \param r a pointer filled in with the red channel, normally in the range
1500 * 0-1, or NULL to ignore this channel.
1501 * \param g a pointer filled in with the green channel, normally in the range
1502 * 0-1, or NULL to ignore this channel.
1503 * \param b a pointer filled in with the blue channel, normally in the range
1504 * 0-1, or NULL to ignore this channel.
1505 * \param a a pointer filled in with the alpha channel, normally in the range
1506 * 0-1, or NULL to ignore this channel.
1507 * \returns true on success or false on failure; call SDL_GetError() for more
1508 * information.
1509 *
1510 * \threadsafety This function is not thread safe.
1511 *
1512 * \since This function is available since SDL 3.2.0.
1513 */
1514extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a);
1515
1516/**
1517 * Writes a single pixel to a surface.
1518 *
1519 * This function prioritizes correctness over speed: it is suitable for unit
1520 * tests, but is not intended for use in a game engine.
1521 *
1522 * Like SDL_MapRGBA, this uses the entire 0..255 range when converting color
1523 * components from pixel formats with less than 8 bits per RGB component.
1524 *
1525 * \param surface the surface to write.
1526 * \param x the horizontal coordinate, 0 <= x < width.
1527 * \param y the vertical coordinate, 0 <= y < height.
1528 * \param r the red channel value, 0-255.
1529 * \param g the green channel value, 0-255.
1530 * \param b the blue channel value, 0-255.
1531 * \param a the alpha channel value, 0-255.
1532 * \returns true on success or false on failure; call SDL_GetError() for more
1533 * information.
1534 *
1535 * \threadsafety This function is not thread safe.
1536 *
1537 * \since This function is available since SDL 3.2.0.
1538 */
1539extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1540
1541/**
1542 * Writes a single pixel to a surface.
1543 *
1544 * This function prioritizes correctness over speed: it is suitable for unit
1545 * tests, but is not intended for use in a game engine.
1546 *
1547 * \param surface the surface to write.
1548 * \param x the horizontal coordinate, 0 <= x < width.
1549 * \param y the vertical coordinate, 0 <= y < height.
1550 * \param r the red channel value, normally in the range 0-1.
1551 * \param g the green channel value, normally in the range 0-1.
1552 * \param b the blue channel value, normally in the range 0-1.
1553 * \param a the alpha channel value, normally in the range 0-1.
1554 * \returns true on success or false on failure; call SDL_GetError() for more
1555 * information.
1556 *
1557 * \threadsafety This function is not thread safe.
1558 *
1559 * \since This function is available since SDL 3.2.0.
1560 */
1561extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a);
1562
1563/* Ends C function definitions when using C++ */
1564#ifdef __cplusplus
1565}
1566#endif
1567#include <SDL3/SDL_close_code.h>
1568
1569#endif /* SDL_surface_h_ */
Uint32 SDL_BlendMode
struct SDL_IOStream SDL_IOStream
SDL_Colorspace
SDL_PixelFormat
Definition SDL_pixels.h:549
Uint32 SDL_PropertiesID
uint8_t Uint8
Definition SDL_stdinc.h:445
uint32_t Uint32
Definition SDL_stdinc.h:481
bool SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)
SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface)
bool SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
bool SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
bool SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
bool SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, bool linear)
bool SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear)
bool SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
void SDL_DestroySurface(SDL_Surface *surface)
bool SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
bool SDL_SaveBMP(SDL_Surface *surface, const char *file)
bool SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip)
Uint32 SDL_MapSurfaceRGB(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
bool SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a)
SDL_Surface * SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio)
bool SDL_SetSurfaceColorKey(SDL_Surface *surface, bool enabled, Uint32 key)
SDL_Surface * SDL_DuplicateSurface(SDL_Surface *surface)
bool SDL_SurfaceHasAlternateImages(SDL_Surface *surface)
bool SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a)
bool SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled)
bool SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect)
void SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface)
bool SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color)
Uint32 SDL_SurfaceFlags
Definition SDL_surface.h:65
SDL_Palette * SDL_CreateSurfacePalette(SDL_Surface *surface)
bool SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
SDL_Surface * SDL_ConvertSurface(SDL_Surface *surface, SDL_PixelFormat format)
bool SDL_SurfaceHasColorKey(SDL_Surface *surface)
bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
bool SDL_SurfaceHasRLE(SDL_Surface *surface)
SDL_Surface ** SDL_GetSurfaceImages(SDL_Surface *surface, int *count)
SDL_Palette * SDL_GetSurfacePalette(SDL_Surface *surface)
SDL_ScaleMode
Definition SDL_surface.h:85
@ SDL_SCALEMODE_LINEAR
Definition SDL_surface.h:88
@ SDL_SCALEMODE_PIXELART
Definition SDL_surface.h:89
@ SDL_SCALEMODE_NEAREST
Definition SDL_surface.h:87
@ SDL_SCALEMODE_INVALID
Definition SDL_surface.h:86
bool SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch)
bool SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image)
bool SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
SDL_FlipMode
Definition SDL_surface.h:98
@ SDL_FLIP_HORIZONTAL_AND_VERTICAL
@ SDL_FLIP_VERTICAL
@ SDL_FLIP_NONE
Definition SDL_surface.h:99
@ SDL_FLIP_HORIZONTAL
SDL_Colorspace SDL_GetSurfaceColorspace(SDL_Surface *surface)
void SDL_UnlockSurface(SDL_Surface *surface)
SDL_Surface * SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelFormat format, SDL_Palette *palette, SDL_Colorspace colorspace, SDL_PropertiesID props)
SDL_Surface * SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode)
bool SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
bool SDL_LockSurface(SDL_Surface *surface)
bool SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch)
Uint32 SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
SDL_Surface * SDL_CreateSurfaceFrom(int width, int height, SDL_PixelFormat format, void *pixels, int pitch)
bool SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
bool SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect)
bool SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
bool SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
SDL_Surface * SDL_LoadBMP(const char *file)
bool SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace)
bool SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
bool SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
bool SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
bool SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)
bool SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
SDL_Surface * SDL_CreateSurface(int width, int height, SDL_PixelFormat format)
SDL_SurfaceFlags flags
void * reserved
SDL_PixelFormat format
void * pixels