SDL_render.h 63 KB

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