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