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