sdlrenderer.inc 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. //from "sdl_renderer.h"
  2. {**
  3. * Flags used when creating a rendering context
  4. *}
  5. const
  6. SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *}
  7. SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware
  8. acceleration *}
  9. SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized
  10. with the refresh rate *}
  11. SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports
  12. rendering to texture *}
  13. type
  14. PPSDL_RendererFlags = ^PSDL_RendererFlags;
  15. PSDL_RendererFlags = ^TSDL_RendererFlags;
  16. TSDL_RendererFlags = Word;
  17. {**
  18. * Information on the capabilities of a render driver or context.
  19. *}
  20. PPSDL_RendererInfo = ^PSDL_RendererInfo;
  21. PSDL_RendererInfo = ^TSDL_RendererInfo;
  22. TSDL_RendererInfo = record
  23. name: PAnsiChar; {**< The name of the renderer *}
  24. flags: cuint32; {**< Supported ::SDL_RendererFlags *}
  25. num_texture_formats: cuint32; {**< The number of available texture formats *}
  26. texture_formats: array[0..15] of cuint32; {**< The available texture formats *}
  27. max_texture_width: cint32; {**< The maximimum texture width *}
  28. max_texture_height: cint32; {**< The maximimum texture height *}
  29. end;
  30. PPSDL_Vertex = ^PSDL_Vertex;
  31. PSDL_Vertex = ^TSDL_Vertex;
  32. TSDL_Vertex = record
  33. position: TSDL_FPoint;
  34. color: TSDL_Color;
  35. tex_coord: TSDL_FPoint;
  36. end;
  37. {**
  38. * The scaling mode for a texture.
  39. *}
  40. PPSDL_ScaleMode = ^PSDL_ScaleMode;
  41. PSDL_ScaleMode = ^TSDL_ScaleMode;
  42. TSDL_ScaleMode = type cint;
  43. const
  44. SDL_ScaleModeNearest = TSDL_ScaleMode(0); {**< nearest pixel sampling *}
  45. SDL_ScaleModeLinear = TSDL_ScaleMode(1); {**< linear filtering *}
  46. SDL_ScaleModeBest = TSDL_ScaleMode(2); {**< anisotropic filtering *}
  47. {**
  48. * The access pattern allowed for a texture.
  49. *}
  50. type
  51. PPSDL_TextureAccess = ^PSDL_TextureAccess;
  52. PSDL_TextureAccess = ^TSDL_TextureAccess;
  53. TSDL_TextureAccess = type cint;
  54. const
  55. SDL_TEXTUREACCESS_STATIC = 0; {**< Changes rarely, not lockable *}
  56. SDL_TEXTUREACCESS_STREAMING = 1; {**< Changes frequently, lockable *}
  57. SDL_TEXTUREACCESS_TARGET = 2; {**< Texture can be used as a render target *}
  58. type
  59. {**
  60. * The texture channel modulation used in SDL_RenderCopy().
  61. *}
  62. PPSDL_TextureModulate = ^PSDL_TextureModulate;
  63. PSDL_TextureModulate = ^TSDL_TextureModulate;
  64. TSDL_TextureModulate = type cint;
  65. const
  66. SDL_TEXTUREMODULATE_NONE = TSDL_TextureModulate(0); {**< No modulation *}
  67. SDL_TEXTUREMODULATE_COLOR = TSDL_TextureModulate(1); {**< srcC = srcC * color *}
  68. SDL_TEXTUREMODULATE_ALPHA = TSDL_TextureModulate(2); {**< srcA = srcA * alpha *}
  69. {**
  70. * Flip constants for SDL_RenderCopyEx
  71. *}
  72. const
  73. SDL_FLIP_NONE = $0; {**< Do not flip *}
  74. SDL_FLIP_HORIZONTAL = $1; {**< flip horizontally *}
  75. SDL_FLIP_VERTICAL = $2; {**< flip vertically *}
  76. type
  77. {**
  78. * A structure representing rendering state
  79. *}
  80. PPSDL_Renderer = ^PSDL_Renderer;
  81. PSDL_Renderer = ^TSDL_Renderer;
  82. TSDL_Renderer = record
  83. end;
  84. {**
  85. * An efficient driver-specific representation of pixel data
  86. *}
  87. PPSDL_Texture = ^PSDL_Texture;
  88. PSDL_Texture = ^TSDL_Texture;
  89. TSDL_Texture = record
  90. end;
  91. {* Function prototypes *}
  92. {**
  93. * Get the number of 2D rendering drivers available for the current
  94. * display.
  95. *
  96. * A render driver is a set of code that handles rendering and texture
  97. * management on a particular display. Normally there is only one, but
  98. * some drivers may have several available with different capabilities.
  99. *
  100. * SDL_GetRenderDriverInfo()
  101. * SDL_CreateRenderer()
  102. *}
  103. function SDL_GetNumRenderDrivers: cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF};
  104. {**
  105. * Get information about a specific 2D rendering driver for the current
  106. * display.
  107. *
  108. * index The index of the driver to query information about.
  109. * info A pointer to an SDL_RendererInfo struct to be filled with
  110. * information on the rendering driver.
  111. *
  112. * 0 on success, -1 if the index was out of range.
  113. *
  114. * SDL_CreateRenderer()
  115. *}
  116. function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF};
  117. {**
  118. * Create a window and default renderer
  119. *
  120. * width The width of the window
  121. * height The height of the window
  122. * window_flags The flags used to create the window
  123. * window A pointer filled with the window, or NULL on error
  124. * renderer A pointer filled with the renderer, or NULL on error
  125. *
  126. * 0 on success, or -1 on error
  127. *}
  128. function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF};
  129. {**
  130. * Create a 2D rendering context for a window.
  131. *
  132. * window The window where rendering is displayed.
  133. * index The index of the rendering driver to initialize, or -1 to
  134. * initialize the first one supporting the requested flags.
  135. * flags ::SDL_RendererFlags.
  136. *
  137. * A valid rendering context or NULL if there was an error.
  138. *
  139. * SDL_CreateSoftwareRenderer()
  140. * SDL_GetRendererInfo()
  141. * SDL_DestroyRenderer()
  142. *}
  143. function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF};
  144. {**
  145. * Create a 2D software rendering context for a surface.
  146. *
  147. * surface The surface where rendering is done.
  148. *
  149. * A valid rendering context or NULL if there was an error.
  150. *
  151. * SDL_CreateRenderer()
  152. * SDL_DestroyRenderer()
  153. *}
  154. function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF};
  155. {**
  156. * Get the renderer associated with a window.
  157. *}
  158. function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF};
  159. {**
  160. * Get the window associated with a renderer.
  161. *}
  162. function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl;
  163. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetWindow' {$ENDIF} {$ENDIF};
  164. {**
  165. * Get information about a rendering context.
  166. *}
  167. function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF};
  168. {**
  169. * Get the output size of a rendering context.
  170. *}
  171. function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF};
  172. {**
  173. * Create a texture for a rendering context.
  174. *
  175. * renderer The renderer.
  176. * format The format of the texture.
  177. * access One of the enumerated values in ::SDL_TextureAccess.
  178. * w The width of the texture in pixels.
  179. * h The height of the texture in pixels.
  180. *
  181. * The created texture is returned, or 0 if no rendering context was
  182. * active, the format was unsupported, or the width or height were out
  183. * of range.
  184. *
  185. * SDL_QueryTexture()
  186. * SDL_UpdateTexture()
  187. * SDL_DestroyTexture()
  188. *}
  189. function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF};
  190. {**
  191. * Create a texture from an existing surface.
  192. *
  193. * renderer The renderer.
  194. * surface The surface containing pixel data used to fill the texture.
  195. *
  196. * The created texture is returned, or 0 on error.
  197. *
  198. * The surface is not modified or freed by this function.
  199. *
  200. * SDL_QueryTexture()
  201. * SDL_DestroyTexture()
  202. *}
  203. function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF};
  204. {**
  205. * Query the attributes of a texture
  206. *
  207. * texture A texture to be queried.
  208. * format A pointer filled in with the raw format of the texture. The
  209. * actual format may differ, but pixel transfers will use this
  210. * format.
  211. * access A pointer filled in with the actual access to the texture.
  212. * w A pointer filled in with the width of the texture in pixels.
  213. * h A pointer filled in with the height of the texture in pixels.
  214. *
  215. * 0 on success, or -1 if the texture is not valid.
  216. *}
  217. function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF};
  218. {**
  219. * Set an additional color value used in render copy operations.
  220. *
  221. * texture The texture to update.
  222. * r The red color value multiplied into copy operations.
  223. * g The green color value multiplied into copy operations.
  224. * b The blue color value multiplied into copy operations.
  225. *
  226. * 0 on success, or -1 if the texture is not valid or color modulation
  227. * is not supported.
  228. *
  229. * SDL_GetTextureColorMod()
  230. *}
  231. function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF};
  232. {**
  233. * Get the additional color value used in render copy operations.
  234. *
  235. * texture The texture to query.
  236. * r A pointer filled in with the current red color value.
  237. * g A pointer filled in with the current green color value.
  238. * b A pointer filled in with the current blue color value.
  239. *
  240. * 0 on success, or -1 if the texture is not valid.
  241. *
  242. * SDL_SetTextureColorMod()
  243. *}
  244. function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF};
  245. {**
  246. * Set an additional alpha value used in render copy operations.
  247. *
  248. * texture The texture to update.
  249. * alpha The alpha value multiplied into copy operations.
  250. *
  251. * 0 on success, or -1 if the texture is not valid or alpha modulation
  252. * is not supported.
  253. *
  254. * SDL_GetTextureAlphaMod()
  255. *}
  256. function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF};
  257. {**
  258. * Get the additional alpha value used in render copy operations.
  259. *
  260. * texture The texture to query.
  261. * alpha A pointer filled in with the current alpha value.
  262. *
  263. * 0 on success, or -1 if the texture is not valid.
  264. *
  265. * SDL_SetTextureAlphaMod()
  266. *}
  267. function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF};
  268. {**
  269. * Set the blend mode used for texture copy operations.
  270. *
  271. * texture The texture to update.
  272. * blendMode ::SDL_BlendMode to use for texture blending.
  273. *
  274. * 0 on success, or -1 if the texture is not valid or the blend mode is
  275. * not supported.
  276. *
  277. * If the blend mode is not supported, the closest supported mode is
  278. * chosen.
  279. *
  280. * SDL_GetTextureBlendMode()
  281. *}
  282. function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF};
  283. {**
  284. * Get the blend mode used for texture copy operations.
  285. *
  286. * texture The texture to query.
  287. * blendMode A pointer filled in with the current blend mode.
  288. *
  289. * 0 on success, or -1 if the texture is not valid.
  290. *
  291. * SDL_SetTextureBlendMode()
  292. *}
  293. function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF};
  294. {**
  295. * Set the scale mode used for texture scale operations.
  296. * If the scale mode is not supported, the closest supported mode is chosen.
  297. *}
  298. function SDL_SetTextureScaleMode(texture: PSDL_Texture; scaleMode: TSDL_ScaleMode): cint; cdecl;
  299. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureScaleMode' {$ENDIF} {$ENDIF};
  300. {**
  301. * Get the scale mode used for texture scale operations.
  302. *}
  303. function SDL_GetTextureScaleMode(texture: PSDL_Texture; scaleMode: PSDL_ScaleMode): cint; cdecl;
  304. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureScaleMode' {$ENDIF} {$ENDIF};
  305. {**
  306. * Associate a user-specified pointer with a texture.
  307. *}
  308. function SDL_SetTextureUserData(texture: PSDL_Texture; userdata: Pointer): cint; cdecl;
  309. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureUserData' {$ENDIF} {$ENDIF};
  310. {**
  311. * Get the user-specified pointer associated with a texture.
  312. *}
  313. function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl;
  314. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureUserData' {$ENDIF} {$ENDIF};
  315. {**
  316. * Update the given texture rectangle with new pixel data.
  317. *
  318. * texture The texture to update
  319. * rect A pointer to the rectangle of pixels to update, or NULL to
  320. * update the entire texture.
  321. * pixels The raw pixel data.
  322. * pitch The number of bytes between rows of pixel data.
  323. *
  324. * 0 on success, or -1 if the texture is not valid.
  325. *
  326. * This is a fairly slow function.
  327. *}
  328. function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF};
  329. {**
  330. * Lock a portion of the texture for write-only pixel access.
  331. *
  332. * texture The texture to lock for access, which was created with
  333. * SDL_TEXTUREACCESS_STREAMING.
  334. * rect A pointer to the rectangle to lock for access. If the rect
  335. * is NULL, the entire texture will be locked.
  336. * pixels This is filled in with a pointer to the locked pixels,
  337. * appropriately offset by the locked area.
  338. * pitch This is filled in with the pitch of the locked pixels.
  339. *
  340. * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
  341. *
  342. * SDL_UnlockTexture()
  343. *}
  344. function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl;
  345. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF};
  346. {**
  347. * \brief Lock a portion of the texture for write-only pixel access.
  348. * Expose it as a SDL surface.
  349. *
  350. * \param texture The texture to lock for access, which was created with
  351. * ::SDL_TEXTUREACCESS_STREAMING.
  352. * \param rect A pointer to the rectangle to lock for access. If the rect
  353. * is NULL, the entire texture will be locked.
  354. * \param surface This is filled in with a SDL surface representing the locked area
  355. * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture.
  356. *
  357. * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
  358. *
  359. * \sa SDL_UnlockTexture()
  360. *}
  361. function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl;
  362. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTextureToSurface' {$ENDIF} {$ENDIF};
  363. {**
  364. * Unlock a texture, uploading the changes to video memory, if needed.
  365. *
  366. * SDL_LockTexture()
  367. *}
  368. procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF};
  369. {**
  370. * Determines whether a window supports the use of render targets
  371. *
  372. * renderer The renderer that will be checked
  373. *
  374. * SDL_TRUE if supported, SDL_FALSE if not.
  375. *}
  376. function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF};
  377. {**
  378. * Set a texture as the current rendering target.
  379. *
  380. * renderer The renderer.
  381. * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
  382. *
  383. * 0 on success, or -1 on error
  384. *
  385. * SDL_GetRenderTarget()
  386. *}
  387. function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF};
  388. {**
  389. * Get the current render target or NULL for the default render target.
  390. *
  391. * The current render target
  392. *
  393. * SDL_SetRenderTarget()
  394. *}
  395. function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF};
  396. {**
  397. * Set device independent resolution for rendering
  398. *
  399. * renderer The renderer for which resolution should be set.
  400. * w The width of the logical resolution
  401. * h The height of the logical resolution
  402. *
  403. * This function uses the viewport and scaling functionality to allow a fixed logical
  404. * resolution for rendering, regardless of the actual output resolution. If the actual
  405. * output resolution doesn't have the same aspect ratio the output rendering will be
  406. * centered within the output display.
  407. *
  408. * If the output display is a window, mouse events in the window will be filtered
  409. * and scaled so they seem to arrive within the logical resolution.
  410. *
  411. * If this function results in scaling or subpixel drawing by the
  412. * rendering backend, it will be handled using the appropriate
  413. * quality hints.
  414. *
  415. * SDL_RenderGetLogicalSize()
  416. * SDL_RenderSetScale()
  417. * SDL_RenderSetViewport()
  418. *}
  419. function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF};
  420. {**
  421. * Get device independent resolution for rendering
  422. *
  423. * renderer The renderer from which resolution should be queried.
  424. * w A pointer filled with the width of the logical resolution
  425. * h A pointer filled with the height of the logical resolution
  426. *
  427. * SDL_RenderSetLogicalSize()
  428. *}
  429. procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF};
  430. {**
  431. * \brief Set whether to force integer scales for resolution-independent rendering
  432. *
  433. * \param renderer The renderer for which integer scaling should be set.
  434. * \param enable Enable or disable integer scaling
  435. *
  436. * This function restricts the logical viewport to integer values - that is, when
  437. * a resolution is between two multiples of a logical size, the viewport size is
  438. * rounded down to the lower multiple.
  439. *
  440. * \sa SDL_RenderSetLogicalSize()
  441. *}
  442. function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF};
  443. {**
  444. * \brief Get whether integer scales are forced for resolution-independent rendering
  445. *
  446. * \param renderer The renderer from which integer scaling should be queried.
  447. *
  448. * \sa SDL_RenderSetIntegerScale()
  449. *}
  450. function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF};
  451. {**
  452. * Set the drawing area for rendering on the current target.
  453. *
  454. * renderer The renderer for which the drawing area should be set.
  455. * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
  456. *
  457. * The x,y of the viewport rect represents the origin for rendering.
  458. *
  459. * 0 on success, or -1 on error
  460. *
  461. * If the window associated with the renderer is resized, the viewport is automatically reset.
  462. *
  463. * SDL_RenderGetViewport()
  464. * SDL_RenderSetLogicalSize()
  465. *}
  466. function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF};
  467. {**
  468. * Get the drawing area for the current target.
  469. *
  470. * SDL_RenderSetViewport()
  471. *}
  472. procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF};
  473. {**
  474. * Set the clip rectangle for the current target.
  475. *
  476. * renderer The renderer for which clip rectangle should be set.
  477. * rect A pointer to the rectangle to set as the clip rectangle, or
  478. * NULL to disable clipping.
  479. *
  480. * 0 on success, or -1 on error
  481. *
  482. * SDL_RenderGetClipRect()
  483. *}
  484. function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF};
  485. {**
  486. * Get the clip rectangle for the current target.
  487. *
  488. * renderer The renderer from which clip rectangle should be queried.
  489. * rect A pointer filled in with the current clip rectangle, or
  490. * an empty rectangle if clipping is disabled.
  491. *
  492. * SDL_RenderSetClipRect()
  493. *}
  494. procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF};
  495. {**
  496. * \brief Get whether clipping is enabled on the given renderer.
  497. *
  498. * \param renderer The renderer from which clip state should be queried.
  499. *
  500. * \sa SDL_RenderGetClipRect()
  501. *}
  502. function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl;
  503. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderIsClipEnabled' {$ENDIF} {$ENDIF};
  504. {**
  505. * Set the drawing scale for rendering on the current target.
  506. *
  507. * renderer The renderer for which the drawing scale should be set.
  508. * scaleX The horizontal scaling factor
  509. * scaleY The vertical scaling factor
  510. *
  511. * The drawing coordinates are scaled by the x/y scaling factors
  512. * before they are used by the renderer. This allows resolution
  513. * independent drawing with a single coordinate system.
  514. *
  515. * If this results in scaling or subpixel drawing by the
  516. * rendering backend, it will be handled using the appropriate
  517. * quality hints. For best results use integer scaling factors.
  518. *
  519. * SDL_RenderGetScale()
  520. * SDL_RenderSetLogicalSize()
  521. *}
  522. function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF};
  523. {**
  524. * Get the drawing scale for the current target.
  525. *
  526. * renderer The renderer from which drawing scale should be queried.
  527. * scaleX A pointer filled in with the horizontal scaling factor
  528. * scaleY A pointer filled in with the vertical scaling factor
  529. *
  530. * SDL_RenderSetScale()
  531. *}
  532. procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF};
  533. {**
  534. * Get logical coordinates of point in renderer when given real coordinates of
  535. * point in window. Logical coordinates will differ from real coordinates when
  536. * render is scaled and logical renderer size set.
  537. *}
  538. procedure SDL_RenderWindowToLogical(renderer: PSDL_Renderer; windowX, windowY: cint; logicalX, logicalY: PSingle); cdecl;
  539. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderWindowToLogical' {$ENDIF} {$ENDIF};
  540. {**
  541. * Get real coordinates of point in window when given logical coordinates of
  542. * point in renderer. Logical coordinates will differ from real coordinate
  543. * when render is scaled and logical renderer size set.
  544. *}
  545. procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: Single; windowX, windowY: Pcint); cdecl;
  546. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderLogicalToWindow' {$ENDIF} {$ENDIF};
  547. {**
  548. * Set the color used for drawing operations (Rect, Line and Clear).
  549. *
  550. * renderer The renderer for which drawing color should be set.
  551. * r The red value used to draw on the rendering target.
  552. * g The green value used to draw on the rendering target.
  553. * b The blue value used to draw on the rendering target.
  554. * a The alpha value used to draw on the rendering target, usually
  555. * SDL_ALPHA_OPAQUE (255).
  556. *
  557. * 0 on success, or -1 on error
  558. *}
  559. function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF};
  560. {**
  561. * Get the color used for drawing operations (Rect, Line and Clear).
  562. *
  563. * renderer The renderer from which drawing color should be queried.
  564. * r A pointer to the red value used to draw on the rendering target.
  565. * g A pointer to the green value used to draw on the rendering target.
  566. * b A pointer to the blue value used to draw on the rendering target.
  567. * a A pointer to the alpha value used to draw on the rendering target,
  568. * usually SDL_ALPHA_OPAQUE (255).
  569. *
  570. * 0 on success, or -1 on error
  571. *}
  572. function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF};
  573. {**
  574. * Set the blend mode used for drawing operations (Fill and Line).
  575. *
  576. * renderer The renderer for which blend mode should be set.
  577. * blendMode SDL_BlendMode to use for blending.
  578. *
  579. * 0 on success, or -1 on error
  580. *
  581. * If the blend mode is not supported, the closest supported mode is
  582. * chosen.
  583. *
  584. * SDL_GetRenderDrawBlendMode()
  585. *}
  586. function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF};
  587. {**
  588. * Get the blend mode used for drawing operations.
  589. *
  590. * renderer The renderer from which blend mode should be queried.
  591. * blendMode A pointer filled in with the current blend mode.
  592. *
  593. * 0 on success, or -1 on error
  594. *
  595. * SDL_SetRenderDrawBlendMode()
  596. *}
  597. function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF};
  598. {**
  599. * Clear the current rendering target with the drawing color
  600. *
  601. * This function clears the entire rendering target, ignoring the viewport.
  602. *
  603. * 0 on success, or -1 on error
  604. *}
  605. function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF};
  606. {**
  607. * Draw a point on the current rendering target.
  608. *
  609. * renderer The renderer which should draw a point.
  610. * x The x coordinate of the point.
  611. * y The y coordinate of the point.
  612. *
  613. * 0 on success, or -1 on error
  614. *}
  615. function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF};
  616. {**
  617. * Draw a point on the current rendering target.
  618. *
  619. * renderer The renderer which should draw a point.
  620. * x The x coordinate of the point.
  621. * y The y coordinate of the point.
  622. *
  623. * 0 on success, or -1 on error
  624. *}
  625. function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl;
  626. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF};
  627. {**
  628. * Draw multiple points on the current rendering target.
  629. *
  630. * renderer The renderer which should draw multiple points.
  631. * points The points to draw
  632. * count The number of points to draw
  633. *
  634. * 0 on success, or -1 on error
  635. *}
  636. function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF};
  637. {**
  638. * Draw multiple points on the current rendering target.
  639. *
  640. * renderer The renderer which should draw multiple points.
  641. * points The points to draw
  642. * count The number of points to draw
  643. *
  644. * 0 on success, or -1 on error
  645. *}
  646. function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl;
  647. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF};
  648. {**
  649. * Draw a line on the current rendering target.
  650. *
  651. * renderer The renderer which should draw a line.
  652. * x1 The x coordinate of the start point.
  653. * y1 The y coordinate of the start point.
  654. * x2 The x coordinate of the end point.
  655. * y2 The y coordinate of the end point.
  656. *
  657. * 0 on success, or -1 on error
  658. *}
  659. function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF};
  660. {**
  661. * Draw a line on the current rendering target.
  662. *
  663. * renderer The renderer which should draw a line.
  664. * x1 The x coordinate of the start point.
  665. * y1 The y coordinate of the start point.
  666. * x2 The x coordinate of the end point.
  667. * y2 The y coordinate of the end point.
  668. *
  669. * 0 on success, or -1 on error
  670. *}
  671. function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl;
  672. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF};
  673. {**
  674. * \brief Draw a series of connected lines on the current rendering target.
  675. *
  676. * \param renderer The renderer which should draw multiple lines.
  677. * \param points The points along the lines
  678. * \param count The number of points, drawing count-1 lines
  679. *
  680. * \return 0 on success, or -1 on error
  681. *}
  682. function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF};
  683. {**
  684. * Draw a series of connected lines on the current rendering target.
  685. *
  686. * renderer The renderer which should draw multiple lines.
  687. * points The points along the lines
  688. * count The number of points, drawing count-1 lines
  689. *
  690. * 0 on success, or -1 on error
  691. *}
  692. function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl;
  693. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF};
  694. {**
  695. * Draw a rectangle on the current rendering target.
  696. *
  697. * renderer The renderer which should draw a rectangle.
  698. * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
  699. *
  700. * 0 on success, or -1 on error
  701. *}
  702. function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF};
  703. {**
  704. * Draw a rectangle on the current rendering target.
  705. *
  706. * renderer The renderer which should draw a rectangle.
  707. * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
  708. *
  709. * 0 on success, or -1 on error
  710. *}
  711. function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl;
  712. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF};
  713. {**
  714. * Draw some number of rectangles on the current rendering target.
  715. *
  716. * renderer The renderer which should draw multiple rectangles.
  717. * rects A pointer to an array of destination rectangles.
  718. * count The number of rectangles.
  719. *
  720. * 0 on success, or -1 on error
  721. *}
  722. function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF};
  723. {**
  724. * Draw some number of rectangles on the current rendering target.
  725. *
  726. * renderer The renderer which should draw multiple rectangles.
  727. * rects A pointer to an array of destination rectangles.
  728. * count The number of rectangles.
  729. *
  730. * 0 on success, or -1 on error
  731. *}
  732. function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl;
  733. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF};
  734. {**
  735. * Fill a rectangle on the current rendering target with the drawing color.
  736. *
  737. * renderer The renderer which should fill a rectangle.
  738. * rect A pointer to the destination rectangle, or NULL for the entire
  739. * rendering target.
  740. *
  741. * 0 on success, or -1 on error
  742. *}
  743. function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF};
  744. {**
  745. * Fill a rectangle on the current rendering target with the drawing color.
  746. *
  747. * renderer The renderer which should fill a rectangle.
  748. * rect A pointer to the destination rectangle, or NULL for the entire rendering target.
  749. *
  750. * 0 on success, or -1 on error
  751. *}
  752. function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl;
  753. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF};
  754. {**
  755. * Fill some number of rectangles on the current rendering target with the drawing color.
  756. *
  757. * renderer The renderer which should fill multiple rectangles.
  758. * rects A pointer to an array of destination rectangles.
  759. * count The number of rectangles.
  760. *
  761. * 0 on success, or -1 on error
  762. *}
  763. function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF};
  764. {**
  765. * Fill some number of rectangles on the current rendering target with the drawing color.
  766. *
  767. * renderer The renderer which should fill multiple rectangles.
  768. * rects A pointer to an array of destination rectangles.
  769. * count The number of rectangles.
  770. *
  771. * 0 on success, or -1 on error
  772. *}
  773. function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl;
  774. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF};
  775. {**
  776. * Copy a portion of the texture to the current rendering target.
  777. *
  778. * renderer The renderer which should copy parts of a texture.
  779. * texture The source texture.
  780. * srcrect A pointer to the source rectangle, or NULL for the entire
  781. * texture.
  782. * dstrect A pointer to the destination rectangle, or NULL for the
  783. * entire rendering target.
  784. *
  785. * 0 on success, or -1 on error
  786. *}
  787. function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF};
  788. {**
  789. * Copy a portion of the texture to the current rendering target.
  790. *
  791. * renderer The renderer which should copy parts of a texture.
  792. * texture The source texture.
  793. * srcrect A pointer to the source rectangle, or NIL for the entire texture.
  794. * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target.
  795. *
  796. * 0 on success, or -1 on error
  797. *}
  798. function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl;
  799. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF};
  800. {**
  801. * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
  802. *
  803. * renderer The renderer which should copy parts of a texture.
  804. * texture The source texture.
  805. * srcrect A pointer to the source rectangle, or NULL for the entire
  806. * texture.
  807. * dstrect A pointer to the destination rectangle, or NULL for the
  808. * entire rendering target.
  809. * angle An angle in degrees that indicates the rotation that will be applied to dstrect
  810. * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2)
  811. * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  812. *
  813. * 0 on success, or -1 on error
  814. *}
  815. function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: Double; center: PSDL_Point; flip: cint): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF};
  816. {**
  817. * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
  818. *
  819. * renderer The renderer which should copy parts of a texture.
  820. * texture The source texture.
  821. * srcrect A pointer to the source rectangle, or NIL for the entire texture.
  822. * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target.
  823. * angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
  824. * center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2).
  825. * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
  826. *
  827. * 0 on success, or -1 on error
  828. *}
  829. function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: Double; center: PSDL_FPoint; flip: cint): cint32 cdecl;
  830. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF};
  831. {**
  832. * Render a list of triangles, optionally using a texture and indices into the
  833. * vertex array. Color and alpha modulation is done per vertex.
  834. * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored.
  835. *}
  836. function SDL_RenderGeometry(
  837. renderer: PSDL_Renderer;
  838. texture: PSDL_Texture;
  839. Const vertices: PSDL_Vertex; num_vertices: cint;
  840. Const indices: Pcint; num_indices: cint
  841. ): cint; cdecl;
  842. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometry' {$ENDIF} {$ENDIF};
  843. {**
  844. * Render a list of triangles, optionally using a texture and indices into the
  845. * vertex arrays. Color and alpha modulation is done per vertex.
  846. * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored.
  847. *}
  848. function SDL_RenderGeometryRaw(
  849. renderer: PSDL_Renderer;
  850. texture: PSDL_Texture;
  851. Const xy: PSingle; xy_stride: cint;
  852. Const color: PSDL_Color; color_stride: cint;
  853. Const uv: PSingle; uv_stride: cint;
  854. num_vertices: cint;
  855. Const indices: Pointer; num_indices, size_indices: cint
  856. ): cint; cdecl;
  857. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometryRaw' {$ENDIF} {$ENDIF};
  858. {**
  859. * Read pixels from the current rendering target.
  860. *
  861. * renderer The renderer from which pixels should be read.
  862. * rect A pointer to the rectangle to read, or NULL for the entire
  863. * render target.
  864. * format The desired format of the pixel data, or 0 to use the format
  865. * of the rendering target
  866. * pixels A pointer to be filled in with the pixel data
  867. * pitch The pitch of the pixels parameter.
  868. *
  869. * 0 on success, or -1 if pixel reading is not supported.
  870. *
  871. * This is a very slow operation, and should not be used frequently.
  872. *}
  873. function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF};
  874. {**
  875. * Update the screen with rendering performed.
  876. *}
  877. procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF};
  878. {**
  879. * Destroy the specified texture.
  880. *
  881. * SDL_CreateTexture()
  882. * SDL_CreateTextureFromSurface()
  883. *}
  884. procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF};
  885. {**
  886. * Destroy the rendering context for a window and free associated
  887. * textures.
  888. *
  889. * SDL_CreateRenderer()
  890. *}
  891. procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF};
  892. {**
  893. * Force the rendering context to flush any pending commands to the underlying
  894. * rendering API.
  895. *
  896. * You do not need to (and in fact, shouldn't) call this function unless you
  897. * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
  898. * addition to using an SDL_Renderer.
  899. *
  900. * This is for a very-specific case: if you are using SDL's render API, you
  901. * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
  902. * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
  903. * calls in addition to SDL render API calls. If all of this applies, you
  904. * should call SDL_RenderFlush() between calls to SDL's render API and the
  905. * low-level API you're using in cooperation.
  906. *
  907. * In all other cases, you can ignore this function. This is only here to get
  908. * maximum performance out of a specific situation. In all other cases, SDL
  909. * will do the right thing, perhaps at a performance loss.
  910. *
  911. * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
  912. * and earlier, as earlier versions did not queue rendering commands at all,
  913. * instead flushing them to the OS immediately.
  914. *}
  915. function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl;
  916. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFlush' {$ENDIF} {$ENDIF};
  917. {**
  918. * Bind the texture to the current OpenGL/ES/ES2 context for use with
  919. * OpenGL instructions.
  920. *
  921. * texture The SDL texture to bind
  922. * texw A pointer to a float that will be filled with the texture width
  923. * texh A pointer to a float that will be filled with the texture height
  924. *
  925. * 0 on success, or -1 if the operation is not supported
  926. *}
  927. function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF};
  928. {**
  929. * Unbind a texture from the current OpenGL/ES/ES2 context.
  930. *
  931. * texture The SDL texture to unbind
  932. *
  933. * 0 on success, or -1 if the operation is not supported
  934. *}
  935. function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF};
  936. {**
  937. * Get the CAMetalLayer associated with the given Metal renderer.
  938. *
  939. * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers,
  940. * but it can be safely cast to a pointer to `CAMetalLayer`.
  941. *
  942. *}
  943. function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl;
  944. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF};
  945. {**
  946. * Get the Metal command encoder for the current frame
  947. *
  948. * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers,
  949. * but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
  950. *
  951. * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
  952. * SDL a drawable to render to, which might happen if the window is
  953. * hidden/minimized/offscreen. This doesn't apply to command encoders for
  954. * render targets, just the window's backbacker. Check your return values!
  955. *}
  956. function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl;
  957. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF};
  958. {**
  959. * Toggle VSync of the given renderer.
  960. *}
  961. function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl;
  962. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF};
  963. {**
  964. * Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
  965. *
  966. * texture The texture to update
  967. * rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture.
  968. * Yplane The raw pixel data for the Y plane.
  969. * Ypitch The number of bytes between rows of pixel data for the Y plane.
  970. * Uplane The raw pixel data for the U plane.
  971. * Upitch The number of bytes between rows of pixel data for the U plane.
  972. * Vplane The raw pixel data for the V plane.
  973. * Vpitch The number of bytes between rows of pixel data for the V plane.
  974. *
  975. * 0 on success, or -1 if the texture is not valid.
  976. *
  977. * You can use SDL_UpdateTexture() as long as your pixel data is
  978. * a contiguous block of Y and U/V planes in the proper order, but
  979. * this function is available if your pixel data is not contiguous.
  980. *}
  981. function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32;
  982. cdecl; external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF};
  983. {**
  984. * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
  985. *
  986. * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
  987. * block of NV12/21 planes in the proper order, but this function is available
  988. * if your pixel data is not contiguous.
  989. *}
  990. function SDL_UpdateNVTexture(
  991. texture: PSDL_Texture;
  992. Const rect: PSDL_Rect;
  993. Const Yplane: Pcuint8; Ypitch: cint;
  994. Const UVplane: Pcuint8; UVpitch: cint
  995. ): cint; cdecl;
  996. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF};