SDL_surface.h 41 KB

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