SDL_surface.h 41 KB

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