SDL_surface.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * # CategorySurface
  20. *
  21. * 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_error.h>
  27. #include <SDL3/SDL_blendmode.h>
  28. #include <SDL3/SDL_pixels.h>
  29. #include <SDL3/SDL_properties.h>
  30. #include <SDL3/SDL_rect.h>
  31. #include <SDL3/SDL_iostream.h>
  32. #include <SDL3/SDL_begin_code.h>
  33. /* Set up for C function definitions, even when using C++ */
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /**
  38. * The flags on an SDL_Surface.
  39. *
  40. * These are generally meant to be considered read-only.
  41. *
  42. * \since This datatype is available since SDL 3.0.0.
  43. */
  44. typedef Uint32 SDL_SurfaceFlags;
  45. #define SDL_PREALLOC 0x00000001u /**< Surface uses preallocated memory */
  46. #define SDL_RLEACCEL 0x00000002u /**< Surface is RLE encoded */
  47. #define SDL_DONTFREE 0x00000004u /**< Surface is referenced internally */
  48. #define SDL_SIMD_ALIGNED 0x00000008u /**< Surface uses aligned memory */
  49. #define SDL_SURFACE_USES_PROPERTIES 0x00000010u /**< Surface uses properties */
  50. /**
  51. * Evaluates to true if the surface needs to be locked before access.
  52. *
  53. * \since This macro is available since SDL 3.0.0.
  54. */
  55. #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
  56. /**
  57. * An opaque type used in SDL_Surface.
  58. *
  59. * This is used by SDL to keep track of how blit operations should work
  60. * internally; it is not for use directly by applications.
  61. *
  62. * \since This struct is available since SDL 3.0.0.
  63. */
  64. typedef struct SDL_BlitMap SDL_BlitMap;
  65. /**
  66. * The scaling mode.
  67. *
  68. * \since This enum is available since SDL 3.0.0.
  69. */
  70. typedef enum SDL_ScaleMode
  71. {
  72. SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
  73. SDL_SCALEMODE_LINEAR, /**< linear filtering */
  74. SDL_SCALEMODE_BEST /**< anisotropic filtering */
  75. } SDL_ScaleMode;
  76. /**
  77. * The flip mode.
  78. *
  79. * \since This enum is available since SDL 3.0.0.
  80. */
  81. typedef enum SDL_FlipMode
  82. {
  83. SDL_FLIP_NONE, /**< Do not flip */
  84. SDL_FLIP_HORIZONTAL, /**< flip horizontally */
  85. SDL_FLIP_VERTICAL /**< flip vertically */
  86. } SDL_FlipMode;
  87. /**
  88. * A collection of pixels used in software blitting.
  89. *
  90. * Pixels are arranged in memory in rows, with the top row first. Each row
  91. * occupies an amount of memory given by the pitch (sometimes known as the row
  92. * stride in non-SDL APIs).
  93. *
  94. * Within each row, pixels are arranged from left to right until the width is
  95. * reached. Each pixel occupies a number of bits appropriate for its format,
  96. * with most formats representing each pixel as one or more whole bytes (in
  97. * some indexed formats, instead multiple pixels are packed into each byte),
  98. * and a byte order given by the format. After encoding all pixels, any
  99. * remaining bytes to reach the pitch are used as padding to reach a desired
  100. * alignment, and have undefined contents.
  101. *
  102. * \since This struct is available since SDL 3.0.0.
  103. */
  104. typedef struct SDL_Surface
  105. {
  106. SDL_SurfaceFlags flags; /**< Read-only */
  107. SDL_PixelFormat *format; /**< Read-only */
  108. int w, h; /**< Read-only */
  109. int pitch; /**< Read-only */
  110. void *pixels; /**< Read-write */
  111. void *reserved; /**< Private */
  112. /** information needed for surfaces requiring locks */
  113. int locked; /**< Read-only */
  114. /** list of BlitMap that hold a reference to this surface */
  115. void *list_blitmap; /**< Private */
  116. /** clipping information */
  117. SDL_Rect clip_rect; /**< Read-only */
  118. /** info for fast blit mapping to other surfaces */
  119. SDL_BlitMap *map; /**< Private */
  120. /** Reference count -- used when freeing surface */
  121. int refcount; /**< Read-mostly */
  122. } SDL_Surface;
  123. /**
  124. * Allocate a new RGB surface with a specific pixel format.
  125. *
  126. * \param width the width of the surface
  127. * \param height the height of the surface
  128. * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
  129. * \returns the new SDL_Surface structure that is created or NULL if it fails;
  130. * call SDL_GetError() for more information.
  131. *
  132. * \since This function is available since SDL 3.0.0.
  133. *
  134. * \sa SDL_CreateSurfaceFrom
  135. * \sa SDL_DestroySurface
  136. */
  137. extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurface(int width, int height, SDL_PixelFormatEnum format);
  138. /**
  139. * Allocate a new RGB surface with a specific pixel format and existing pixel
  140. * data.
  141. *
  142. * No copy is made of the pixel data. Pixel data is not managed automatically;
  143. * you must free the surface before you free the pixel data.
  144. *
  145. * Pitch is the offset in bytes from one row of pixels to the next, e.g.
  146. * `width*4` for `SDL_PIXELFORMAT_RGBA8888`.
  147. *
  148. * You may pass NULL for pixels and 0 for pitch to create a surface that you
  149. * will fill in with valid values later.
  150. *
  151. * \param pixels a pointer to existing pixel data
  152. * \param width the width of the surface
  153. * \param height the height of the surface
  154. * \param pitch the number of bytes between each row, including padding
  155. * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
  156. * \returns the new SDL_Surface structure that is created or NULL if it fails;
  157. * call SDL_GetError() for more information.
  158. *
  159. * \since This function is available since SDL 3.0.0.
  160. *
  161. * \sa SDL_CreateSurface
  162. * \sa SDL_DestroySurface
  163. */
  164. extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom(void *pixels, int width, int height, int pitch, SDL_PixelFormatEnum format);
  165. /**
  166. * Free an RGB surface.
  167. *
  168. * It is safe to pass NULL to this function.
  169. *
  170. * \param surface the SDL_Surface to free.
  171. *
  172. * \since This function is available since SDL 3.0.0.
  173. *
  174. * \sa SDL_CreateSurface
  175. * \sa SDL_CreateSurfaceFrom
  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
  185. * floating 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_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
  189. * surfaces, this defines the value of 100% diffuse white, with higher
  190. * values being displayed in the High Dynamic Range headroom. This defaults
  191. * to 203 for HDR10 surfaces and 1.0 for floating point surfaces.
  192. * - `SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
  193. * surfaces, this defines the maximum dynamic range used by the content, in
  194. * terms of the SDR white point. This defaults to 0.0, which disables tone
  195. * mapping.
  196. * - `SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING`: the tone mapping operator
  197. * used when compressing from a surface with high dynamic range to another
  198. * with lower dynamic range. Currently this supports "chrome", which uses
  199. * the same tone mapping that Chrome uses for HDR content, the form "*=N",
  200. * where N is a floating point scale factor applied in linear space, and
  201. * "none", which disables tone mapping. This defaults to "chrome".
  202. *
  203. * \param surface the SDL_Surface structure to query
  204. * \returns a valid property ID on success or 0 on failure; call
  205. * SDL_GetError() for more information.
  206. *
  207. * \since This function is available since SDL 3.0.0.
  208. *
  209. * \sa SDL_GetProperty
  210. * \sa SDL_SetProperty
  211. */
  212. extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface);
  213. #define SDL_PROP_SURFACE_COLORSPACE_NUMBER "SDL.surface.colorspace"
  214. #define SDL_PROP_SURFACE_SDR_WHITE_POINT_FLOAT "SDL.surface.SDR_white_point"
  215. #define SDL_PROP_SURFACE_HDR_HEADROOM_FLOAT "SDL.surface.HDR_headroom"
  216. #define SDL_PROP_SURFACE_TONEMAP_OPERATOR_STRING "SDL.surface.tonemap"
  217. /**
  218. * Set the colorspace used by a surface.
  219. *
  220. * Setting the colorspace doesn't change the pixels, only how they are
  221. * interpreted in color operations.
  222. *
  223. * \param surface the SDL_Surface structure to update
  224. * \param colorspace an SDL_ColorSpace value describing the surface colorspace
  225. * \returns 0 on success or a negative error code on failure; call
  226. * SDL_GetError() for more information.
  227. *
  228. * \since This function is available since SDL 3.0.0.
  229. */
  230. extern DECLSPEC int SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace);
  231. /**
  232. * Get the colorspace used by a surface.
  233. *
  234. * The colorspace defaults to SDL_COLORSPACE_SRGB_LINEAR for floating point
  235. * formats, SDL_COLORSPACE_HDR10 for 10-bit formats, SDL_COLORSPACE_SRGB for
  236. * other RGB surfaces and SDL_COLORSPACE_BT709_FULL for YUV textures.
  237. *
  238. * \param surface the SDL_Surface structure to query
  239. * \param colorspace a pointer filled in with an SDL_ColorSpace value
  240. * describing the surface colorspace
  241. * \returns 0 on success or a negative error code on failure; call
  242. * SDL_GetError() for more information.
  243. *
  244. * \since This function is available since SDL 3.0.0.
  245. */
  246. extern DECLSPEC int SDLCALL SDL_GetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace *colorspace);
  247. /**
  248. * Set the palette used by a surface.
  249. *
  250. * A single palette can be shared with many surfaces.
  251. *
  252. * \param surface the SDL_Surface structure to update
  253. * \param palette the SDL_Palette structure to use
  254. * \returns 0 on success or a negative error code on failure; call
  255. * SDL_GetError() for more information.
  256. *
  257. * \since This function is available since SDL 3.0.0.
  258. */
  259. extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette);
  260. /**
  261. * Set up a surface for directly accessing the pixels.
  262. *
  263. * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to
  264. * and read from `surface->pixels`, using the pixel format stored in
  265. * `surface->format`. Once you are done accessing the surface, you should use
  266. * SDL_UnlockSurface() to release it.
  267. *
  268. * Not all surfaces require locking. If `SDL_MUSTLOCK(surface)` evaluates to
  269. * 0, then you can read and write to the surface at any time, and the pixel
  270. * format of the surface will not change.
  271. *
  272. * \param surface the SDL_Surface structure to be locked
  273. * \returns 0 on success or a negative error code on failure; call
  274. * SDL_GetError() for more information.
  275. *
  276. * \since This function is available since SDL 3.0.0.
  277. *
  278. * \sa SDL_MUSTLOCK
  279. * \sa SDL_UnlockSurface
  280. */
  281. extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
  282. /**
  283. * Release a surface after directly accessing the pixels.
  284. *
  285. * \param surface the SDL_Surface structure to be unlocked
  286. *
  287. * \since This function is available since SDL 3.0.0.
  288. *
  289. * \sa SDL_LockSurface
  290. */
  291. extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
  292. /**
  293. * Load a BMP image from a seekable SDL data stream.
  294. *
  295. * The new surface should be freed with SDL_DestroySurface(). Not doing so
  296. * will result in a memory leak.
  297. *
  298. * \param src the data stream for the surface
  299. * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning,
  300. * even in the case of an error
  301. * \returns a pointer to a new SDL_Surface structure or NULL if there was an
  302. * error; call SDL_GetError() for more information.
  303. *
  304. * \since This function is available since SDL 3.0.0.
  305. *
  306. * \sa SDL_DestroySurface
  307. * \sa SDL_LoadBMP
  308. * \sa SDL_SaveBMP_IO
  309. */
  310. extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool closeio);
  311. /**
  312. * Load a BMP image from a file.
  313. *
  314. * The new surface should be freed with SDL_DestroySurface(). Not doing so
  315. * will result in a memory leak.
  316. *
  317. * \param file the BMP file to load
  318. * \returns a pointer to a new SDL_Surface structure or NULL if there was an
  319. * error; call SDL_GetError() for more information.
  320. *
  321. * \since This function is available since SDL 3.0.0.
  322. *
  323. * \sa SDL_DestroySurface
  324. * \sa SDL_LoadBMP_IO
  325. * \sa SDL_SaveBMP
  326. */
  327. extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP(const char *file);
  328. /**
  329. * Save a surface to a seekable SDL data stream in BMP format.
  330. *
  331. * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
  332. * BMP directly. Other RGB formats with 8-bit or higher get converted to a
  333. * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
  334. * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
  335. * not supported.
  336. *
  337. * \param surface the SDL_Surface structure containing the image to be saved
  338. * \param dst a data stream to save to
  339. * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `dst` before returning,
  340. * even in the case of an error
  341. * \returns 0 on success or a negative error code on failure; call
  342. * SDL_GetError() for more information.
  343. *
  344. * \since This function is available since SDL 3.0.0.
  345. *
  346. * \sa SDL_LoadBMP_IO
  347. * \sa SDL_SaveBMP
  348. */
  349. extern DECLSPEC int SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio);
  350. /**
  351. * Save a surface to a file.
  352. *
  353. * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the
  354. * BMP directly. Other RGB formats with 8-bit or higher get converted to a
  355. * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit
  356. * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
  357. * not supported.
  358. *
  359. * \param surface the SDL_Surface structure containing the image to be saved
  360. * \param file a file to save to
  361. * \returns 0 on success or a negative error code on failure; call
  362. * SDL_GetError() for more information.
  363. *
  364. * \since This function is available since SDL 3.0.0.
  365. *
  366. * \sa SDL_LoadBMP
  367. * \sa SDL_SaveBMP_IO
  368. */
  369. extern DECLSPEC int SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file);
  370. /**
  371. * Set the RLE acceleration hint for a surface.
  372. *
  373. * If RLE is enabled, color key and alpha blending blits are much faster, but
  374. * the surface must be locked before directly accessing the pixels.
  375. *
  376. * \param surface the SDL_Surface structure to optimize
  377. * \param flag 0 to disable, non-zero to enable RLE acceleration
  378. * \returns 0 on success or a negative error code on failure; call
  379. * SDL_GetError() for more information.
  380. *
  381. * \since This function is available since SDL 3.0.0.
  382. *
  383. * \sa SDL_BlitSurface
  384. * \sa SDL_LockSurface
  385. * \sa SDL_UnlockSurface
  386. */
  387. extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
  388. /**
  389. * Returns whether the surface is RLE enabled.
  390. *
  391. * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
  392. *
  393. * \param surface the SDL_Surface structure to query
  394. * \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
  395. *
  396. * \since This function is available since SDL 3.0.0.
  397. *
  398. * \sa SDL_SetSurfaceRLE
  399. */
  400. extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface);
  401. /**
  402. * Set the color key (transparent pixel) in a surface.
  403. *
  404. * The color key defines a pixel value that will be treated as transparent in
  405. * a blit. For example, one can use this to specify that cyan pixels should be
  406. * considered transparent, and therefore not rendered.
  407. *
  408. * It is a pixel of the format used by the surface, as generated by
  409. * SDL_MapRGB().
  410. *
  411. * RLE acceleration can substantially speed up blitting of images with large
  412. * horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details.
  413. *
  414. * \param surface the SDL_Surface structure to update
  415. * \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key
  416. * \param key the transparent pixel
  417. * \returns 0 on success or a negative error code on failure; call
  418. * SDL_GetError() for more information.
  419. *
  420. * \since This function is available since SDL 3.0.0.
  421. *
  422. * \sa SDL_GetSurfaceColorKey
  423. * \sa SDL_SurfaceHasColorKey
  424. */
  425. extern DECLSPEC int SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, int flag, Uint32 key);
  426. /**
  427. * Returns whether the surface has a color key.
  428. *
  429. * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
  430. *
  431. * \param surface the SDL_Surface structure to query
  432. * \returns SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
  433. *
  434. * \since This function is available since SDL 3.0.0.
  435. *
  436. * \sa SDL_SetSurfaceColorKey
  437. * \sa SDL_GetSurfaceColorKey
  438. */
  439. extern DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface);
  440. /**
  441. * Get the color key (transparent pixel) for a surface.
  442. *
  443. * The color key is a pixel of the format used by the surface, as generated by
  444. * SDL_MapRGB().
  445. *
  446. * If the surface doesn't have color key enabled this function returns -1.
  447. *
  448. * \param surface the SDL_Surface structure to query
  449. * \param key a pointer filled in with the transparent pixel
  450. * \returns 0 on success or a negative error code on failure; call
  451. * SDL_GetError() for more information.
  452. *
  453. * \since This function is available since SDL 3.0.0.
  454. *
  455. * \sa SDL_SetSurfaceColorKey
  456. * \sa SDL_SurfaceHasColorKey
  457. */
  458. extern DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
  459. /**
  460. * Set an additional color value multiplied into blit operations.
  461. *
  462. * When this surface is blitted, during the blit operation each source color
  463. * channel is modulated by the appropriate color value according to the
  464. * following formula:
  465. *
  466. * `srcC = srcC * (color / 255)`
  467. *
  468. * \param surface the SDL_Surface structure to update
  469. * \param r the red color value multiplied into blit operations
  470. * \param g the green color value multiplied into blit operations
  471. * \param b the blue color value multiplied into blit operations
  472. * \returns 0 on success or a negative error code on failure; call
  473. * SDL_GetError() for more information.
  474. *
  475. * \since This function is available since SDL 3.0.0.
  476. *
  477. * \sa SDL_GetSurfaceColorMod
  478. * \sa SDL_SetSurfaceAlphaMod
  479. */
  480. extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b);
  481. /**
  482. * Get the additional color value multiplied into blit operations.
  483. *
  484. * \param surface the SDL_Surface structure to query
  485. * \param r a pointer filled in with the current red color value
  486. * \param g a pointer filled in with the current green color value
  487. * \param b a pointer filled in with the current blue color value
  488. * \returns 0 on success or a negative error code on failure; call
  489. * SDL_GetError() for more information.
  490. *
  491. * \since This function is available since SDL 3.0.0.
  492. *
  493. * \sa SDL_GetSurfaceAlphaMod
  494. * \sa SDL_SetSurfaceColorMod
  495. */
  496. extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b);
  497. /**
  498. * Set an additional alpha value used in blit operations.
  499. *
  500. * When this surface is blitted, during the blit operation the source alpha
  501. * value is modulated by this alpha value according to the following formula:
  502. *
  503. * `srcA = srcA * (alpha / 255)`
  504. *
  505. * \param surface the SDL_Surface structure to update
  506. * \param alpha the alpha value multiplied into blit operations
  507. * \returns 0 on success or a negative error code on failure; call
  508. * SDL_GetError() for more information.
  509. *
  510. * \since This function is available since SDL 3.0.0.
  511. *
  512. * \sa SDL_GetSurfaceAlphaMod
  513. * \sa SDL_SetSurfaceColorMod
  514. */
  515. extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha);
  516. /**
  517. * Get the additional alpha value used in blit operations.
  518. *
  519. * \param surface the SDL_Surface structure to query
  520. * \param alpha a pointer filled in with the current alpha value
  521. * \returns 0 on success or a negative error code on failure; call
  522. * SDL_GetError() for more information.
  523. *
  524. * \since This function is available since SDL 3.0.0.
  525. *
  526. * \sa SDL_GetSurfaceColorMod
  527. * \sa SDL_SetSurfaceAlphaMod
  528. */
  529. extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha);
  530. /**
  531. * Set the blend mode used for blit operations.
  532. *
  533. * To copy a surface to another surface (or texture) without blending with the
  534. * existing data, the blendmode of the SOURCE surface should be set to
  535. * `SDL_BLENDMODE_NONE`.
  536. *
  537. * \param surface the SDL_Surface structure to update
  538. * \param blendMode the SDL_BlendMode to use for blit blending
  539. * \returns 0 on success or a negative error code on failure; call
  540. * SDL_GetError() for more information.
  541. *
  542. * \since This function is available since SDL 3.0.0.
  543. *
  544. * \sa SDL_GetSurfaceBlendMode
  545. */
  546. extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode);
  547. /**
  548. * Get the blend mode used for blit operations.
  549. *
  550. * \param surface the SDL_Surface structure to query
  551. * \param blendMode a pointer filled in with the current SDL_BlendMode
  552. * \returns 0 on success or a negative error code on failure; call
  553. * SDL_GetError() for more information.
  554. *
  555. * \since This function is available since SDL 3.0.0.
  556. *
  557. * \sa SDL_SetSurfaceBlendMode
  558. */
  559. extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
  560. /**
  561. * Set the clipping rectangle for a surface.
  562. *
  563. * When `surface` is the destination of a blit, only the area within the clip
  564. * rectangle is drawn into.
  565. *
  566. * Note that blits are automatically clipped to the edges of the source and
  567. * destination surfaces.
  568. *
  569. * \param surface the SDL_Surface structure to be clipped
  570. * \param rect the SDL_Rect structure representing the clipping rectangle, or
  571. * NULL to disable clipping
  572. * \returns SDL_TRUE if the rectangle intersects the surface, otherwise
  573. * SDL_FALSE and blits will be completely clipped.
  574. *
  575. * \since This function is available since SDL 3.0.0.
  576. *
  577. * \sa SDL_GetSurfaceClipRect
  578. */
  579. extern DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect);
  580. /**
  581. * Get the clipping rectangle for a surface.
  582. *
  583. * When `surface` is the destination of a blit, only the area within the clip
  584. * rectangle is drawn into.
  585. *
  586. * \param surface the SDL_Surface structure representing the surface to be
  587. * clipped
  588. * \param rect an SDL_Rect structure filled in with the clipping rectangle for
  589. * the surface
  590. * \returns 0 on success or a negative error code on failure; call
  591. * SDL_GetError() for more information.
  592. *
  593. * \since This function is available since SDL 3.0.0.
  594. *
  595. * \sa SDL_SetSurfaceClipRect
  596. */
  597. extern DECLSPEC int SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect);
  598. /**
  599. * Flip a surface vertically or horizontally.
  600. *
  601. * \param surface the surface to flip
  602. * \param flip the direction to flip
  603. * \returns 0 on success or a negative error code on failure; call
  604. * SDL_GetError() for more information.
  605. *
  606. * \since This function is available since SDL 3.0.0.
  607. */
  608. extern DECLSPEC int SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip);
  609. /**
  610. * Creates a new surface identical to the existing surface.
  611. *
  612. * The returned surface should be freed with SDL_DestroySurface().
  613. *
  614. * \param surface the surface to duplicate.
  615. * \returns a copy of the surface, or NULL on failure; call SDL_GetError() for
  616. * more information.
  617. *
  618. * \since This function is available since SDL 3.0.0.
  619. *
  620. * \sa SDL_DestroySurface
  621. */
  622. extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface *surface);
  623. /**
  624. * Copy an existing surface to a new surface of the specified format.
  625. *
  626. * This function is used to optimize images for faster *repeat* blitting. This
  627. * is accomplished by converting the original and storing the result as a new
  628. * surface. The new, optimized surface can then be used as the source for
  629. * future blits, making them faster.
  630. *
  631. * \param surface the existing SDL_Surface structure to convert
  632. * \param format the SDL_PixelFormat structure that the new surface is
  633. * optimized for
  634. * \returns the new SDL_Surface structure that is created or NULL if it fails;
  635. * call SDL_GetError() for more information.
  636. *
  637. * \since This function is available since SDL 3.0.0.
  638. *
  639. * \sa SDL_ConvertSurfaceFormat
  640. * \sa SDL_ConvertSurfaceFormatAndColorspace
  641. * \sa SDL_CreatePixelFormat
  642. * \sa SDL_DestroySurface
  643. */
  644. extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface(SDL_Surface *surface, const SDL_PixelFormat *format);
  645. /**
  646. * Copy an existing surface to a new surface of the specified format.
  647. *
  648. * This function operates just like SDL_ConvertSurface(), but accepts an
  649. * SDL_PixelFormatEnum value instead of an SDL_PixelFormat structure. As such,
  650. * it might be easier to call but it doesn't have access to palette
  651. * information for the destination surface, in case that would be important.
  652. *
  653. * \param surface the existing SDL_Surface structure to convert
  654. * \param pixel_format the new pixel format
  655. * \returns the new SDL_Surface structure that is created or NULL if it fails;
  656. * call SDL_GetError() for more information.
  657. *
  658. * \since This function is available since SDL 3.0.0.
  659. *
  660. * \sa SDL_ConvertSurface
  661. * \sa SDL_ConvertSurfaceFormatAndColorspace
  662. * \sa SDL_DestroySurface
  663. */
  664. extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format);
  665. /**
  666. * Copy an existing surface to a new surface of the specified format and
  667. * colorspace.
  668. *
  669. * This function converts an existing surface to a new format and colorspace
  670. * and returns the new surface. This will perform any pixel format and
  671. * colorspace conversion needed.
  672. *
  673. * \param surface the existing SDL_Surface structure to convert
  674. * \param pixel_format the new pixel format
  675. * \param colorspace the new colorspace
  676. * \param props an SDL_PropertiesID with additional color properties, or 0
  677. * \returns the new SDL_Surface structure that is created or NULL if it fails;
  678. * call SDL_GetError() for more information.
  679. *
  680. * \since This function is available since SDL 3.0.0.
  681. *
  682. * \sa SDL_ConvertSurface
  683. * \sa SDL_ConvertSurfaceFormat
  684. * \sa SDL_DestroySurface
  685. */
  686. extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormatAndColorspace(SDL_Surface *surface, SDL_PixelFormatEnum pixel_format, SDL_Colorspace colorspace, SDL_PropertiesID props);
  687. /**
  688. * Copy a block of pixels of one format to another format.
  689. *
  690. * \param width the width of the block to copy, in pixels
  691. * \param height the height of the block to copy, in pixels
  692. * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
  693. * \param src a pointer to the source pixels
  694. * \param src_pitch the pitch of the source pixels, in bytes
  695. * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
  696. * \param dst a pointer to be filled in with new pixel data
  697. * \param dst_pitch the pitch of the destination pixels, in bytes
  698. * \returns 0 on success or a negative error code on failure; call
  699. * SDL_GetError() for more information.
  700. *
  701. * \since This function is available since SDL 3.0.0.
  702. *
  703. * \sa SDL_ConvertPixelsAndColorspace
  704. */
  705. extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
  706. /**
  707. * Copy a block of pixels of one format and colorspace to another format and
  708. * colorspace.
  709. *
  710. * \param width the width of the block to copy, in pixels
  711. * \param height the height of the block to copy, in pixels
  712. * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
  713. * \param src_colorspace an SDL_ColorSpace value describing the colorspace of
  714. * the `src` pixels
  715. * \param src_properties an SDL_PropertiesID with additional source color
  716. * properties, or 0
  717. * \param src a pointer to the source pixels
  718. * \param src_pitch the pitch of the source pixels, in bytes
  719. * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
  720. * \param dst_colorspace an SDL_ColorSpace value describing the colorspace of
  721. * the `dst` pixels
  722. * \param dst_properties an SDL_PropertiesID with additional destination color
  723. * properties, or 0
  724. * \param dst a pointer to be filled in with new pixel data
  725. * \param dst_pitch the pitch of the destination pixels, in bytes
  726. * \returns 0 on success or a negative error code on failure; call
  727. * SDL_GetError() for more information.
  728. *
  729. * \since This function is available since SDL 3.0.0.
  730. *
  731. * \sa SDL_ConvertPixels
  732. */
  733. extern DECLSPEC int SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormatEnum src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch);
  734. /**
  735. * Premultiply the alpha on a block of pixels.
  736. *
  737. * This is safe to use with src == dst, but not for other overlapping areas.
  738. *
  739. * This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
  740. *
  741. * \param width the width of the block to convert, in pixels
  742. * \param height the height of the block to convert, in pixels
  743. * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
  744. * \param src a pointer to the source pixels
  745. * \param src_pitch the pitch of the source pixels, in bytes
  746. * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
  747. * \param dst a pointer to be filled in with premultiplied pixel data
  748. * \param dst_pitch the pitch of the destination pixels, in bytes
  749. * \returns 0 on success or a negative error code on failure; call
  750. * SDL_GetError() for more information.
  751. *
  752. * \since This function is available since SDL 3.0.0.
  753. */
  754. extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormatEnum src_format, const void *src, int src_pitch, SDL_PixelFormatEnum dst_format, void *dst, int dst_pitch);
  755. /**
  756. * Perform a fast fill of a rectangle with a specific color.
  757. *
  758. * `color` should be a pixel of the format used by the surface, and can be
  759. * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
  760. * alpha component then the destination is simply filled with that alpha
  761. * information, no blending takes place.
  762. *
  763. * If there is a clip rectangle set on the destination (set via
  764. * SDL_SetSurfaceClipRect()), then this function will fill based on the
  765. * intersection of the clip rectangle and `rect`.
  766. *
  767. * \param dst the SDL_Surface structure that is the drawing target
  768. * \param rect the SDL_Rect structure representing the rectangle to fill, or
  769. * NULL to fill the entire surface
  770. * \param color the color to fill with
  771. * \returns 0 on success or a negative error code on failure; call
  772. * SDL_GetError() for more information.
  773. *
  774. * \since This function is available since SDL 3.0.0.
  775. *
  776. * \sa SDL_FillSurfaceRects
  777. */
  778. extern DECLSPEC int SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color);
  779. /**
  780. * Perform a fast fill of a set of rectangles with a specific color.
  781. *
  782. * `color` should be a pixel of the format used by the surface, and can be
  783. * generated by SDL_MapRGB() or SDL_MapRGBA(). If the color value contains an
  784. * alpha component then the destination is simply filled with that alpha
  785. * information, no blending takes place.
  786. *
  787. * If there is a clip rectangle set on the destination (set via
  788. * SDL_SetSurfaceClipRect()), then this function will fill based on the
  789. * intersection of the clip rectangle and `rect`.
  790. *
  791. * \param dst the SDL_Surface structure that is the drawing target
  792. * \param rects an array of SDL_Rects representing the rectangles to fill.
  793. * \param count the number of rectangles in the array
  794. * \param color the color to fill with
  795. * \returns 0 on success or a negative error code on failure; call
  796. * SDL_GetError() for more information.
  797. *
  798. * \since This function is available since SDL 3.0.0.
  799. *
  800. * \sa SDL_FillSurfaceRect
  801. */
  802. extern DECLSPEC int SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color);
  803. /**
  804. * Performs a fast blit from the source surface to the destination surface.
  805. *
  806. * This assumes that the source and destination rectangles are the same size.
  807. * If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or
  808. * `dst`) is copied. The final blit rectangles are saved in `srcrect` and
  809. * `dstrect` after all clipping is performed.
  810. *
  811. * The blit function should not be called on a locked surface.
  812. *
  813. * The blit semantics for surfaces with and without blending and colorkey are
  814. * defined as follows:
  815. *
  816. * ```
  817. * RGBA->RGB:
  818. * Source surface blend mode set to SDL_BLENDMODE_BLEND:
  819. * alpha-blend (using the source alpha-channel and per-surface alpha)
  820. * SDL_SRCCOLORKEY ignored.
  821. * Source surface blend mode set to SDL_BLENDMODE_NONE:
  822. * copy RGB.
  823. * if SDL_SRCCOLORKEY set, only copy the pixels matching the
  824. * RGB values of the source color key, ignoring alpha in the
  825. * comparison.
  826. *
  827. * RGB->RGBA:
  828. * Source surface blend mode set to SDL_BLENDMODE_BLEND:
  829. * alpha-blend (using the source per-surface alpha)
  830. * Source surface blend mode set to SDL_BLENDMODE_NONE:
  831. * copy RGB, set destination alpha to source per-surface alpha value.
  832. * both:
  833. * if SDL_SRCCOLORKEY set, only copy the pixels matching the
  834. * source color key.
  835. *
  836. * RGBA->RGBA:
  837. * Source surface blend mode set to SDL_BLENDMODE_BLEND:
  838. * alpha-blend (using the source alpha-channel and per-surface alpha)
  839. * SDL_SRCCOLORKEY ignored.
  840. * Source surface blend mode set to SDL_BLENDMODE_NONE:
  841. * copy all of RGBA to the destination.
  842. * if SDL_SRCCOLORKEY set, only copy the pixels matching the
  843. * RGB values of the source color key, ignoring alpha in the
  844. * comparison.
  845. *
  846. * RGB->RGB:
  847. * Source surface blend mode set to SDL_BLENDMODE_BLEND:
  848. * alpha-blend (using the source per-surface alpha)
  849. * Source surface blend mode set to SDL_BLENDMODE_NONE:
  850. * copy RGB.
  851. * both:
  852. * if SDL_SRCCOLORKEY set, only copy the pixels matching the
  853. * source color key.
  854. * ```
  855. *
  856. * \param src the SDL_Surface structure to be copied from
  857. * \param srcrect the SDL_Rect structure representing the rectangle to be
  858. * copied, or NULL to copy the entire surface
  859. * \param dst the SDL_Surface structure that is the blit target
  860. * \param dstrect the SDL_Rect structure representing the x and y position in
  861. * the destination surface. On input the width and height are
  862. * ignored (taken from srcrect), and on output this is filled
  863. * in with the actual rectangle used after clipping.
  864. * \returns 0 on success or a negative error code on failure; call
  865. * SDL_GetError() for more information.
  866. *
  867. * \since This function is available since SDL 3.0.0.
  868. *
  869. * \sa SDL_BlitSurfaceScaled
  870. */
  871. extern DECLSPEC int SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
  872. /**
  873. * Perform low-level surface blitting only.
  874. *
  875. * This is a semi-private blit function and it performs low-level surface
  876. * blitting, assuming the input rectangles have already been clipped.
  877. *
  878. * \param src the SDL_Surface structure to be copied from
  879. * \param srcrect the SDL_Rect structure representing the rectangle to be
  880. * copied, or NULL to copy the entire surface
  881. * \param dst the SDL_Surface structure that is the blit target
  882. * \param dstrect the SDL_Rect structure representing the target rectangle in
  883. * the destination surface
  884. * \returns 0 on success or a negative error code on failure; call
  885. * SDL_GetError() for more information.
  886. *
  887. * \since This function is available since SDL 3.0.0.
  888. *
  889. * \sa SDL_BlitSurface
  890. */
  891. extern DECLSPEC int SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
  892. /**
  893. * Perform stretch blit between two surfaces of the same format.
  894. *
  895. * Using SDL_SCALEMODE_NEAREST: fast, low quality. Using SDL_SCALEMODE_LINEAR:
  896. * bilinear scaling, slower, better quality, only 32BPP.
  897. *
  898. * \param src the SDL_Surface structure to be copied from
  899. * \param srcrect the SDL_Rect structure representing the rectangle to be
  900. * copied
  901. * \param dst the SDL_Surface structure that is the blit target
  902. * \param dstrect the SDL_Rect structure representing the target rectangle in
  903. * the destination surface
  904. * \param scaleMode scale algorithm to be used
  905. * \returns 0 on success or a negative error code on failure; call
  906. * SDL_GetError() for more information.
  907. *
  908. * \since This function is available since SDL 3.0.0.
  909. *
  910. * \sa SDL_BlitSurfaceScaled
  911. */
  912. extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode);
  913. /**
  914. * Perform a scaled blit to a destination surface, which may be of a different
  915. * format.
  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 the SDL_ScaleMode 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. /* Ends C function definitions when using C++ */
  981. #ifdef __cplusplus
  982. }
  983. #endif
  984. #include <SDL3/SDL_close_code.h>
  985. #endif /* SDL_surface_h_ */