SDL_surface.h 41 KB

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