SDL_render.h 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2023 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_render.h
  20. *
  21. * \brief Header file for SDL 2D rendering functions.
  22. *
  23. * This API supports the following features:
  24. * * single pixel points
  25. * * single pixel lines
  26. * * filled rectangles
  27. * * texture images
  28. *
  29. * The primitives may be drawn in opaque, blended, or additive modes.
  30. *
  31. * The texture images may be drawn in opaque, blended, or additive modes.
  32. * They can have an additional color tint or alpha modulation applied to
  33. * them, and may also be stretched with linear interpolation.
  34. *
  35. * This API is designed to accelerate simple 2D operations. You may
  36. * want more functionality such as polygons and particle effects and
  37. * in that case you should use SDL's OpenGL/Direct3D support or one
  38. * of the many good 3D engines.
  39. *
  40. * These functions must be called from the main thread.
  41. * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
  42. */
  43. #ifndef SDL_render_h_
  44. #define SDL_render_h_
  45. #include <SDL3/SDL_stdinc.h>
  46. #include <SDL3/SDL_events.h>
  47. #include <SDL3/SDL_rect.h>
  48. #include <SDL3/SDL_video.h>
  49. #include <SDL3/SDL_begin_code.h>
  50. /* Set up for C function definitions, even when using C++ */
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. /**
  55. * Flags used when creating a rendering context
  56. */
  57. typedef enum
  58. {
  59. SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
  60. SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
  61. acceleration */
  62. SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
  63. with the refresh rate */
  64. } SDL_RendererFlags;
  65. /**
  66. * Information on the capabilities of a render driver or context.
  67. */
  68. typedef struct SDL_RendererInfo
  69. {
  70. const char *name; /**< The name of the renderer */
  71. Uint32 flags; /**< Supported ::SDL_RendererFlags */
  72. Uint32 num_texture_formats; /**< The number of available texture formats */
  73. Uint32 texture_formats[16]; /**< The available texture formats */
  74. int max_texture_width; /**< The maximum texture width */
  75. int max_texture_height; /**< The maximum texture height */
  76. } SDL_RendererInfo;
  77. /**
  78. * Vertex structure
  79. */
  80. typedef struct SDL_Vertex
  81. {
  82. SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
  83. SDL_Color color; /**< Vertex color */
  84. SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
  85. } SDL_Vertex;
  86. /**
  87. * The scaling mode for a texture.
  88. */
  89. typedef enum
  90. {
  91. SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
  92. SDL_SCALEMODE_LINEAR, /**< linear filtering */
  93. SDL_SCALEMODE_BEST /**< anisotropic filtering */
  94. } SDL_ScaleMode;
  95. /**
  96. * The access pattern allowed for a texture.
  97. */
  98. typedef enum
  99. {
  100. SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
  101. SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
  102. SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
  103. } SDL_TextureAccess;
  104. /**
  105. * The texture channel modulation used in SDL_RenderTexture().
  106. */
  107. typedef enum
  108. {
  109. SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
  110. SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
  111. SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
  112. } SDL_TextureModulate;
  113. /**
  114. * Flip constants for SDL_RenderTextureRotated
  115. */
  116. typedef enum
  117. {
  118. SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
  119. SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
  120. SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
  121. } SDL_RendererFlip;
  122. /**
  123. * How the logical size is mapped to the output
  124. */
  125. typedef enum
  126. {
  127. SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
  128. SDL_LOGICAL_PRESENTATION_MATCH, /**< The rendered content matches the window size in screen coordinates */
  129. SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
  130. SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars */
  131. SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
  132. SDL_LOGICAL_PRESENTATION_INTEGER_SCALE, /**< The rendered content is scaled up by integer multiples to fit the output resolution */
  133. } SDL_RendererLogicalPresentation;
  134. /**
  135. * A structure representing rendering state
  136. */
  137. struct SDL_Renderer;
  138. typedef struct SDL_Renderer SDL_Renderer;
  139. /**
  140. * An efficient driver-specific representation of pixel data
  141. */
  142. struct SDL_Texture;
  143. typedef struct SDL_Texture SDL_Texture;
  144. /* Function prototypes */
  145. /**
  146. * Get the number of 2D rendering drivers available for the current display.
  147. *
  148. * A render driver is a set of code that handles rendering and texture
  149. * management on a particular display. Normally there is only one, but some
  150. * drivers may have several available with different capabilities.
  151. *
  152. * There may be none if SDL was compiled without render support.
  153. *
  154. * \returns a number >= 0 on success or a negative error code on failure; call
  155. * SDL_GetError() for more information.
  156. *
  157. * \since This function is available since SDL 3.0.0.
  158. *
  159. * \sa SDL_CreateRenderer
  160. * \sa SDL_GetRenderDriver
  161. */
  162. extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
  163. /**
  164. * Use this function to get the name of a built in 2D rendering driver.
  165. *
  166. * The list of rendering drivers is given in the order that they are normally
  167. * initialized by default; the drivers that seem more reasonable to choose
  168. * first (as far as the SDL developers believe) are earlier in the list.
  169. *
  170. * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
  171. * "direct3d12" or "metal". These never have Unicode characters, and are not
  172. * meant to be proper names.
  173. *
  174. * The returned value points to a static, read-only string; do not modify or
  175. * free it!
  176. *
  177. * \param index the index of the rendering driver; the value ranges from 0 to
  178. * SDL_GetNumRenderDrivers() - 1
  179. * \returns the name of the rendering driver at the requested index, or NULL
  180. * if an invalid index was specified.
  181. *
  182. * \since This function is available since SDL 3.0.0.
  183. *
  184. * \sa SDL_GetNumRenderDrivers
  185. */
  186. extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
  187. /**
  188. * Create a window and default renderer.
  189. *
  190. * \param width the width of the window
  191. * \param height the height of the window
  192. * \param window_flags the flags used to create the window (see
  193. * SDL_CreateWindow())
  194. * \param window a pointer filled with the window, or NULL on error
  195. * \param renderer a pointer filled with the renderer, or NULL on error
  196. * \returns 0 on success or a negative error code on failure; call
  197. * SDL_GetError() for more information.
  198. *
  199. * \since This function is available since SDL 3.0.0.
  200. *
  201. * \sa SDL_CreateRenderer
  202. * \sa SDL_CreateWindow
  203. */
  204. extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer);
  205. /**
  206. * Create a 2D rendering context for a window.
  207. *
  208. * If you want a specific renderer, you can specify its name here. A list of
  209. * available renderers can be obtained by calling SDL_GetRenderDriver multiple
  210. * times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you don't
  211. * need a specific renderer, specify NULL and SDL will attempt to chooes the
  212. * best option for you, based on what is available on the user's system.
  213. *
  214. * By default the rendering size matches the window size in screen coordinates,
  215. * but you can call SDL_SetRenderLogicalPresentation() to enable high DPI
  216. * rendering or change the content size and scaling options.
  217. *
  218. * \param window the window where rendering is displayed
  219. * \param name the name of the rendering driver to initialize, or NULL to
  220. * initialize the first one supporting the requested flags
  221. * \param flags 0, or one or more SDL_RendererFlags OR'd together
  222. * \returns a valid rendering context or NULL if there was an error; call
  223. * SDL_GetError() for more information.
  224. *
  225. * \since This function is available since SDL 3.0.0.
  226. *
  227. * \sa SDL_CreateSoftwareRenderer
  228. * \sa SDL_DestroyRenderer
  229. * \sa SDL_GetNumRenderDrivers
  230. * \sa SDL_GetRenderDriver
  231. * \sa SDL_GetRendererInfo
  232. */
  233. extern DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags);
  234. /**
  235. * Create a 2D software rendering context for a surface.
  236. *
  237. * Two other API which can be used to create SDL_Renderer:
  238. * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
  239. * create a software renderer, but they are intended to be used with an
  240. * SDL_Window as the final destination and not an SDL_Surface.
  241. *
  242. * \param surface the SDL_Surface structure representing the surface where
  243. * rendering is done
  244. * \returns a valid rendering context or NULL if there was an error; call
  245. * SDL_GetError() for more information.
  246. *
  247. * \since This function is available since SDL 3.0.0.
  248. *
  249. * \sa SDL_CreateRenderer
  250. * \sa SDL_CreateWindowRenderer
  251. * \sa SDL_DestroyRenderer
  252. */
  253. extern DECLSPEC SDL_Renderer *SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
  254. /**
  255. * Get the renderer associated with a window.
  256. *
  257. * \param window the window to query
  258. * \returns the rendering context on success or NULL on failure; call
  259. * SDL_GetError() for more information.
  260. *
  261. * \since This function is available since SDL 3.0.0.
  262. *
  263. * \sa SDL_CreateRenderer
  264. */
  265. extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetRenderer(SDL_Window *window);
  266. /**
  267. * Get the window associated with a renderer.
  268. *
  269. * \param renderer the renderer to query
  270. * \returns the window on success or NULL on failure; call SDL_GetError() for
  271. * more information.
  272. *
  273. * \since This function is available since SDL 3.0.0.
  274. */
  275. extern DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
  276. /**
  277. * Get information about a rendering context.
  278. *
  279. * \param renderer the rendering context
  280. * \param info an SDL_RendererInfo structure filled with information about the
  281. * current renderer
  282. * \returns 0 on success or a negative error code on failure; call
  283. * SDL_GetError() for more information.
  284. *
  285. * \since This function is available since SDL 3.0.0.
  286. *
  287. * \sa SDL_CreateRenderer
  288. */
  289. extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
  290. /**
  291. * Get the output size in screen coordinates of a rendering context.
  292. *
  293. * This returns the true output size in screen coordinates, ignoring any
  294. * render targets or logical size and presentation.
  295. *
  296. * \param renderer the rendering context
  297. * \param w a pointer filled in with the width in screen coordinates
  298. * \param h a pointer filled in with the height in screen coordinates
  299. * \returns 0 on success or a negative error code on failure; call
  300. * SDL_GetError() for more information.
  301. *
  302. * \since This function is available since SDL 3.0.0.
  303. *
  304. * \sa SDL_GetRenderer
  305. */
  306. extern DECLSPEC int SDLCALL SDL_GetRenderWindowSize(SDL_Renderer *renderer, int *w, int *h);
  307. /**
  308. * Get the output size in pixels of a rendering context.
  309. *
  310. * This returns the true output size in pixels, ignoring any render targets
  311. * or logical size and presentation.
  312. *
  313. * \param renderer the rendering context
  314. * \param w a pointer filled in with the width in pixels
  315. * \param h a pointer filled in with the height in pixels
  316. * \returns 0 on success or a negative error code on failure; call
  317. * SDL_GetError() for more information.
  318. *
  319. * \since This function is available since SDL 3.0.0.
  320. *
  321. * \sa SDL_GetRenderer
  322. */
  323. extern DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
  324. /**
  325. * Get the current output size in pixels of a rendering context.
  326. *
  327. * If a rendering target is active, this will return the size of the
  328. * rendering target in pixels, otherwise if a logical size is set, it will
  329. * return the logical size, otherwise it will return the value of
  330. * SDL_GetRenderOutputSize().
  331. *
  332. * \param renderer the rendering context
  333. * \param w a pointer filled in with the current width
  334. * \param h a pointer filled in with the current height
  335. * \returns 0 on success or a negative error code on failure; call
  336. * SDL_GetError() for more information.
  337. *
  338. * \since This function is available since SDL 3.0.0.
  339. *
  340. * \sa SDL_GetRenderOutputSize
  341. * \sa SDL_GetRenderer
  342. */
  343. extern DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
  344. /**
  345. * Create a texture for a rendering context.
  346. *
  347. * You can set the texture scaling method by setting
  348. * `SDL_HINT_RENDER_SCALE_QUALITY` before creating the texture.
  349. *
  350. * \param renderer the rendering context
  351. * \param format one of the enumerated values in SDL_PixelFormatEnum
  352. * \param access one of the enumerated values in SDL_TextureAccess
  353. * \param w the width of the texture in pixels
  354. * \param h the height of the texture in pixels
  355. * \returns a pointer to the created texture or NULL if no rendering context
  356. * was active, the format was unsupported, or the width or height
  357. * were out of range; call SDL_GetError() for more information.
  358. *
  359. * \since This function is available since SDL 3.0.0.
  360. *
  361. * \sa SDL_CreateTextureFromSurface
  362. * \sa SDL_DestroyTexture
  363. * \sa SDL_QueryTexture
  364. * \sa SDL_UpdateTexture
  365. */
  366. extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h);
  367. /**
  368. * Create a texture from an existing surface.
  369. *
  370. * The surface is not modified or freed by this function.
  371. *
  372. * The SDL_TextureAccess hint for the created texture is
  373. * `SDL_TEXTUREACCESS_STATIC`.
  374. *
  375. * The pixel format of the created texture may be different from the pixel
  376. * format of the surface. Use SDL_QueryTexture() to query the pixel format of
  377. * the texture.
  378. *
  379. * \param renderer the rendering context
  380. * \param surface the SDL_Surface structure containing pixel data used to fill
  381. * the texture
  382. * \returns the created texture or NULL on failure; call SDL_GetError() for
  383. * more information.
  384. *
  385. * \since This function is available since SDL 3.0.0.
  386. *
  387. * \sa SDL_CreateTexture
  388. * \sa SDL_DestroyTexture
  389. * \sa SDL_QueryTexture
  390. */
  391. extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
  392. /**
  393. * Query the attributes of a texture.
  394. *
  395. * \param texture the texture to query
  396. * \param format a pointer filled in with the raw format of the texture; the
  397. * actual format may differ, but pixel transfers will use this
  398. * format (one of the SDL_PixelFormatEnum values). This argument
  399. * can be NULL if you don't need this information.
  400. * \param access a pointer filled in with the actual access to the texture
  401. * (one of the SDL_TextureAccess values). This argument can be
  402. * NULL if you don't need this information.
  403. * \param w a pointer filled in with the width of the texture in pixels. This
  404. * argument can be NULL if you don't need this information.
  405. * \param h a pointer filled in with the height of the texture in pixels. This
  406. * argument can be NULL if you don't need this information.
  407. * \returns 0 on success or a negative error code on failure; call
  408. * SDL_GetError() for more information.
  409. *
  410. * \since This function is available since SDL 3.0.0.
  411. *
  412. * \sa SDL_CreateTexture
  413. */
  414. extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
  415. /**
  416. * Set an additional color value multiplied into render copy operations.
  417. *
  418. * When this texture is rendered, during the copy operation each source color
  419. * channel is modulated by the appropriate color value according to the
  420. * following formula:
  421. *
  422. * `srcC = srcC * (color / 255)`
  423. *
  424. * Color modulation is not always supported by the renderer; it will return -1
  425. * if color modulation is not supported.
  426. *
  427. * \param texture the texture to update
  428. * \param r the red color value multiplied into copy operations
  429. * \param g the green color value multiplied into copy operations
  430. * \param b the blue color value multiplied into copy operations
  431. * \returns 0 on success or a negative error code on failure; call
  432. * SDL_GetError() for more information.
  433. *
  434. * \since This function is available since SDL 3.0.0.
  435. *
  436. * \sa SDL_GetTextureColorMod
  437. * \sa SDL_SetTextureAlphaMod
  438. */
  439. extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
  440. /**
  441. * Get the additional color value multiplied into render copy operations.
  442. *
  443. * \param texture the texture to query
  444. * \param r a pointer filled in with the current red color value
  445. * \param g a pointer filled in with the current green color value
  446. * \param b a pointer filled in with the current blue color value
  447. * \returns 0 on success or a negative error code on failure; call
  448. * SDL_GetError() for more information.
  449. *
  450. * \since This function is available since SDL 3.0.0.
  451. *
  452. * \sa SDL_GetTextureAlphaMod
  453. * \sa SDL_SetTextureColorMod
  454. */
  455. extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
  456. /**
  457. * Set an additional alpha value multiplied into render copy operations.
  458. *
  459. * When this texture is rendered, during the copy operation the source alpha
  460. * value is modulated by this alpha value according to the following formula:
  461. *
  462. * `srcA = srcA * (alpha / 255)`
  463. *
  464. * Alpha modulation is not always supported by the renderer; it will return -1
  465. * if alpha modulation is not supported.
  466. *
  467. * \param texture the texture to update
  468. * \param alpha the source alpha value multiplied into copy operations
  469. * \returns 0 on success or a negative error code on failure; call
  470. * SDL_GetError() for more information.
  471. *
  472. * \since This function is available since SDL 3.0.0.
  473. *
  474. * \sa SDL_GetTextureAlphaMod
  475. * \sa SDL_SetTextureColorMod
  476. */
  477. extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
  478. /**
  479. * Get the additional alpha value multiplied into render copy operations.
  480. *
  481. * \param texture the texture to query
  482. * \param alpha a pointer filled in with the current alpha value
  483. * \returns 0 on success or a negative error code on failure; call
  484. * SDL_GetError() for more information.
  485. *
  486. * \since This function is available since SDL 3.0.0.
  487. *
  488. * \sa SDL_GetTextureColorMod
  489. * \sa SDL_SetTextureAlphaMod
  490. */
  491. extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
  492. /**
  493. * Set the blend mode for a texture, used by SDL_RenderTexture().
  494. *
  495. * If the blend mode is not supported, the closest supported mode is chosen
  496. * and this function returns -1.
  497. *
  498. * \param texture the texture to update
  499. * \param blendMode the SDL_BlendMode to use for texture blending
  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_GetTextureBlendMode
  506. * \sa SDL_RenderTexture
  507. */
  508. extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
  509. /**
  510. * Get the blend mode used for texture copy operations.
  511. *
  512. * \param texture the texture to query
  513. * \param blendMode a pointer filled in with the current SDL_BlendMode
  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_SetTextureBlendMode
  520. */
  521. extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
  522. /**
  523. * Set the scale mode used for texture scale operations.
  524. *
  525. * If the scale mode is not supported, the closest supported mode is chosen.
  526. *
  527. * \param texture The texture to update.
  528. * \param scaleMode the SDL_ScaleMode to use for texture scaling.
  529. * \returns 0 on success or a negative error code on failure; call
  530. * SDL_GetError() for more information.
  531. *
  532. * \since This function is available since SDL 3.0.0.
  533. *
  534. * \sa SDL_GetTextureScaleMode
  535. */
  536. extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
  537. /**
  538. * Get the scale mode used for texture scale operations.
  539. *
  540. * \param texture the texture to query.
  541. * \param scaleMode a pointer filled in with the current scale mode.
  542. * \returns 0 on success or a negative error code on failure; call
  543. * SDL_GetError() for more information.
  544. *
  545. * \since This function is available since SDL 3.0.0.
  546. *
  547. * \sa SDL_SetTextureScaleMode
  548. */
  549. extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
  550. /**
  551. * Associate a user-specified pointer with a texture.
  552. *
  553. * \param texture the texture to update.
  554. * \param userdata the pointer to associate with the texture.
  555. * \returns 0 on success or a negative error code on failure; call
  556. * SDL_GetError() for more information.
  557. *
  558. * \since This function is available since SDL 3.0.0.
  559. *
  560. * \sa SDL_GetTextureUserData
  561. */
  562. extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *userdata);
  563. /**
  564. * Get the user-specified pointer associated with a texture
  565. *
  566. * \param texture the texture to query.
  567. * \returns the pointer associated with the texture, or NULL if the texture is
  568. * not valid.
  569. *
  570. * \since This function is available since SDL 3.0.0.
  571. *
  572. * \sa SDL_SetTextureUserData
  573. */
  574. extern DECLSPEC void *SDLCALL SDL_GetTextureUserData(SDL_Texture *texture);
  575. /**
  576. * Update the given texture rectangle with new pixel data.
  577. *
  578. * The pixel data must be in the pixel format of the texture. Use
  579. * SDL_QueryTexture() to query the pixel format of the texture.
  580. *
  581. * This is a fairly slow function, intended for use with static textures that
  582. * do not change often.
  583. *
  584. * If the texture is intended to be updated often, it is preferred to create
  585. * the texture as streaming and use the locking functions referenced below.
  586. * While this function will work with streaming textures, for optimization
  587. * reasons you may not get the pixels back if you lock the texture afterward.
  588. *
  589. * \param texture the texture to update
  590. * \param rect an SDL_Rect structure representing the area to update, or NULL
  591. * to update the entire texture
  592. * \param pixels the raw pixel data in the format of the texture
  593. * \param pitch the number of bytes in a row of pixel data, including padding
  594. * between lines
  595. * \returns 0 on success or a negative error code on failure; call
  596. * SDL_GetError() for more information.
  597. *
  598. * \since This function is available since SDL 3.0.0.
  599. *
  600. * \sa SDL_CreateTexture
  601. * \sa SDL_LockTexture
  602. * \sa SDL_UnlockTexture
  603. */
  604. extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
  605. /**
  606. * Update a rectangle within a planar YV12 or IYUV texture with new pixel
  607. * data.
  608. *
  609. * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
  610. * block of Y and U/V planes in the proper order, but this function is
  611. * available if your pixel data is not contiguous.
  612. *
  613. * \param texture the texture to update
  614. * \param rect a pointer to the rectangle of pixels to update, or NULL to
  615. * update the entire texture
  616. * \param Yplane the raw pixel data for the Y plane
  617. * \param Ypitch the number of bytes between rows of pixel data for the Y
  618. * plane
  619. * \param Uplane the raw pixel data for the U plane
  620. * \param Upitch the number of bytes between rows of pixel data for the U
  621. * plane
  622. * \param Vplane the raw pixel data for the V plane
  623. * \param Vpitch the number of bytes between rows of pixel data for the V
  624. * plane
  625. * \returns 0 on success or a negative error code on failure; call
  626. * SDL_GetError() for more information.
  627. *
  628. * \since This function is available since SDL 3.0.0.
  629. *
  630. * \sa SDL_UpdateTexture
  631. */
  632. extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
  633. const SDL_Rect *rect,
  634. const Uint8 *Yplane, int Ypitch,
  635. const Uint8 *Uplane, int Upitch,
  636. const Uint8 *Vplane, int Vpitch);
  637. /**
  638. * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
  639. *
  640. * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
  641. * block of NV12/21 planes in the proper order, but this function is available
  642. * if your pixel data is not contiguous.
  643. *
  644. * \param texture the texture to update
  645. * \param rect a pointer to the rectangle of pixels to update, or NULL to
  646. * update the entire texture.
  647. * \param Yplane the raw pixel data for the Y plane.
  648. * \param Ypitch the number of bytes between rows of pixel data for the Y
  649. * plane.
  650. * \param UVplane the raw pixel data for the UV plane.
  651. * \param UVpitch the number of bytes between rows of pixel data for the UV
  652. * plane.
  653. * \returns 0 on success or a negative error code on failure; call
  654. * SDL_GetError() for more information.
  655. *
  656. * \since This function is available since SDL 3.0.0.
  657. */
  658. extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
  659. const SDL_Rect *rect,
  660. const Uint8 *Yplane, int Ypitch,
  661. const Uint8 *UVplane, int UVpitch);
  662. /**
  663. * Lock a portion of the texture for **write-only** pixel access.
  664. *
  665. * As an optimization, the pixels made available for editing don't necessarily
  666. * contain the old texture data. This is a write-only operation, and if you
  667. * need to keep a copy of the texture data you should do that at the
  668. * application level.
  669. *
  670. * You must use SDL_UnlockTexture() to unlock the pixels and apply any
  671. * changes.
  672. *
  673. * \param texture the texture to lock for access, which was created with
  674. * `SDL_TEXTUREACCESS_STREAMING`
  675. * \param rect an SDL_Rect structure representing the area to lock for access;
  676. * NULL to lock the entire texture
  677. * \param pixels this is filled in with a pointer to the locked pixels,
  678. * appropriately offset by the locked area
  679. * \param pitch this is filled in with the pitch of the locked pixels; the
  680. * pitch is the length of one row in bytes
  681. * \returns 0 on success or a negative error code if the texture is not valid
  682. * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
  683. * SDL_GetError() for more information.
  684. *
  685. * \since This function is available since SDL 3.0.0.
  686. *
  687. * \sa SDL_UnlockTexture
  688. */
  689. extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
  690. const SDL_Rect *rect,
  691. void **pixels, int *pitch);
  692. /**
  693. * Lock a portion of the texture for **write-only** pixel access, and expose
  694. * it as a SDL surface.
  695. *
  696. * Besides providing an SDL_Surface instead of raw pixel data, this function
  697. * operates like SDL_LockTexture.
  698. *
  699. * As an optimization, the pixels made available for editing don't necessarily
  700. * contain the old texture data. This is a write-only operation, and if you
  701. * need to keep a copy of the texture data you should do that at the
  702. * application level.
  703. *
  704. * You must use SDL_UnlockTexture() to unlock the pixels and apply any
  705. * changes.
  706. *
  707. * The returned surface is freed internally after calling SDL_UnlockTexture()
  708. * or SDL_DestroyTexture(). The caller should not free it.
  709. *
  710. * \param texture the texture to lock for access, which must be created with
  711. * `SDL_TEXTUREACCESS_STREAMING`
  712. * \param rect a pointer to the rectangle to lock for access. If the rect is
  713. * NULL, the entire texture will be locked
  714. * \param surface this is filled in with an SDL surface representing the
  715. * locked area
  716. * \returns 0 on success or a negative error code on failure; call
  717. * SDL_GetError() for more information.
  718. *
  719. * \since This function is available since SDL 3.0.0.
  720. *
  721. * \sa SDL_LockTexture
  722. * \sa SDL_UnlockTexture
  723. */
  724. extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
  725. const SDL_Rect *rect,
  726. SDL_Surface **surface);
  727. /**
  728. * Unlock a texture, uploading the changes to video memory, if needed.
  729. *
  730. * **Warning**: Please note that SDL_LockTexture() is intended to be
  731. * write-only; it will not guarantee the previous contents of the texture will
  732. * be provided. You must fully initialize any area of a texture that you lock
  733. * before unlocking it, as the pixels might otherwise be uninitialized memory.
  734. *
  735. * Which is to say: locking and immediately unlocking a texture can result in
  736. * corrupted textures, depending on the renderer in use.
  737. *
  738. * \param texture a texture locked by SDL_LockTexture()
  739. *
  740. * \since This function is available since SDL 3.0.0.
  741. *
  742. * \sa SDL_LockTexture
  743. */
  744. extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
  745. /**
  746. * Set a texture as the current rendering target.
  747. *
  748. * Before using this function, you should check the
  749. * `SDL_RENDERER_TARGETTEXTURE` bit in the flags of SDL_RendererInfo to see if
  750. * render targets are supported.
  751. *
  752. * The default render target is the window for which the renderer was created.
  753. * To stop rendering to a texture and render to the window again, call this
  754. * function with a NULL `texture`.
  755. *
  756. * \param renderer the rendering context
  757. * \param texture the targeted texture, which must be created with the
  758. * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
  759. * window instead of a texture.
  760. * \returns 0 on success or a negative error code on failure; call
  761. * SDL_GetError() for more information.
  762. *
  763. * \since This function is available since SDL 3.0.0.
  764. *
  765. * \sa SDL_GetRenderTarget
  766. */
  767. extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
  768. /**
  769. * Get the current render target.
  770. *
  771. * The default render target is the window for which the renderer was created,
  772. * and is reported a NULL here.
  773. *
  774. * \param renderer the rendering context
  775. * \returns the current render target or NULL for the default render target.
  776. *
  777. * \since This function is available since SDL 3.0.0.
  778. *
  779. * \sa SDL_SetRenderTarget
  780. */
  781. extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
  782. /**
  783. * Set a device independent resolution and presentation mode for rendering.
  784. *
  785. * This function sets the width and height of the logical rendering output.
  786. * A render target is created at the specified size and used for rendering
  787. * and then copied to the output during presentation.
  788. *
  789. * When a renderer is created, the logical size is set to match the window
  790. * size in screen coordinates. The actual output size may be higher pixel
  791. * density, and can be queried with SDL_GetRenderOutputSize().
  792. *
  793. * You can disable logical coordinates by setting the mode to
  794. * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full
  795. * resolution of the output window.
  796. *
  797. * You can convert coordinates in an event into rendering coordinates using
  798. * SDL_ConvertEventToRenderCoordinates().
  799. *
  800. * \param renderer the rendering context
  801. * \param w the width of the logical resolution
  802. * \param h the height of the logical resolution
  803. * \param mode the presentation mode used
  804. * \param scale_mode the scale mode used
  805. * \returns 0 on success or a negative error code on failure; call
  806. * SDL_GetError() for more information.
  807. *
  808. * \since This function is available since SDL 3.0.0.
  809. *
  810. * \sa SDL_ConvertEventToRenderCoordinates
  811. * \sa SDL_GetRenderLogicalPresentation
  812. */
  813. extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
  814. /**
  815. * Get device independent resolution and presentation mode for rendering.
  816. *
  817. * This function gets the width and height of the logical rendering output,
  818. * or the output size in pixels if a logical resolution is not enabled.
  819. *
  820. * \param renderer the rendering context
  821. * \param w an int to be filled with the width
  822. * \param h an int to be filled with the height
  823. * \param mode a pointer filled in with the presentation mode
  824. * \param scale_mode a pointer filled in with the scale mode
  825. * \returns 0 on success or a negative error code on failure; call
  826. * SDL_GetError() for more information.
  827. *
  828. * \since This function is available since SDL 3.0.0.
  829. *
  830. * \sa SDL_SetRenderLogicalPresentation
  831. */
  832. extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
  833. /**
  834. * Get a point in render coordinates when given a point in window coordinates.
  835. *
  836. * \param renderer the rendering context
  837. * \param window_x the x coordinate in window coordinates
  838. * \param window_y the y coordinate in window coordinates
  839. * \param x a pointer filled with the x coordinate in render coordinates
  840. * \param y a pointer filled with the y coordinate in render coordinates
  841. * \returns 0 on success or a negative error code on failure; call
  842. * SDL_GetError() for more information.
  843. *
  844. * \since This function is available since SDL 3.0.0.
  845. *
  846. * \sa SDL_SetRenderLogicalPresentation
  847. * \sa SDL_SetRenderScale
  848. */
  849. extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
  850. /**
  851. * Get a point in window coordinates when given a point in render coordinates.
  852. *
  853. * \param renderer the rendering context
  854. * \param x the x coordinate in render coordinates
  855. * \param y the y coordinate in render coordinates
  856. * \param window_x a pointer filled with the x coordinate in window coordinates
  857. * \param window_y a pointer filled with the y coordinate in window coordinates
  858. * \returns 0 on success or a negative error code on failure; call
  859. * SDL_GetError() for more information.
  860. *
  861. * \since This function is available since SDL 3.0.0.
  862. *
  863. * \sa SDL_SetRenderLogicalPresentation
  864. * \sa SDL_SetRenderScale
  865. */
  866. extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
  867. /**
  868. * Convert the coordinates in an event to render coordinates.
  869. *
  870. * Touch coordinates are converted from normalized coordinates in the window
  871. * to non-normalized rendering coordinates.
  872. *
  873. * Once converted, the coordinates may be outside the rendering area.
  874. *
  875. * \param renderer the rendering context
  876. * \param event the event to modify
  877. * \returns 0 on success or a negative error code on failure; call
  878. * SDL_GetError() for more information.
  879. *
  880. * \since This function is available since SDL 3.0.0.
  881. *
  882. * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
  883. */
  884. extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
  885. /**
  886. * Set the drawing area for rendering on the current target.
  887. *
  888. * \param renderer the rendering context
  889. * \param rect the SDL_Rect structure representing the drawing area, or NULL
  890. * to set the viewport to the entire target
  891. * \returns 0 on success or a negative error code on failure; call
  892. * SDL_GetError() for more information.
  893. *
  894. * \since This function is available since SDL 3.0.0.
  895. *
  896. * \sa SDL_GetRenderViewport
  897. */
  898. extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
  899. /**
  900. * Get the drawing area for the current target.
  901. *
  902. * \param renderer the rendering context
  903. * \param rect an SDL_Rect structure filled in with the current drawing area
  904. * \returns 0 on success or a negative error code on failure; call
  905. * SDL_GetError() for more information.
  906. *
  907. * \since This function is available since SDL 3.0.0.
  908. *
  909. * \sa SDL_SetRenderViewport
  910. */
  911. extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
  912. /**
  913. * Set the clip rectangle for rendering on the specified target.
  914. *
  915. * \param renderer the rendering context
  916. * \param rect an SDL_Rect structure representing the clip area, relative to
  917. * the viewport, or NULL to disable clipping
  918. * \returns 0 on success or a negative error code on failure; call
  919. * SDL_GetError() for more information.
  920. *
  921. * \since This function is available since SDL 3.0.0.
  922. *
  923. * \sa SDL_GetRenderClipRect
  924. * \sa SDL_RenderClipEnabled
  925. */
  926. extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
  927. /**
  928. * Get the clip rectangle for the current target.
  929. *
  930. * \param renderer the rendering context
  931. * \param rect an SDL_Rect structure filled in with the current clipping area
  932. * or an empty rectangle if clipping is disabled
  933. * \returns 0 on success or a negative error code on failure; call
  934. * SDL_GetError() for more information.
  935. *
  936. * \since This function is available since SDL 3.0.0.
  937. *
  938. * \sa SDL_RenderClipEnabled
  939. * \sa SDL_SetRenderClipRect
  940. */
  941. extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
  942. /**
  943. * Get whether clipping is enabled on the given renderer.
  944. *
  945. * \param renderer the rendering context
  946. * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
  947. * SDL_GetError() for more information.
  948. *
  949. * \since This function is available since SDL 3.0.0.
  950. *
  951. * \sa SDL_GetRenderClipRect
  952. * \sa SDL_SetRenderClipRect
  953. */
  954. extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
  955. /**
  956. * Set the drawing scale for rendering on the current target.
  957. *
  958. * The drawing coordinates are scaled by the x/y scaling factors before they
  959. * are used by the renderer. This allows resolution independent drawing with a
  960. * single coordinate system.
  961. *
  962. * If this results in scaling or subpixel drawing by the rendering backend, it
  963. * will be handled using the appropriate quality hints. For best results use
  964. * integer scaling factors.
  965. *
  966. * \param renderer the rendering context
  967. * \param scaleX the horizontal scaling factor
  968. * \param scaleY the vertical scaling factor
  969. * \returns 0 on success or a negative error code on failure; call
  970. * SDL_GetError() for more information.
  971. *
  972. * \since This function is available since SDL 3.0.0.
  973. *
  974. * \sa SDL_GetRenderScale
  975. */
  976. extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
  977. /**
  978. * Get the drawing scale for the current target.
  979. *
  980. * \param renderer the rendering context
  981. * \param scaleX a pointer filled in with the horizontal scaling factor
  982. * \param scaleY a pointer filled in with the vertical scaling factor
  983. * \returns 0 on success or a negative error code on failure; call
  984. * SDL_GetError() for more information.
  985. *
  986. * \since This function is available since SDL 3.0.0.
  987. *
  988. * \sa SDL_SetRenderScale
  989. */
  990. extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
  991. /**
  992. * Set the color used for drawing operations (Rect, Line and Clear).
  993. *
  994. * Set the color for drawing or filling rectangles, lines, and points, and for
  995. * SDL_RenderClear().
  996. *
  997. * \param renderer the rendering context
  998. * \param r the red value used to draw on the rendering target
  999. * \param g the green value used to draw on the rendering target
  1000. * \param b the blue value used to draw on the rendering target
  1001. * \param a the alpha value used to draw on the rendering target; usually
  1002. * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
  1003. * specify how the alpha channel is used
  1004. * \returns 0 on success or a negative error code on failure; call
  1005. * SDL_GetError() for more information.
  1006. *
  1007. * \since This function is available since SDL 3.0.0.
  1008. *
  1009. * \sa SDL_GetRenderDrawColor
  1010. * \sa SDL_RenderClear
  1011. * \sa SDL_RenderLine
  1012. * \sa SDL_RenderLines
  1013. * \sa SDL_RenderPoint
  1014. * \sa SDL_RenderPoints
  1015. * \sa SDL_RenderRect
  1016. * \sa SDL_RenderRects
  1017. * \sa SDL_RenderFillRect
  1018. * \sa SDL_RenderFillRects
  1019. */
  1020. extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
  1021. /**
  1022. * Get the color used for drawing operations (Rect, Line and Clear).
  1023. *
  1024. * \param renderer the rendering context
  1025. * \param r a pointer filled in with the red value used to draw on the
  1026. * rendering target
  1027. * \param g a pointer filled in with the green value used to draw on the
  1028. * rendering target
  1029. * \param b a pointer filled in with the blue value used to draw on the
  1030. * rendering target
  1031. * \param a a pointer filled in with the alpha value used to draw on the
  1032. * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
  1033. * \returns 0 on success or a negative error code on failure; call
  1034. * SDL_GetError() for more information.
  1035. *
  1036. * \since This function is available since SDL 3.0.0.
  1037. *
  1038. * \sa SDL_SetRenderDrawColor
  1039. */
  1040. extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
  1041. /**
  1042. * Set the blend mode used for drawing operations (Fill and Line).
  1043. *
  1044. * If the blend mode is not supported, the closest supported mode is chosen.
  1045. *
  1046. * \param renderer the rendering context
  1047. * \param blendMode the SDL_BlendMode to use for blending
  1048. * \returns 0 on success or a negative error code on failure; call
  1049. * SDL_GetError() for more information.
  1050. *
  1051. * \since This function is available since SDL 3.0.0.
  1052. *
  1053. * \sa SDL_GetRenderDrawBlendMode
  1054. * \sa SDL_RenderLine
  1055. * \sa SDL_RenderLines
  1056. * \sa SDL_RenderPoint
  1057. * \sa SDL_RenderPoints
  1058. * \sa SDL_RenderRect
  1059. * \sa SDL_RenderRects
  1060. * \sa SDL_RenderFillRect
  1061. * \sa SDL_RenderFillRects
  1062. */
  1063. extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
  1064. /**
  1065. * Get the blend mode used for drawing operations.
  1066. *
  1067. * \param renderer the rendering context
  1068. * \param blendMode a pointer filled in with the current SDL_BlendMode
  1069. * \returns 0 on success or a negative error code on failure; call
  1070. * SDL_GetError() for more information.
  1071. *
  1072. * \since This function is available since SDL 3.0.0.
  1073. *
  1074. * \sa SDL_SetRenderDrawBlendMode
  1075. */
  1076. extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
  1077. /**
  1078. * Clear the current rendering target with the drawing color.
  1079. *
  1080. * This function clears the entire rendering target, ignoring the viewport and
  1081. * the clip rectangle.
  1082. *
  1083. * \param renderer the rendering context
  1084. * \returns 0 on success or a negative error code on failure; call
  1085. * SDL_GetError() for more information.
  1086. *
  1087. * \since This function is available since SDL 3.0.0.
  1088. *
  1089. * \sa SDL_SetRenderDrawColor
  1090. */
  1091. extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
  1092. /**
  1093. * Draw a point on the current rendering target at subpixel precision.
  1094. *
  1095. * \param renderer The renderer which should draw a point.
  1096. * \param x The x coordinate of the point.
  1097. * \param y The y coordinate of the point.
  1098. * \returns 0 on success, or -1 on error
  1099. *
  1100. * \since This function is available since SDL 3.0.0.
  1101. */
  1102. extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
  1103. /**
  1104. * Draw multiple points on the current rendering target at subpixel precision.
  1105. *
  1106. * \param renderer The renderer which should draw multiple points.
  1107. * \param points The points to draw
  1108. * \param count The number of points to draw
  1109. * \returns 0 on success or a negative error code on failure; call
  1110. * SDL_GetError() for more information.
  1111. *
  1112. * \since This function is available since SDL 3.0.0.
  1113. */
  1114. extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
  1115. /**
  1116. * Draw a line on the current rendering target at subpixel precision.
  1117. *
  1118. * \param renderer The renderer which should draw a line.
  1119. * \param x1 The x coordinate of the start point.
  1120. * \param y1 The y coordinate of the start point.
  1121. * \param x2 The x coordinate of the end point.
  1122. * \param y2 The y coordinate of the end point.
  1123. * \returns 0 on success, or -1 on error
  1124. *
  1125. * \since This function is available since SDL 3.0.0.
  1126. */
  1127. extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
  1128. /**
  1129. * Draw a series of connected lines on the current rendering target at
  1130. * subpixel precision.
  1131. *
  1132. * \param renderer The renderer which should draw multiple lines.
  1133. * \param points The points along the lines
  1134. * \param count The number of points, drawing count-1 lines
  1135. * \returns 0 on success or a negative error code on failure; call
  1136. * SDL_GetError() for more information.
  1137. *
  1138. * \since This function is available since SDL 3.0.0.
  1139. */
  1140. extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
  1141. /**
  1142. * Draw a rectangle on the current rendering target at subpixel precision.
  1143. *
  1144. * \param renderer The renderer which should draw a rectangle.
  1145. * \param rect A pointer to the destination rectangle, or NULL to outline the
  1146. * entire rendering target.
  1147. * \returns 0 on success, or -1 on error
  1148. *
  1149. * \since This function is available since SDL 3.0.0.
  1150. */
  1151. extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
  1152. /**
  1153. * Draw some number of rectangles on the current rendering target at subpixel
  1154. * precision.
  1155. *
  1156. * \param renderer The renderer which should draw multiple rectangles.
  1157. * \param rects A pointer to an array of destination rectangles.
  1158. * \param count The number of rectangles.
  1159. * \returns 0 on success or a negative error code on failure; call
  1160. * SDL_GetError() for more information.
  1161. *
  1162. * \since This function is available since SDL 3.0.0.
  1163. */
  1164. extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
  1165. /**
  1166. * Fill a rectangle on the current rendering target with the drawing color at
  1167. * subpixel precision.
  1168. *
  1169. * \param renderer The renderer which should fill a rectangle.
  1170. * \param rect A pointer to the destination rectangle, or NULL for the entire
  1171. * rendering target.
  1172. * \returns 0 on success, or -1 on error
  1173. *
  1174. * \since This function is available since SDL 3.0.0.
  1175. */
  1176. extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
  1177. /**
  1178. * Fill some number of rectangles on the current rendering target with the
  1179. * drawing color at subpixel precision.
  1180. *
  1181. * \param renderer The renderer which should fill multiple rectangles.
  1182. * \param rects A pointer to an array of destination rectangles.
  1183. * \param count The number of rectangles.
  1184. * \returns 0 on success or a negative error code on failure; call
  1185. * SDL_GetError() for more information.
  1186. *
  1187. * \since This function is available since SDL 3.0.0.
  1188. */
  1189. extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
  1190. /**
  1191. * Copy a portion of the texture to the current rendering target at subpixel
  1192. * precision.
  1193. *
  1194. * \param renderer The renderer which should copy parts of a texture.
  1195. * \param texture The source texture.
  1196. * \param srcrect A pointer to the source rectangle, or NULL for the entire
  1197. * texture.
  1198. * \param dstrect A pointer to the destination rectangle, or NULL for the
  1199. * entire rendering target.
  1200. * \returns 0 on success, or -1 on error
  1201. *
  1202. * \since This function is available since SDL 3.0.0.
  1203. */
  1204. extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect);
  1205. /**
  1206. * Copy a portion of the source texture to the current rendering target, with
  1207. * rotation and flipping, at subpixel precision.
  1208. *
  1209. * \param renderer The renderer which should copy parts of a texture.
  1210. * \param texture The source texture.
  1211. * \param srcrect A pointer to the source rectangle, or NULL for the entire
  1212. * texture.
  1213. * \param dstrect A pointer to the destination rectangle, or NULL for the
  1214. * entire rendering target.
  1215. * \param angle An angle in degrees that indicates the rotation that will be
  1216. * applied to dstrect, rotating it in a clockwise direction
  1217. * \param center A pointer to a point indicating the point around which
  1218. * dstrect will be rotated (if NULL, rotation will be done
  1219. * around dstrect.w/2, dstrect.h/2).
  1220. * \param flip An SDL_RendererFlip value stating which flipping actions should
  1221. * be performed on the texture
  1222. * \returns 0 on success or a negative error code on failure; call
  1223. * SDL_GetError() for more information.
  1224. *
  1225. * \since This function is available since SDL 3.0.0.
  1226. */
  1227. extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
  1228. const SDL_Rect *srcrect, const SDL_FRect *dstrect,
  1229. const double angle, const SDL_FPoint *center,
  1230. const SDL_RendererFlip flip);
  1231. /**
  1232. * Render a list of triangles, optionally using a texture and indices into the
  1233. * vertex array Color and alpha modulation is done per vertex
  1234. * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
  1235. *
  1236. * \param renderer The rendering context.
  1237. * \param texture (optional) The SDL texture to use.
  1238. * \param vertices Vertices.
  1239. * \param num_vertices Number of vertices.
  1240. * \param indices (optional) An array of integer indices into the 'vertices'
  1241. * array, if NULL all vertices will be rendered in sequential
  1242. * order.
  1243. * \param num_indices Number of indices.
  1244. * \returns 0 on success, or -1 if the operation is not supported
  1245. *
  1246. * \since This function is available since SDL 3.0.0.
  1247. *
  1248. * \sa SDL_RenderGeometryRaw
  1249. * \sa SDL_Vertex
  1250. */
  1251. extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
  1252. SDL_Texture *texture,
  1253. const SDL_Vertex *vertices, int num_vertices,
  1254. const int *indices, int num_indices);
  1255. /**
  1256. * Render a list of triangles, optionally using a texture and indices into the
  1257. * vertex arrays Color and alpha modulation is done per vertex
  1258. * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
  1259. *
  1260. * \param renderer The rendering context.
  1261. * \param texture (optional) The SDL texture to use.
  1262. * \param xy Vertex positions
  1263. * \param xy_stride Byte size to move from one element to the next element
  1264. * \param color Vertex colors (as SDL_Color)
  1265. * \param color_stride Byte size to move from one element to the next element
  1266. * \param uv Vertex normalized texture coordinates
  1267. * \param uv_stride Byte size to move from one element to the next element
  1268. * \param num_vertices Number of vertices.
  1269. * \param indices (optional) An array of indices into the 'vertices' arrays,
  1270. * if NULL all vertices will be rendered in sequential order.
  1271. * \param num_indices Number of indices.
  1272. * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
  1273. * \returns 0 on success or a negative error code on failure; call
  1274. * SDL_GetError() for more information.
  1275. *
  1276. * \since This function is available since SDL 3.0.0.
  1277. *
  1278. * \sa SDL_RenderGeometry
  1279. * \sa SDL_Vertex
  1280. */
  1281. extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
  1282. SDL_Texture *texture,
  1283. const float *xy, int xy_stride,
  1284. const SDL_Color *color, int color_stride,
  1285. const float *uv, int uv_stride,
  1286. int num_vertices,
  1287. const void *indices, int num_indices, int size_indices);
  1288. /**
  1289. * Read pixels from the current rendering target to an array of pixels.
  1290. *
  1291. * **WARNING**: This is a very slow operation, and should not be used
  1292. * frequently. If you're using this on the main rendering target, it should be
  1293. * called after rendering and before SDL_RenderPresent().
  1294. *
  1295. * `pitch` specifies the number of bytes between rows in the destination
  1296. * `pixels` data. This allows you to write to a subrectangle or have padded
  1297. * rows in the destination. Generally, `pitch` should equal the number of
  1298. * pixels per row in the `pixels` data times the number of bytes per pixel,
  1299. * but it might contain additional padding (for example, 24bit RGB Windows
  1300. * Bitmap data pads all rows to multiples of 4 bytes).
  1301. *
  1302. * \param renderer the rendering context
  1303. * \param rect an SDL_Rect structure representing the area in pixels relative
  1304. * to the to current viewport, or NULL for the entire viewport
  1305. * \param format an SDL_PixelFormatEnum value of the desired format of the
  1306. * pixel data, or 0 to use the format of the rendering target
  1307. * \param pixels a pointer to the pixel data to copy into
  1308. * \param pitch the pitch of the `pixels` parameter
  1309. * \returns 0 on success or a negative error code on failure; call
  1310. * SDL_GetError() for more information.
  1311. *
  1312. * \since This function is available since SDL 3.0.0.
  1313. */
  1314. extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
  1315. const SDL_Rect *rect,
  1316. Uint32 format,
  1317. void *pixels, int pitch);
  1318. /**
  1319. * Update the screen with any rendering performed since the previous call.
  1320. *
  1321. * SDL's rendering functions operate on a backbuffer; that is, calling a
  1322. * rendering function such as SDL_RenderLine() does not directly put a line on
  1323. * the screen, but rather updates the backbuffer. As such, you compose your
  1324. * entire scene and *present* the composed backbuffer to the screen as a
  1325. * complete picture.
  1326. *
  1327. * Therefore, when using SDL's rendering API, one does all drawing intended
  1328. * for the frame, and then calls this function once per frame to present the
  1329. * final drawing to the user.
  1330. *
  1331. * The backbuffer should be considered invalidated after each present; do not
  1332. * assume that previous contents will exist between frames. You are strongly
  1333. * encouraged to call SDL_RenderClear() to initialize the backbuffer before
  1334. * starting each new frame's drawing, even if you plan to overwrite every
  1335. * pixel.
  1336. *
  1337. * \param renderer the rendering context
  1338. * \returns 0 on success or a negative error code on failure; call
  1339. * SDL_GetError() for more information.
  1340. *
  1341. * \threadsafety You may only call this function on the main thread.
  1342. *
  1343. * \since This function is available since SDL 3.0.0.
  1344. *
  1345. * \sa SDL_RenderClear
  1346. * \sa SDL_RenderLine
  1347. * \sa SDL_RenderLines
  1348. * \sa SDL_RenderPoint
  1349. * \sa SDL_RenderPoints
  1350. * \sa SDL_RenderRect
  1351. * \sa SDL_RenderRects
  1352. * \sa SDL_RenderFillRect
  1353. * \sa SDL_RenderFillRects
  1354. * \sa SDL_SetRenderDrawBlendMode
  1355. * \sa SDL_SetRenderDrawColor
  1356. */
  1357. extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
  1358. /**
  1359. * Destroy the specified texture.
  1360. *
  1361. * Passing NULL or an otherwise invalid texture will set the SDL error message
  1362. * to "Invalid texture".
  1363. *
  1364. * \param texture the texture to destroy
  1365. *
  1366. * \since This function is available since SDL 3.0.0.
  1367. *
  1368. * \sa SDL_CreateTexture
  1369. * \sa SDL_CreateTextureFromSurface
  1370. */
  1371. extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
  1372. /**
  1373. * Destroy the rendering context for a window and free associated textures.
  1374. *
  1375. * If `renderer` is NULL, this function will return immediately after setting
  1376. * the SDL error message to "Invalid renderer". See SDL_GetError().
  1377. *
  1378. * \param renderer the rendering context
  1379. *
  1380. * \since This function is available since SDL 3.0.0.
  1381. *
  1382. * \sa SDL_CreateRenderer
  1383. */
  1384. extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
  1385. /**
  1386. * Force the rendering context to flush any pending commands to the underlying
  1387. * rendering API.
  1388. *
  1389. * You do not need to (and in fact, shouldn't) call this function unless you
  1390. * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
  1391. * addition to using an SDL_Renderer.
  1392. *
  1393. * This is for a very-specific case: if you are using SDL's render API, you
  1394. * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
  1395. * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
  1396. * calls in addition to SDL render API calls. If all of this applies, you
  1397. * should call SDL_RenderFlush() between calls to SDL's render API and the
  1398. * low-level API you're using in cooperation.
  1399. *
  1400. * In all other cases, you can ignore this function. This is only here to get
  1401. * maximum performance out of a specific situation. In all other cases, SDL
  1402. * will do the right thing, perhaps at a performance loss.
  1403. *
  1404. * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
  1405. * and earlier, as earlier versions did not queue rendering commands at all,
  1406. * instead flushing them to the OS immediately.
  1407. *
  1408. * \param renderer the rendering context
  1409. * \returns 0 on success or a negative error code on failure; call
  1410. * SDL_GetError() for more information.
  1411. *
  1412. * \since This function is available since SDL 3.0.0.
  1413. */
  1414. extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
  1415. /**
  1416. * Bind an OpenGL/ES/ES2 texture to the current context.
  1417. *
  1418. * This is for use with OpenGL instructions when rendering OpenGL primitives
  1419. * directly.
  1420. *
  1421. * If not NULL, `texw` and `texh` will be filled with the width and height
  1422. * values suitable for the provided texture. In most cases, both will be 1.0,
  1423. * however, on systems that support the GL_ARB_texture_rectangle extension,
  1424. * these values will actually be the pixel width and height used to create the
  1425. * texture, so this factor needs to be taken into account when providing
  1426. * texture coordinates to OpenGL.
  1427. *
  1428. * You need a renderer to create an SDL_Texture, therefore you can only use
  1429. * this function with an implicit OpenGL context from SDL_CreateRenderer(),
  1430. * not with your own OpenGL context. If you need control over your OpenGL
  1431. * context, you need to write your own texture-loading methods.
  1432. *
  1433. * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
  1434. * re-order the color channels in the shaders phase, so the uploaded texture
  1435. * may have swapped color channels.
  1436. *
  1437. * \param texture the texture to bind to the current OpenGL/ES/ES2 context
  1438. * \param texw a pointer to a float value which will be filled with the
  1439. * texture width or NULL if you don't need that value
  1440. * \param texh a pointer to a float value which will be filled with the
  1441. * texture height or NULL if you don't need that value
  1442. * \returns 0 on success or a negative error code on failure; call
  1443. * SDL_GetError() for more information.
  1444. *
  1445. * \since This function is available since SDL 3.0.0.
  1446. *
  1447. * \sa SDL_GL_MakeCurrent
  1448. * \sa SDL_GL_UnbindTexture
  1449. */
  1450. extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
  1451. /**
  1452. * Unbind an OpenGL/ES/ES2 texture from the current context.
  1453. *
  1454. * See SDL_GL_BindTexture() for examples on how to use these functions
  1455. *
  1456. * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
  1457. * \returns 0 on success or a negative error code on failure; call
  1458. * SDL_GetError() for more information.
  1459. *
  1460. * \since This function is available since SDL 3.0.0.
  1461. *
  1462. * \sa SDL_GL_BindTexture
  1463. * \sa SDL_GL_MakeCurrent
  1464. */
  1465. extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
  1466. /**
  1467. * Get the CAMetalLayer associated with the given Metal renderer.
  1468. *
  1469. * This function returns `void *`, so SDL doesn't have to include Metal's
  1470. * headers, but it can be safely cast to a `CAMetalLayer *`.
  1471. *
  1472. * \param renderer The renderer to query
  1473. * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
  1474. * Metal renderer
  1475. *
  1476. * \since This function is available since SDL 3.0.0.
  1477. *
  1478. * \sa SDL_GetRenderMetalCommandEncoder
  1479. */
  1480. extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
  1481. /**
  1482. * Get the Metal command encoder for the current frame
  1483. *
  1484. * This function returns `void *`, so SDL doesn't have to include Metal's
  1485. * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
  1486. *
  1487. * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
  1488. * SDL a drawable to render to, which might happen if the window is
  1489. * hidden/minimized/offscreen. This doesn't apply to command encoders for
  1490. * render targets, just the window's backbacker. Check your return values!
  1491. *
  1492. * \param renderer The renderer to query
  1493. * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
  1494. * renderer isn't a Metal renderer or there was an error.
  1495. *
  1496. * \since This function is available since SDL 3.0.0.
  1497. *
  1498. * \sa SDL_GetRenderMetalLayer
  1499. */
  1500. extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
  1501. /**
  1502. * Toggle VSync of the given renderer.
  1503. *
  1504. * \param renderer The renderer to toggle
  1505. * \param vsync 1 for on, 0 for off. All other values are reserved
  1506. * \returns 0 on success or a negative error code on failure; call
  1507. * SDL_GetError() for more information.
  1508. *
  1509. * \since This function is available since SDL 3.0.0.
  1510. */
  1511. extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
  1512. /**
  1513. * Get VSync of the given renderer.
  1514. *
  1515. * \param renderer The renderer to toggle
  1516. * \param vsync an int filled with 1 for on, 0 for off. All other values are
  1517. * reserved
  1518. * \returns 0 on success or a negative error code on failure; call
  1519. * SDL_GetError() for more information.
  1520. *
  1521. * \since This function is available since SDL 3.0.0.
  1522. */
  1523. extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
  1524. /* Ends C function definitions when using C++ */
  1525. #ifdef __cplusplus
  1526. }
  1527. #endif
  1528. #include <SDL3/SDL_close_code.h>
  1529. #endif /* SDL_render_h_ */