SDL_surface.h 41 KB

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