SDL_surface.h 41 KB

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