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