SDL 3.0
SDL_surface.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 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 * \file SDL_surface.h
24 *
25 * Header file for ::SDL_Surface definition and management functions.
26 */
27
28#ifndef SDL_surface_h_
29#define SDL_surface_h_
30
31#include <SDL3/SDL_stdinc.h>
32#include <SDL3/SDL_blendmode.h>
33#include <SDL3/SDL_pixels.h>
34#include <SDL3/SDL_properties.h>
35#include <SDL3/SDL_rect.h>
36#include <SDL3/SDL_iostream.h>
37
38#include <SDL3/SDL_begin_code.h>
39/* Set up for C function definitions, even when using C++ */
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/**
45 * \name Surface flags
46 *
47 * These are the currently supported flags for the ::SDL_Surface.
48 *
49 * \internal
50 * Used internally (read-only).
51 */
52/* @{ */
53#define SDL_SWSURFACE 0 /**< Just here for compatibility */
54#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */
55#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */
56#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */
57#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */
58#define SDL_SURFACE_USES_PROPERTIES 0x00000010 /**< Surface uses properties */
59/* @} *//* Surface flags */
60
61/**
62 * Evaluates to true if the surface needs to be locked before access.
63 */
64#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
65
66typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */
67
68/**
69 * The scaling mode
70 */
71typedef enum
72{
73 SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
74 SDL_SCALEMODE_LINEAR, /**< linear filtering */
75 SDL_SCALEMODE_BEST /**< anisotropic filtering */
77
78/**
79 * The flip mode
80 */
81typedef enum
82{
83 SDL_FLIP_NONE, /**< Do not flip */
84 SDL_FLIP_HORIZONTAL, /**< flip horizontally */
85 SDL_FLIP_VERTICAL /**< flip vertically */
87
88/**
89 * A collection of pixels used in software blitting.
90 *
91 * Pixels are arranged in memory in rows, with the top row first.
92 * Each row occupies an amount of memory given by the pitch (sometimes
93 * known as the row stride in non-SDL APIs).
94 *
95 * Within each row, pixels are arranged from left to right until the
96 * width is reached.
97 * Each pixel occupies a number of bits appropriate for its format, with
98 * most formats representing each pixel as one or more whole bytes
99 * (in some indexed formats, instead multiple pixels are packed into
100 * each byte), and a byte order given by the format.
101 * After encoding all pixels, any remaining bytes to reach the pitch are
102 * used as padding to reach a desired alignment, and have undefined contents.
103 *
104 * \note This structure should be treated as read-only, except for \c pixels,
105 * which, if not NULL, contains the raw pixel data for the surface.
106 */
107typedef struct SDL_Surface
108{
109 Uint32 flags; /**< Read-only */
110 SDL_PixelFormat *format; /**< Read-only */
111 int w, h; /**< Read-only */
112 int pitch; /**< Read-only */
113 void *pixels; /**< Read-write */
114
115 void *reserved; /**< Private */
116
117 /** information needed for surfaces requiring locks */
118 int locked; /**< Read-only */
119
120 /** list of BlitMap that hold a reference to this surface */
121 void *list_blitmap; /**< Private */
122
123 /** clipping information */
124 SDL_Rect clip_rect; /**< Read-only */
125
126 /** info for fast blit mapping to other surfaces */
127 SDL_BlitMap *map; /**< Private */
128
129 /** Reference count -- used when freeing surface */
130 int refcount; /**< Read-mostly */
132
133/**
134 * The type of function used for surface blitting functions.
135 */
136typedef int (SDLCALL *SDL_blit) (struct SDL_Surface *src, const SDL_Rect *srcrect,
137 struct SDL_Surface *dst, const SDL_Rect *dstrect);
138
139
140/**
141 * Allocate a new RGB surface with a specific pixel format.
142 *
143 * \param width the width of the surface
144 * \param height the height of the surface
145 * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
146 * \returns the new SDL_Surface structure that is created or NULL if it fails;
147 * call SDL_GetError() for more information.
148 *
149 * \since This function is available since SDL 3.0.0.
150 *
151 * \sa SDL_CreateSurfaceFrom
152 * \sa SDL_DestroySurface
153 */
154extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format);
155
156/**
157 * Allocate a new RGB surface with a specific pixel format and existing pixel
158 * data.
159 *
160 * No copy is made of the pixel data. Pixel data is not managed automatically;
161 * you must free the surface before you free the pixel data.
162 *
163 * Pitch is the offset in bytes from one row of pixels to the next, e.g.
164 * `width*4` for `SDL_PIXELFORMAT_RGBA8888`.
165 *
166 * You may pass NULL for pixels and 0 for pitch to create a surface that you
167 * will fill in with valid values later.
168 *
169 * \param pixels a pointer to existing pixel data
170 * \param width the width of the surface
171 * \param height the height of the surface
172 * \param pitch the number of bytes between each row, including padding
173 * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
174 * \returns the new SDL_Surface structure that is created or NULL if it fails;
175 * call SDL_GetError() for more information.
176 *
177 * \since This function is available since SDL 3.0.0.
178 *
179 * \sa SDL_CreateSurface
180 * \sa SDL_DestroySurface
181 */
182extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom(void *pixels, int width, int height, int pitch, SDL_PixelFormatEnum format);
183
184/**
185 * Free an RGB surface.
186 *
187 * It is safe to pass NULL to this function.
188 *
189 * \param surface the SDL_Surface to free.
190 *
191 * \since This function is available since SDL 3.0.0.
192 *
193 * \sa SDL_CreateSurface
194 * \sa SDL_CreateSurfaceFrom
195 */
196extern DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);
197
198/**
199 * Get the properties associated with a surface.
200 *
201 * The following properties are understood by SDL:
202 *
203 * - `SDL_PROP_SURFACE_COLORSPACE_NUMBER`: an SDL_ColorSpace value describing
204 * the surface colorspace, defaults to SDL_COLORSPACE_SRGB_LINEAR for
205 * floating point formats, SDL_COLORSPACE_HDR10 for 10-bit formats,
206 * SDL_COLORSPACE_SRGB for other RGB surfaces and SDL_COLORSPACE_BT709_FULL
207 * for YUV surfaces.
208 * - `SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
209 * surfaces, this defines the value of 100% diffuse white, with higher
210 * values being displayed in the High Dynamic Range headroom. This defaults
211 * to 203 for HDR10 surfaces and 1.0 for floating point surfaces.
212 * - `SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
213 * surfaces, this defines the maximum dynamic range used by the content, in
214 * terms of the SDR white point. This defaults to 0.0, which disables tone
215 * mapping.
216 * - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator
217 * used when compressing from a surface with high dynamic range to another
218 * with lower dynamic range. Currently this supports "chrome", which uses
219 * the same tone mapping that Chrome uses for HDR content, the form "*=N",
220 * where N is a floating point scale factor applied in linear space, and
221 * "none", which disables tone mapping. This defaults to "chrome".
222 *
223 * \param surface the SDL_Surface structure to query
224 * \returns a valid property ID on success or 0 on failure; call
225 * SDL_GetError() for more information.
226 *
227 * \since This function is available since SDL 3.0.0.
228 *
229 * \sa SDL_GetProperty
230 * \sa SDL_SetProperty
231 */
232extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface);
233
234#define SDL_PROP_SURFACE_COLORSPACE_NUMBER "SDL.surface.colorspace"
235#define SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT "SDL.surface.SDR_white_point"
236#define SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT "SDL.surface.HDR_headroom"
237#define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING "SDL.surface.tonemap"
238
239/**
240 * Set the colorspace used by a surface.
241 *
242 * Setting the colorspace doesn't change the pixels, only how they are
243 * interpreted in color operations.
244 *
245 * \param surface the SDL_Surface structure to update
246 * \param colorspace an SDL_ColorSpace value describing the surface colorspace
247 * \returns 0 on success or a negative error code on failure; call
248 * SDL_GetError() for more information.
249 *
250 * \since This function is available since SDL 3.0.0.
251 */
252extern DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
253
254/**
255 * Get the colorspace used by a surface.
256 *
257 * The colorspace defaults to SDL_COLORSPACE_SRGB_LINEAR for floating point
258 * formats, SDL_COLORSPACE_HDR10 for 10-bit formats, SDL_COLORSPACE_SRGB for
259 * other RGB surfaces and SDL_COLORSPACE_BT709_FULL for YUV textures.
260 *
261 * \param surface the SDL_Surface structure to query
262 * \param colorspace a pointer filled in with an SDL_ColorSpace value
263 * describing the surface colorspace
264 * \returns 0 on success or a negative error code on failure; call
265 * SDL_GetError() for more information.
266 *
267 * \since This function is available since SDL 3.0.0.
268 */
269extern DECLSPEC int SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace *colorspace);
270
271/**
272 * Set the palette used by a surface.
273 *
274 * A single palette can be shared with many surfaces.
275 *
276 * \param surface the SDL_Surface structure to update
277 * \param palette the SDL_Palette structure to use
278 * \returns 0 on success or a negative error code on failure; call
279 * SDL_GetError() for more information.
280 *
281 * \since This function is available since SDL 3.0.0.
282 */
283extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
284
285/**
286 * Set up a surface for directly accessing the pixels.
287 *
288 * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to
289 * and read from `surface->pixels`, using the pixel format stored in
290 * `surface->format`. Once you are done accessing the surface, you should use
291 * SDL_UnlockSurface() to release it.
292 *
293 * Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to
294 * 0, then you can read and write to the surface at any time, and the pixel
295 * format of the surface will not change.
296 *
297 * \param surface the SDL_Surface structure to be locked
298 * \returns 0 on success or a negative error code on failure; call
299 * SDL_GetError() for more information.
300 *
301 * \since This function is available since SDL 3.0.0.
302 *
303 * \sa SDL_MUSTLOCK
304 * \sa SDL_UnlockSurface
305 */
306extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
307
308/**
309 * Release a surface after directly accessing the pixels.
310 *
311 * \param surface the SDL_Surface structure to be unlocked
312 *
313 * \since This function is available since SDL 3.0.0.
314 *
315 * \sa SDL_LockSurface
316 */
317extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
318
319/**
320 * Load a BMP image from a seekable SDL data stream.
321 *
322 * The new surface should be freed with SDL_DestroySurface(). Not doing so
323 * will result in a memory leak.
324 *
325 * \param src the data stream for the surface
326 * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning,
327 * even in the case of an error
328 * \returns a pointer to a new SDL_Surface structure or NULL if there was an
329 * error; call SDL_GetError() for more information.
330 *
331 * \since This function is available since SDL 3.0.0.
332 *
333 * \sa SDL_DestroySurface
334 * \sa SDL_LoadBMP
335 * \sa SDL_SaveBMP_IO
336 */
337extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool closeio);
338
339/**
340 * Load a BMP image from a file.
341 *
342 * The new surface should be freed with SDL_DestroySurface(). Not doing so
343 * will result in a memory leak.
344 *
345 * \param file the BMP file to load
346 * \returns a pointer to a new SDL_Surface structure or NULL if there was an
347 * error; call SDL_GetError() for more information.
348 *
349 * \since This function is available since SDL 3.0.0.
350 *
351 * \sa SDL_DestroySurface
352 * \sa SDL_LoadBMP_IO
353 * \sa SDL_SaveBMP
354 */
355extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP(const char *file);
356
357/**
358 * Save a surface to a seekable SDL data stream in BMP format.
359 *
360 * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
361 * BMP directly. Other RGB formats with 8-bit or higher get converted to a
362 * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
363 * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
364 * not supported.
365 *
366 * \param surface the SDL_Surface structure containing the image to be saved
367 * \param dst a data stream to save to
368 * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `dst` before returning,
369 * even in the case of an error
370 * \returns 0 on success or a negative error code on failure; call
371 * SDL_GetError() for more information.
372 *
373 * \since This function is available since SDL 3.0.0.
374 *
375 * \sa SDL_LoadBMP_IO
376 * \sa SDL_SaveBMP
377 */
378extern DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
379
380/**
381 * Save a surface to a file.
382 *
383 * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
384 * BMP directly. Other RGB formats with 8-bit or higher get converted to a
385 * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
386 * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
387 * not supported.
388 *
389 * \param surface the SDL_Surface structure containing the image to be saved
390 * \param file a file to save to
391 * \returns 0 on success or a negative error code on failure; call
392 * SDL_GetError() for more information.
393 *
394 * \since This function is available since SDL 3.0.0.
395 *
396 * \sa SDL_LoadBMP
397 * \sa SDL_SaveBMP_IO
398 */
399extern DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
400
401/**
402 * Set the RLE acceleration hint for a surface.
403 *
404 * If RLE is enabled, color key and alpha blending blits are much faster, but
405 * the surface must be locked before directly accessing the pixels.
406 *
407 * \param surface the SDL_Surface structure to optimize
408 * \param flag 0 to disable, non-zero to enable RLE acceleration
409 * \returns 0 on success or a negative error code on failure; call
410 * SDL_GetError() for more information.
411 *
412 * \since This function is available since SDL 3.0.0.
413 *
414 * \sa SDL_BlitSurface
415 * \sa SDL_LockSurface
416 * \sa SDL_UnlockSurface
417 */
418extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
419
420/**
421 * Returns whether the surface is RLE enabled
422 *
423 * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
424 *
425 * \param surface the SDL_Surface structure to query
426 * \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
427 *
428 * \since This function is available since SDL 3.0.0.
429 *
430 * \sa SDL_SetSurfaceRLE
431 */
432extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
433
434/**
435 * Set the color key (transparent pixel) in a surface.
436 *
437 * The color key defines a pixel value that will be treated as transparent in
438 * a blit. For example, one can use this to specify that cyan pixels should be
439 * considered transparent, and therefore not rendered.
440 *
441 * It is a pixel of the format used by the surface, as generated by
442 * SDL_MapRGB().
443 *
444 * RLE acceleration can substantially speed up blitting of images with large
445 * horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details.
446 *
447 * \param surface the SDL_Surface structure to update
448 * \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key
449 * \param key the transparent pixel
450 * \returns 0 on success or a negative error code on failure; call
451 * SDL_GetError() for more information.
452 *
453 * \since This function is available since SDL 3.0.0.
454 *
455 * \sa SDL_GetSurfaceColorKey
456 * \sa SDL_SurfaceHasColorKey
457 */
458extern DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, int flag, Uint32 key);
459
460/**
461 * Returns whether the surface has a color key
462 *
463 * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
464 *
465 * \param surface the SDL_Surface structure to query
466 * \returns SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
467 *
468 * \since This function is available since SDL 3.0.0.
469 *
470 * \sa SDL_SetSurfaceColorKey
471 * \sa SDL_GetSurfaceColorKey
472 */
473extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface);
474
475/**
476 * Get the color key (transparent pixel) for a surface.
477 *
478 * The color key is a pixel of the format used by the surface, as generated by
479 * SDL_MapRGB().
480 *
481 * If the surface doesn't have color key enabled this function returns -1.
482 *
483 * \param surface the SDL_Surface structure to query
484 * \param key a pointer filled in with the transparent pixel
485 * \returns 0 on success or a negative error code on failure; call
486 * SDL_GetError() for more information.
487 *
488 * \since This function is available since SDL 3.0.0.
489 *
490 * \sa SDL_SetSurfaceColorKey
491 * \sa SDL_SurfaceHasColorKey
492 */
493extern DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
494
495/**
496 * Set an additional color value multiplied into blit operations.
497 *
498 * When this surface is blitted, during the blit operation each source color
499 * channel is modulated by the appropriate color value according to the
500 * following formula:
501 *
502 * `srcC = srcC * (color / 255)`
503 *
504 * \param surface the SDL_Surface structure to update
505 * \param r the red color value multiplied into blit operations
506 * \param g the green color value multiplied into blit operations
507 * \param b the blue color value multiplied into blit operations
508 * \returns 0 on success or a negative error code on failure; call
509 * SDL_GetError() for more information.
510 *
511 * \since This function is available since SDL 3.0.0.
512 *
513 * \sa SDL_GetSurfaceColorMod
514 * \sa SDL_SetSurfaceAlphaMod
515 */
516extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
517
518
519/**
520 * Get the additional color value multiplied into blit operations.
521 *
522 * \param surface the SDL_Surface structure to query
523 * \param r a pointer filled in with the current red color value
524 * \param g a pointer filled in with the current green color value
525 * \param b a pointer filled in with the current blue color value
526 * \returns 0 on success or a negative error code on failure; call
527 * SDL_GetError() for more information.
528 *
529 * \since This function is available since SDL 3.0.0.
530 *
531 * \sa SDL_GetSurfaceAlphaMod
532 * \sa SDL_SetSurfaceColorMod
533 */
534extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
535
536/**
537 * Set an additional alpha value used in blit operations.
538 *
539 * When this surface is blitted, during the blit operation the source alpha
540 * value is modulated by this alpha value according to the following formula:
541 *
542 * `srcA = srcA * (alpha / 255)`
543 *
544 * \param surface the SDL_Surface structure to update
545 * \param alpha the alpha value multiplied into blit operations
546 * \returns 0 on success or a negative error code on failure; call
547 * SDL_GetError() for more information.
548 *
549 * \since This function is available since SDL 3.0.0.
550 *
551 * \sa SDL_GetSurfaceAlphaMod
552 * \sa SDL_SetSurfaceColorMod
553 */
554extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
555
556/**
557 * Get the additional alpha value used in blit operations.
558 *
559 * \param surface the SDL_Surface structure to query
560 * \param alpha a pointer filled in with the current alpha value
561 * \returns 0 on success or a negative error code on failure; call
562 * SDL_GetError() for more information.
563 *
564 * \since This function is available since SDL 3.0.0.
565 *
566 * \sa SDL_GetSurfaceColorMod
567 * \sa SDL_SetSurfaceAlphaMod
568 */
569extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
570
571/**
572 * Set the blend mode used for blit operations.
573 *
574 * To copy a surface to another surface (or texture) without blending with the
575 * existing data, the blendmode of the SOURCE surface should be set to
576 * `SDL_BLENDMODE_NONE`.
577 *
578 * \param surface the SDL_Surface structure to update
579 * \param blendMode the SDL_BlendMode to use for blit blending
580 * \returns 0 on success or a negative error code on failure; call
581 * SDL_GetError() for more information.
582 *
583 * \since This function is available since SDL 3.0.0.
584 *
585 * \sa SDL_GetSurfaceBlendMode
586 */
587extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
588
589/**
590 * Get the blend mode used for blit operations.
591 *
592 * \param surface the SDL_Surface structure to query
593 * \param blendMode a pointer filled in with the current SDL_BlendMode
594 * \returns 0 on success or a negative error code on failure; call
595 * SDL_GetError() for more information.
596 *
597 * \since This function is available since SDL 3.0.0.
598 *
599 * \sa SDL_SetSurfaceBlendMode
600 */
601extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
602
603/**
604 * Set the clipping rectangle for a surface.
605 *
606 * When `surface` is the destination of a blit, only the area within the clip
607 * rectangle is drawn into.
608 *
609 * Note that blits are automatically clipped to the edges of the source and
610 * destination surfaces.
611 *
612 * \param surface the SDL_Surface structure to be clipped
613 * \param rect the SDL_Rect structure representing the clipping rectangle, or
614 * NULL to disable clipping
615 * \returns SDL_TRUE if the rectangle intersects the surface, otherwise
616 * SDL_FALSE and blits will be completely clipped.
617 *
618 * \since This function is available since SDL 3.0.0.
619 *
620 * \sa SDL_GetSurfaceClipRect
621 */
622extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect);
623
624/**
625 * Get the clipping rectangle for a surface.
626 *
627 * When `surface` is the destination of a blit, only the area within the clip
628 * rectangle is drawn into.
629 *
630 * \param surface the SDL_Surface structure representing the surface to be
631 * clipped
632 * \param rect an SDL_Rect structure filled in with the clipping rectangle for
633 * the surface
634 * \returns 0 on success or a negative error code on failure; call
635 * SDL_GetError() for more information.
636 *
637 * \since This function is available since SDL 3.0.0.
638 *
639 * \sa SDL_SetSurfaceClipRect
640 */
641extern DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
642
643/*
644 * Flip a surface vertically or horizontally.
645 *
646 * \param surface the surface to flip
647 * \param flip the direction to flip
648 * \returns 0 on success or a negative error code on failure; call
649 * SDL_GetError() for more information.
650 *
651 * \since This function is available since SDL 3.0.0.
652 */
653extern DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
654
655/*
656 * Creates a new surface identical to the existing surface.
657 *
658 * The returned surface should be freed with SDL_DestroySurface().
659 *
660 * \param surface the surface to duplicate.
661 * \returns a copy of the surface, or NULL on failure; call SDL_GetError() for
662 * more information.
663 *
664 * \since This function is available since SDL 3.0.0.
665 *
666 * \sa SDL_DestroySurface
667 */
668extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface *surface);
669
670/**
671 * Copy an existing surface to a new surface of the specified format.
672 *
673 * This function is used to optimize images for faster *repeat* blitting. This
674 * is accomplished by converting the original and storing the result as a new
675 * surface. The new, optimized surface can then be used as the source for
676 * future blits, making them faster.
677 *
678 * \param surface the existing SDL_Surface structure to convert
679 * \param format the SDL_PixelFormat structure that the new surface is
680 * optimized for
681 * \returns the new SDL_Surface structure that is created or NULL if it fails;
682 * call SDL_GetError() for more information.
683 *
684 * \since This function is available since SDL 3.0.0.
685 *
686 * \sa SDL_ConvertSurfaceFormat
687 * \sa SDL_ConvertSurfaceFormatAndColorspace
688 * \sa SDL_CreatePixelFormat
689 * \sa SDL_DestroySurface
690 */
691extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format);
692
693/**
694 * Copy an existing surface to a new surface of the specified format.
695 *
696 * This function operates just like SDL_ConvertSurface(), but accepts an
697 * SDL_PixelFormatEnum value instead of an SDL_PixelFormat structure. As such,
698 * it might be easier to call but it doesn't have access to palette
699 * information for the destination surface, in case that would be important.
700 *
701 * \param surface the existing SDL_Surface structure to convert
702 * \param pixel_format the new pixel format
703 * \returns the new SDL_Surface structure that is created or NULL if it fails;
704 * call SDL_GetError() for more information.
705 *
706 * \since This function is available since SDL 3.0.0.
707 *
708 * \sa SDL_ConvertSurface
709 * \sa SDL_ConvertSurfaceFormatAndColorspace
710 * \sa SDL_DestroySurface
711 */
712extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format);
713
714/**
715 * Copy an existing surface to a new surface of the specified format and
716 * colorspace.
717 *
718 * This function converts an existing surface to a new format and colorspace
719 * and returns the new surface. This will perform any pixel format and
720 * colorspace conversion needed.
721 *
722 * \param surface the existing SDL_Surface structure to convert
723 * \param pixel_format the new pixel format
724 * \param colorspace the new colorspace
725 * \param props an SDL_PropertiesID with additional color properties, or 0
726 * \returns the new SDL_Surface structure that is created or NULL if it fails;
727 * call SDL_GetError() for more information.
728 *
729 * \since This function is available since SDL 3.0.0.
730 *
731 * \sa SDL_ConvertSurface
732 * \sa SDL_ConvertSurfaceFormat
733 * \sa SDL_DestroySurface
734 */
736
737/**
738 * Copy a block of pixels of one format to another format.
739 *
740 * \param width the width of the block to copy, in pixels
741 * \param height the height of the block to copy, in pixels
742 * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
743 * \param src a pointer to the source pixels
744 * \param src_pitch the pitch of the source pixels, in bytes
745 * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
746 * \param dst a pointer to be filled in with new pixel data
747 * \param dst_pitch the pitch of the destination pixels, in bytes
748 * \returns 0 on success or a negative error code on failure; call
749 * SDL_GetError() for more information.
750 *
751 * \since This function is available since SDL 3.0.0.
752 *
753 * \sa SDL_ConvertPixelsAndColorspace
754 */
755extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
756
757/**
758 * Copy a block of pixels of one format and colorspace to another format and
759 * colorspace.
760 *
761 * \param width the width of the block to copy, in pixels
762 * \param height the height of the block to copy, in pixels
763 * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
764 * \param src_colorspace an SDL_ColorSpace value describing the colorspace of
765 * the `src` pixels
766 * \param src_properties an SDL_PropertiesID with additional source color
767 * properties, or 0
768 * \param src a pointer to the source pixels
769 * \param src_pitch the pitch of the source pixels, in bytes
770 * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
771 * \param dst_colorspace an SDL_ColorSpace value describing the colorspace of
772 * the `dst` pixels
773 * \param dst_properties an SDL_PropertiesID with additional destination color
774 * properties, or 0
775 * \param dst a pointer to be filled in with new pixel data
776 * \param dst_pitch the pitch of the destination pixels, in bytes
777 * \returns 0 on success or a negative error code on failure; call
778 * SDL_GetError() for more information.
779 *
780 * \since This function is available since SDL 3.0.0.
781 *
782 * \sa SDL_ConvertPixels
783 */
784extern DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
785
786/**
787 * Premultiply the alpha on a block of pixels.
788 *
789 * This is safe to use with src == dst, but not for other overlapping areas.
790 *
791 * This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
792 *
793 * \param width the width of the block to convert, in pixels
794 * \param height the height of the block to convert, in pixels
795 * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
796 * \param src a pointer to the source pixels
797 * \param src_pitch the pitch of the source pixels, in bytes
798 * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
799 * \param dst a pointer to be filled in with premultiplied pixel data
800 * \param dst_pitch the pitch of the destination pixels, in bytes
801 * \returns 0 on success or a negative error code on failure; call
802 * SDL_GetError() for more information.
803 *
804 * \since This function is available since SDL 3.0.0.
805 */
806extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
807
808/**
809 * Perform a fast fill of a rectangle with a specific color.
810 *
811 * `color` should be a pixel of the format used by the surface, and can be
812 * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
813 * alpha component then the destination is simply filled with that alpha
814 * information, no blending takes place.
815 *
816 * If there is a clip rectangle set on the destination (set via
817 * SDL_SetSurfaceClipRect()), then this function will fill based on the
818 * intersection of the clip rectangle and `rect`.
819 *
820 * \param dst the SDL_Surface structure that is the drawing target
821 * \param rect the SDL_Rect structure representing the rectangle to fill, or
822 * NULL to fill the entire surface
823 * \param color the color to fill with
824 * \returns 0 on success or a negative error code on failure; call
825 * SDL_GetError() for more information.
826 *
827 * \since This function is available since SDL 3.0.0.
828 *
829 * \sa SDL_FillSurfaceRects
830 */
831extern DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
832
833/**
834 * Perform a fast fill of a set of rectangles with a specific color.
835 *
836 * `color` should be a pixel of the format used by the surface, and can be
837 * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
838 * alpha component then the destination is simply filled with that alpha
839 * information, no blending takes place.
840 *
841 * If there is a clip rectangle set on the destination (set via
842 * SDL_SetSurfaceClipRect()), then this function will fill based on the
843 * intersection of the clip rectangle and `rect`.
844 *
845 * \param dst the SDL_Surface structure that is the drawing target
846 * \param rects an array of SDL_Rects representing the rectangles to fill.
847 * \param count the number of rectangles in the array
848 * \param color the color to fill with
849 * \returns 0 on success or a negative error code on failure; call
850 * SDL_GetError() for more information.
851 *
852 * \since This function is available since SDL 3.0.0.
853 *
854 * \sa SDL_FillSurfaceRect
855 */
856extern DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
857
858/**
859 * Performs a fast blit from the source surface to the destination surface.
860 *
861 * This assumes that the source and destination rectangles are the same size.
862 * If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
863 * `dst`) is copied. The final blit rectangles are saved in `srcrect` and
864 * `dstrect` after all clipping is performed.
865 *
866 * The blit function should not be called on a locked surface.
867 *
868 * The blit semantics for surfaces with and without blending and colorkey are
869 * defined as follows:
870 *
871 * ```c
872 * RGBA->RGB:
873 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
874 * alpha-blend (using the source alpha-channel and per-surface alpha)
875 * SDL_SRCCOLORKEY ignored.
876 * Source surface blend mode set to SDL_BLENDMODE_NONE:
877 * copy RGB.
878 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
879 * RGB values of the source color key, ignoring alpha in the
880 * comparison.
881 *
882 * RGB->RGBA:
883 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
884 * alpha-blend (using the source per-surface alpha)
885 * Source surface blend mode set to SDL_BLENDMODE_NONE:
886 * copy RGB, set destination alpha to source per-surface alpha value.
887 * both:
888 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
889 * source color key.
890 *
891 * RGBA->RGBA:
892 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
893 * alpha-blend (using the source alpha-channel and per-surface alpha)
894 * SDL_SRCCOLORKEY ignored.
895 * Source surface blend mode set to SDL_BLENDMODE_NONE:
896 * copy all of RGBA to the destination.
897 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
898 * RGB values of the source color key, ignoring alpha in the
899 * comparison.
900 *
901 * RGB->RGB:
902 * Source surface blend mode set to SDL_BLENDMODE_BLEND:
903 * alpha-blend (using the source per-surface alpha)
904 * Source surface blend mode set to SDL_BLENDMODE_NONE:
905 * copy RGB.
906 * both:
907 * if SDL_SRCCOLORKEY set, only copy the pixels matching the
908 * source color key.
909 * ```
910 *
911 * \param src the SDL_Surface structure to be copied from
912 * \param srcrect the SDL_Rect structure representing the rectangle to be
913 * copied, or NULL to copy the entire surface
914 * \param dst the SDL_Surface structure that is the blit target
915 * \param dstrect the SDL_Rect structure representing the x and y position in
916 * the destination surface. On input the width and height are
917 * ignored (taken from srcrect), and on output this is filled
918 * in with the actual rectangle used after clipping.
919 * \returns 0 on success or a negative error code on failure; call
920 * SDL_GetError() for more information.
921 *
922 * \since This function is available since SDL 3.0.0.
923 *
924 * \sa SDL_BlitSurfaceScaled
925 */
926extern DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
927
928/**
929 * Perform low-level surface blitting only.
930 *
931 * This is a semi-private blit function and it performs low-level surface
932 * blitting, assuming the input rectangles have already been clipped.
933 *
934 * \param src the SDL_Surface structure to be copied from
935 * \param srcrect the SDL_Rect structure representing the rectangle to be
936 * copied, or NULL to copy the entire surface
937 * \param dst the SDL_Surface structure that is the blit target
938 * \param dstrect the SDL_Rect structure representing the target rectangle in
939 * the destination surface
940 * \returns 0 on success or a negative error code on failure; call
941 * SDL_GetError() for more information.
942 *
943 * \since This function is available since SDL 3.0.0.
944 *
945 * \sa SDL_BlitSurface
946 */
947extern DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
948
949/**
950 * Perform stretch blit between two surfaces of the same format.
951 *
952 * Using SDL_SCALEMODE_NEAREST: fast, low quality. Using SDL_SCALEMODE_LINEAR:
953 * bilinear scaling, slower, better quality, only 32BPP.
954 *
955 * \param src the SDL_Surface structure to be copied from
956 * \param srcrect the SDL_Rect structure representing the rectangle to be
957 * copied
958 * \param dst the SDL_Surface structure that is the blit target
959 * \param dstrect the SDL_Rect structure representing the target rectangle in
960 * the destination surface
961 * \param scaleMode scale algorithm to be used
962 * \returns 0 on success or a negative error code on failure; call
963 * SDL_GetError() for more information.
964 *
965 * \since This function is available since SDL 3.0.0.
966 *
967 * \sa SDL_BlitSurfaceScaled
968 */
969extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
970
971/**
972 * Perform a scaled blit to a destination surface, which may be of a different
973 * format.
974 *
975 * \param src the SDL_Surface structure to be copied from
976 * \param srcrect the SDL_Rect structure representing the rectangle to be
977 * copied
978 * \param dst the SDL_Surface structure that is the blit target
979 * \param dstrect the SDL_Rect structure representing the target rectangle in
980 * the destination surface, filled with the actual rectangle
981 * used after clipping
982 * \param scaleMode scale algorithm to be used
983 * \returns 0 on success or a negative error code on failure; call
984 * SDL_GetError() for more information.
985 *
986 * \since This function is available since SDL 3.0.0.
987 *
988 * \sa SDL_BlitSurface
989 */
990extern DECLSPEC int SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
991
992/**
993 * Perform low-level surface scaled blitting only.
994 *
995 * This is a semi-private function and it performs low-level surface blitting,
996 * assuming the input rectangles have already been clipped.
997 *
998 * \param src the SDL_Surface structure to be copied from
999 * \param srcrect the SDL_Rect structure representing the rectangle to be
1000 * copied
1001 * \param dst the SDL_Surface structure that is the blit target
1002 * \param dstrect the SDL_Rect structure representing the target rectangle in
1003 * the destination surface
1004 * \param scaleMode scale algorithm to be used
1005 * \returns 0 on success or a negative error code on failure; call
1006 * SDL_GetError() for more information.
1007 *
1008 * \since This function is available since SDL 3.0.0.
1009 *
1010 * \sa SDL_BlitSurfaceScaled
1011 */
1012extern DECLSPEC int SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
1013
1014/**
1015 * Retrieves a single pixel from a surface.
1016 *
1017 * This function prioritizes correctness over speed: it is suitable for unit
1018 * tests, but is not intended for use in a game engine.
1019 *
1020 * Like SDL_GetRGBA, this uses the entire 0..255 range when converting color
1021 * components from pixel formats with less than 8 bits per RGB component.
1022 *
1023 * \param surface the surface to read
1024 * \param x the horizontal coordinate, 0 <= x < width
1025 * \param y the vertical coordinate, 0 <= y < height
1026 * \param r a pointer filled in with the red channel, 0-255, or NULL to ignore
1027 * this channel
1028 * \param g a pointer filled in with the green channel, 0-255, or NULL to
1029 * ignore this channel
1030 * \param b a pointer filled in with the blue channel, 0-255, or NULL to
1031 * ignore this channel
1032 * \param a a pointer filled in with the alpha channel, 0-255, or NULL to
1033 * ignore this channel
1034 * \returns 0 on success or a negative error code on failure; call
1035 * SDL_GetError() for more information.
1036 *
1037 * \since This function is available since SDL 3.0.0.
1038 */
1039extern DECLSPEC int SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1040
1041/* Ends C function definitions when using C++ */
1042#ifdef __cplusplus
1043}
1044#endif
1045#include <SDL3/SDL_close_code.h>
1046
1047#endif /* SDL_surface_h_ */
SDL_BlendMode
struct SDL_IOStream SDL_IOStream
SDL_PixelFormatEnum
Definition SDL_pixels.h:215
SDL_Colorspace
Definition SDL_pixels.h:568
Uint32 SDL_PropertiesID
uint8_t Uint8
Definition SDL_stdinc.h:150
int SDL_bool
Definition SDL_stdinc.h:137
uint32_t Uint32
Definition SDL_stdinc.h:174
int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
int SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
SDL_Surface * SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool closeio)
SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface)
int(* SDL_blit)(struct SDL_Surface *src, const SDL_Rect *srcrect, struct SDL_Surface *dst, const SDL_Rect *dstrect)
int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
void SDL_DestroySurface(SDL_Surface *surface)
int SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
SDL_Surface * SDL_CreateSurfaceFrom(void *pixels, int width, int height, int pitch, SDL_PixelFormatEnum format)
SDL_Surface * SDL_DuplicateSurface(SDL_Surface *surface)
int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color)
int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
int SDL_LockSurface(SDL_Surface *surface)
int SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
int SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
SDL_ScaleMode
Definition SDL_surface.h:72
@ SDL_SCALEMODE_LINEAR
Definition SDL_surface.h:74
@ SDL_SCALEMODE_NEAREST
Definition SDL_surface.h:73
@ SDL_SCALEMODE_BEST
Definition SDL_surface.h:75
SDL_Surface * SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format)
int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode)
struct SDL_BlitMap SDL_BlitMap
Definition SDL_surface.h:66
int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
int SDL_SetSurfaceColorKey(SDL_Surface *surface, int flag, Uint32 key)
SDL_Surface * SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format)
SDL_FlipMode
Definition SDL_surface.h:82
@ SDL_FLIP_VERTICAL
Definition SDL_surface.h:85
@ SDL_FLIP_NONE
Definition SDL_surface.h:83
@ SDL_FLIP_HORIZONTAL
Definition SDL_surface.h:84
int SDL_SaveBMP(SDL_Surface *surface, const char *file)
void SDL_UnlockSurface(SDL_Surface *surface)
int SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio)
int SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
int SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch)
SDL_bool SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
int SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch)
int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
int SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch)
int SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace)
int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
SDL_bool SDL_SurfaceHasColorKey(SDL_Surface *surface)
int SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip)
SDL_Surface * SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, SDL_PropertiesID props)
int SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)
SDL_bool SDL_SurfaceHasRLE(SDL_Surface *surface)
SDL_Surface * SDL_LoadBMP(const char *file)
int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
int SDL_GetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace *colorspace)
SDL_Surface * SDL_ConvertSurfaceFormat(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format)
SDL_PixelFormat * format
void * list_blitmap
void * reserved
SDL_Rect clip_rect
void * pixels
SDL_BlitMap * map