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