SDL_surface.h 40 KB

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