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 * The default render target is the window for which the renderer was created.
782 * To stop rendering to a texture and render to the window again, call this
783 * function with a NULL `texture`.
784 *
785 * \param renderer the rendering context
786 * \param texture the targeted texture, which must be created with the
787 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
788 * window instead of a texture.
789 * \returns 0 on success or a negative error code on failure; call
790 * SDL_GetError() for more information.
791 *
792 * \since This function is available since SDL 3.0.0.
793 *
794 * \sa SDL_GetRenderTarget
795 */
796extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
797
798/**
799 * Get the current render target.
800 *
801 * The default render target is the window for which the renderer was created,
802 * and is reported a NULL here.
803 *
804 * \param renderer the rendering context
805 * \returns the current render target or NULL for the default render target.
806 *
807 * \since This function is available since SDL 3.0.0.
808 *
809 * \sa SDL_SetRenderTarget
810 */
811extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
812
813/**
814 * Set a device independent resolution and presentation mode for rendering.
815 *
816 * This function sets the width and height of the logical rendering output. A
817 * render target is created at the specified size and used for rendering and
818 * then copied to the output during presentation.
819 *
820 * You can disable logical coordinates by setting the mode to
821 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
822 * resolution of the output window.
823 *
824 * You can convert coordinates in an event into rendering coordinates using
825 * SDL_ConvertEventToRenderCoordinates().
826 *
827 * \param renderer the rendering context
828 * \param w the width of the logical resolution
829 * \param h the height of the logical resolution
830 * \param mode the presentation mode used
831 * \param scale_mode the scale mode used
832 * \returns 0 on success or a negative error code on failure; call
833 * SDL_GetError() for more information.
834 *
835 * \since This function is available since SDL 3.0.0.
836 *
837 * \sa SDL_ConvertEventToRenderCoordinates
838 * \sa SDL_GetRenderLogicalPresentation
839 */
840extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
841
842/**
843 * Get device independent resolution and presentation mode for rendering.
844 *
845 * This function gets the width and height of the logical rendering output, or
846 * the output size in pixels if a logical resolution is not enabled.
847 *
848 * \param renderer the rendering context
849 * \param w an int to be filled with the width
850 * \param h an int to be filled with the height
851 * \param mode a pointer filled in with the presentation mode
852 * \param scale_mode a pointer filled in with the scale mode
853 * \returns 0 on success or a negative error code on failure; call
854 * SDL_GetError() for more information.
855 *
856 * \since This function is available since SDL 3.0.0.
857 *
858 * \sa SDL_SetRenderLogicalPresentation
859 */
860extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
861
862/**
863 * Get a point in render coordinates when given a point in window coordinates.
864 *
865 * \param renderer the rendering context
866 * \param window_x the x coordinate in window coordinates
867 * \param window_y the y coordinate in window coordinates
868 * \param x a pointer filled with the x coordinate in render coordinates
869 * \param y a pointer filled with the y coordinate in render coordinates
870 * \returns 0 on success or a negative error code on failure; call
871 * SDL_GetError() for more information.
872 *
873 * \since This function is available since SDL 3.0.0.
874 *
875 * \sa SDL_SetRenderLogicalPresentation
876 * \sa SDL_SetRenderScale
877 */
878extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
879
880/**
881 * Get a point in window coordinates when given a point in render coordinates.
882 *
883 * \param renderer the rendering context
884 * \param x the x coordinate in render coordinates
885 * \param y the y coordinate in render coordinates
886 * \param window_x a pointer filled with the x coordinate in window
887 * coordinates
888 * \param window_y a pointer filled with the y coordinate in window
889 * coordinates
890 * \returns 0 on success or a negative error code on failure; call
891 * SDL_GetError() for more information.
892 *
893 * \since This function is available since SDL 3.0.0.
894 *
895 * \sa SDL_SetRenderLogicalPresentation
896 * \sa SDL_SetRenderScale
897 */
898extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
899
900/**
901 * Convert the coordinates in an event to render coordinates.
902 *
903 * Touch coordinates are converted from normalized coordinates in the window
904 * to non-normalized rendering coordinates.
905 *
906 * Once converted, the coordinates may be outside the rendering area.
907 *
908 * \param renderer the rendering context
909 * \param event the event to modify
910 * \returns 0 on success or a negative error code on failure; call
911 * SDL_GetError() for more information.
912 *
913 * \since This function is available since SDL 3.0.0.
914 *
915 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
916 */
917extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
918
919/**
920 * Set the drawing area for rendering on the current target.
921 *
922 * \param renderer the rendering context
923 * \param rect the SDL_Rect structure representing the drawing area, or NULL
924 * to set the viewport to the entire target
925 * \returns 0 on success or a negative error code on failure; call
926 * SDL_GetError() for more information.
927 *
928 * \since This function is available since SDL 3.0.0.
929 *
930 * \sa SDL_GetRenderViewport
931 */
932extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
933
934/**
935 * Get the drawing area for the current target.
936 *
937 * \param renderer the rendering context
938 * \param rect an SDL_Rect structure filled in with the current drawing area
939 * \returns 0 on success or a negative error code on failure; call
940 * SDL_GetError() for more information.
941 *
942 * \since This function is available since SDL 3.0.0.
943 *
944 * \sa SDL_SetRenderViewport
945 */
946extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
947
948/**
949 * Set the clip rectangle for rendering on the specified target.
950 *
951 * \param renderer the rendering context
952 * \param rect an SDL_Rect structure representing the clip area, relative to
953 * the viewport, or NULL to disable clipping
954 * \returns 0 on success or a negative error code on failure; call
955 * SDL_GetError() for more information.
956 *
957 * \since This function is available since SDL 3.0.0.
958 *
959 * \sa SDL_GetRenderClipRect
960 * \sa SDL_RenderClipEnabled
961 */
962extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
963
964/**
965 * Get the clip rectangle for the current target.
966 *
967 * \param renderer the rendering context
968 * \param rect an SDL_Rect structure filled in with the current clipping area
969 * or an empty rectangle if clipping is disabled
970 * \returns 0 on success or a negative error code on failure; call
971 * SDL_GetError() for more information.
972 *
973 * \since This function is available since SDL 3.0.0.
974 *
975 * \sa SDL_RenderClipEnabled
976 * \sa SDL_SetRenderClipRect
977 */
978extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
979
980/**
981 * Get whether clipping is enabled on the given renderer.
982 *
983 * \param renderer the rendering context
984 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
985 * SDL_GetError() for more information.
986 *
987 * \since This function is available since SDL 3.0.0.
988 *
989 * \sa SDL_GetRenderClipRect
990 * \sa SDL_SetRenderClipRect
991 */
992extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
993
994/**
995 * Set the drawing scale for rendering on the current target.
996 *
997 * The drawing coordinates are scaled by the x/y scaling factors before they
998 * are used by the renderer. This allows resolution independent drawing with a
999 * single coordinate system.
1000 *
1001 * If this results in scaling or subpixel drawing by the rendering backend, it
1002 * will be handled using the appropriate quality hints. For best results use
1003 * integer scaling factors.
1004 *
1005 * \param renderer the rendering context
1006 * \param scaleX the horizontal scaling factor
1007 * \param scaleY the vertical scaling factor
1008 * \returns 0 on success or a negative error code on failure; call
1009 * SDL_GetError() for more information.
1010 *
1011 * \since This function is available since SDL 3.0.0.
1012 *
1013 * \sa SDL_GetRenderScale
1014 */
1015extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1016
1017/**
1018 * Get the drawing scale for the current target.
1019 *
1020 * \param renderer the rendering context
1021 * \param scaleX a pointer filled in with the horizontal scaling factor
1022 * \param scaleY a pointer filled in with the vertical scaling factor
1023 * \returns 0 on success or a negative error code on failure; call
1024 * SDL_GetError() for more information.
1025 *
1026 * \since This function is available since SDL 3.0.0.
1027 *
1028 * \sa SDL_SetRenderScale
1029 */
1030extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1031
1032/**
1033 * Set the color used for drawing operations (Rect, Line and Clear).
1034 *
1035 * Set the color for drawing or filling rectangles, lines, and points, and for
1036 * SDL_RenderClear().
1037 *
1038 * \param renderer the rendering context
1039 * \param r the red value used to draw on the rendering target
1040 * \param g the green value used to draw on the rendering target
1041 * \param b the blue value used to draw on the rendering target
1042 * \param a the alpha value used to draw on the rendering target; usually
1043 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1044 * specify how the alpha channel is used
1045 * \returns 0 on success or a negative error code on failure; call
1046 * SDL_GetError() for more information.
1047 *
1048 * \since This function is available since SDL 3.0.0.
1049 *
1050 * \sa SDL_GetRenderDrawColor
1051 * \sa SDL_RenderClear
1052 * \sa SDL_RenderLine
1053 * \sa SDL_RenderLines
1054 * \sa SDL_RenderPoint
1055 * \sa SDL_RenderPoints
1056 * \sa SDL_RenderRect
1057 * \sa SDL_RenderRects
1058 * \sa SDL_RenderFillRect
1059 * \sa SDL_RenderFillRects
1060 */
1061extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1062
1063/**
1064 * Get the color used for drawing operations (Rect, Line and Clear).
1065 *
1066 * \param renderer the rendering context
1067 * \param r a pointer filled in with the red value used to draw on the
1068 * rendering target
1069 * \param g a pointer filled in with the green value used to draw on the
1070 * rendering target
1071 * \param b a pointer filled in with the blue value used to draw on the
1072 * rendering target
1073 * \param a a pointer filled in with the alpha value used to draw on the
1074 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1075 * \returns 0 on success or a negative error code on failure; call
1076 * SDL_GetError() for more information.
1077 *
1078 * \since This function is available since SDL 3.0.0.
1079 *
1080 * \sa SDL_SetRenderDrawColor
1081 */
1082extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1083
1084/**
1085 * Set the blend mode used for drawing operations (Fill and Line).
1086 *
1087 * If the blend mode is not supported, the closest supported mode is chosen.
1088 *
1089 * \param renderer the rendering context
1090 * \param blendMode the SDL_BlendMode to use for blending
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 3.0.0.
1095 *
1096 * \sa SDL_GetRenderDrawBlendMode
1097 * \sa SDL_RenderLine
1098 * \sa SDL_RenderLines
1099 * \sa SDL_RenderPoint
1100 * \sa SDL_RenderPoints
1101 * \sa SDL_RenderRect
1102 * \sa SDL_RenderRects
1103 * \sa SDL_RenderFillRect
1104 * \sa SDL_RenderFillRects
1105 */
1106extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1107
1108/**
1109 * Get the blend mode used for drawing operations.
1110 *
1111 * \param renderer the rendering context
1112 * \param blendMode a pointer filled in with the current SDL_BlendMode
1113 * \returns 0 on success or a negative error code on failure; call
1114 * SDL_GetError() for more information.
1115 *
1116 * \since This function is available since SDL 3.0.0.
1117 *
1118 * \sa SDL_SetRenderDrawBlendMode
1119 */
1120extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1121
1122/**
1123 * Clear the current rendering target with the drawing color.
1124 *
1125 * This function clears the entire rendering target, ignoring the viewport and
1126 * the clip rectangle.
1127 *
1128 * \param renderer the rendering context
1129 * \returns 0 on success or a negative error code on failure; call
1130 * SDL_GetError() for more information.
1131 *
1132 * \since This function is available since SDL 3.0.0.
1133 *
1134 * \sa SDL_SetRenderDrawColor
1135 */
1136extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1137
1138/**
1139 * Draw a point on the current rendering target at subpixel precision.
1140 *
1141 * \param renderer The renderer which should draw a point.
1142 * \param x The x coordinate of the point.
1143 * \param y The y coordinate of the point.
1144 * \returns 0 on success, or -1 on error
1145 *
1146 * \since This function is available since SDL 3.0.0.
1147 */
1148extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1149
1150/**
1151 * Draw multiple points on the current rendering target at subpixel precision.
1152 *
1153 * \param renderer The renderer which should draw multiple points.
1154 * \param points The points to draw
1155 * \param count The number of points to draw
1156 * \returns 0 on success or a negative error code on failure; call
1157 * SDL_GetError() for more information.
1158 *
1159 * \since This function is available since SDL 3.0.0.
1160 */
1161extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1162
1163/**
1164 * Draw a line on the current rendering target at subpixel precision.
1165 *
1166 * \param renderer The renderer which should draw a line.
1167 * \param x1 The x coordinate of the start point.
1168 * \param y1 The y coordinate of the start point.
1169 * \param x2 The x coordinate of the end point.
1170 * \param y2 The y coordinate of the end point.
1171 * \returns 0 on success, or -1 on error
1172 *
1173 * \since This function is available since SDL 3.0.0.
1174 */
1175extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1176
1177/**
1178 * Draw a series of connected lines on the current rendering target at
1179 * subpixel precision.
1180 *
1181 * \param renderer The renderer which should draw multiple lines.
1182 * \param points The points along the lines
1183 * \param count The number of points, drawing count-1 lines
1184 * \returns 0 on success or a negative error code on failure; call
1185 * SDL_GetError() for more information.
1186 *
1187 * \since This function is available since SDL 3.0.0.
1188 */
1189extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1190
1191/**
1192 * Draw a rectangle on the current rendering target at subpixel precision.
1193 *
1194 * \param renderer The renderer which should draw a rectangle.
1195 * \param rect A pointer to the destination rectangle, or NULL to outline the
1196 * entire rendering target.
1197 * \returns 0 on success, or -1 on error
1198 *
1199 * \since This function is available since SDL 3.0.0.
1200 */
1201extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1202
1203/**
1204 * Draw some number of rectangles on the current rendering target at subpixel
1205 * precision.
1206 *
1207 * \param renderer The renderer which should draw multiple rectangles.
1208 * \param rects A pointer to an array of destination rectangles.
1209 * \param count The number of rectangles.
1210 * \returns 0 on success or a negative error code on failure; call
1211 * SDL_GetError() for more information.
1212 *
1213 * \since This function is available since SDL 3.0.0.
1214 */
1215extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1216
1217/**
1218 * Fill a rectangle on the current rendering target with the drawing color at
1219 * subpixel precision.
1220 *
1221 * \param renderer The renderer which should fill a rectangle.
1222 * \param rect A pointer to the destination rectangle, or NULL for the entire
1223 * rendering target.
1224 * \returns 0 on success, or -1 on error
1225 *
1226 * \since This function is available since SDL 3.0.0.
1227 */
1228extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1229
1230/**
1231 * Fill some number of rectangles on the current rendering target with the
1232 * drawing color at subpixel precision.
1233 *
1234 * \param renderer The renderer which should fill multiple rectangles.
1235 * \param rects A pointer to an array of destination rectangles.
1236 * \param count The number of rectangles.
1237 * \returns 0 on success or a negative error code on failure; call
1238 * SDL_GetError() for more information.
1239 *
1240 * \since This function is available since SDL 3.0.0.
1241 */
1242extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1243
1244/**
1245 * Copy a portion of the texture to the current rendering target at subpixel
1246 * precision.
1247 *
1248 * \param renderer The renderer which should copy parts of a texture.
1249 * \param texture The source texture.
1250 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1251 * texture.
1252 * \param dstrect A pointer to the destination rectangle, or NULL for the
1253 * entire rendering target.
1254 * \returns 0 on success, or -1 on error
1255 *
1256 * \since This function is available since SDL 3.0.0.
1257 */
1258extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
1259
1260/**
1261 * Copy a portion of the source texture to the current rendering target, with
1262 * rotation and flipping, at subpixel precision.
1263 *
1264 * \param renderer The renderer which should copy parts of a texture.
1265 * \param texture The source texture.
1266 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1267 * texture.
1268 * \param dstrect A pointer to the destination rectangle, or NULL for the
1269 * entire rendering target.
1270 * \param angle An angle in degrees that indicates the rotation that will be
1271 * applied to dstrect, rotating it in a clockwise direction
1272 * \param center A pointer to a point indicating the point around which
1273 * dstrect will be rotated (if NULL, rotation will be done
1274 * around dstrect.w/2, dstrect.h/2).
1275 * \param flip An SDL_RendererFlip value stating which flipping actions should
1276 * be performed on the texture
1277 * \returns 0 on success or a negative error code on failure; call
1278 * SDL_GetError() for more information.
1279 *
1280 * \since This function is available since SDL 3.0.0.
1281 */
1282extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
1283 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
1284 const double angle, const SDL_FPoint *center,
1285 const SDL_RendererFlip flip);
1286
1287/**
1288 * Render a list of triangles, optionally using a texture and indices into the
1289 * vertex array Color and alpha modulation is done per vertex
1290 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1291 *
1292 * \param renderer The rendering context.
1293 * \param texture (optional) The SDL texture to use.
1294 * \param vertices Vertices.
1295 * \param num_vertices Number of vertices.
1296 * \param indices (optional) An array of integer indices into the 'vertices'
1297 * array, if NULL all vertices will be rendered in sequential
1298 * order.
1299 * \param num_indices Number of indices.
1300 * \returns 0 on success, or -1 if the operation is not supported
1301 *
1302 * \since This function is available since SDL 3.0.0.
1303 *
1304 * \sa SDL_RenderGeometryRaw
1305 * \sa SDL_Vertex
1306 */
1307extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1308 SDL_Texture *texture,
1309 const SDL_Vertex *vertices, int num_vertices,
1310 const int *indices, int num_indices);
1311
1312/**
1313 * Render a list of triangles, optionally using a texture and indices into the
1314 * vertex arrays Color and alpha modulation is done per vertex
1315 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1316 *
1317 * \param renderer The rendering context.
1318 * \param texture (optional) The SDL texture to use.
1319 * \param xy Vertex positions
1320 * \param xy_stride Byte size to move from one element to the next element
1321 * \param color Vertex colors (as SDL_Color)
1322 * \param color_stride Byte size to move from one element to the next element
1323 * \param uv Vertex normalized texture coordinates
1324 * \param uv_stride Byte size to move from one element to the next element
1325 * \param num_vertices Number of vertices.
1326 * \param indices (optional) An array of indices into the 'vertices' arrays,
1327 * if NULL all vertices will be rendered in sequential order.
1328 * \param num_indices Number of indices.
1329 * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
1330 * \returns 0 on success or a negative error code on failure; call
1331 * SDL_GetError() for more information.
1332 *
1333 * \since This function is available since SDL 3.0.0.
1334 *
1335 * \sa SDL_RenderGeometry
1336 * \sa SDL_Vertex
1337 */
1338extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1339 SDL_Texture *texture,
1340 const float *xy, int xy_stride,
1341 const SDL_Color *color, int color_stride,
1342 const float *uv, int uv_stride,
1343 int num_vertices,
1344 const void *indices, int num_indices, int size_indices);
1345
1346/**
1347 * Read pixels from the current rendering target to an array of pixels.
1348 *
1349 * **WARNING**: This is a very slow operation, and should not be used
1350 * frequently. If you're using this on the main rendering target, it should be
1351 * called after rendering and before SDL_RenderPresent().
1352 *
1353 * `pitch` specifies the number of bytes between rows in the destination
1354 * `pixels` data. This allows you to write to a subrectangle or have padded
1355 * rows in the destination. Generally, `pitch` should equal the number of
1356 * pixels per row in the `pixels` data times the number of bytes per pixel,
1357 * but it might contain additional padding (for example, 24bit RGB Windows
1358 * Bitmap data pads all rows to multiples of 4 bytes).
1359 *
1360 * \param renderer the rendering context
1361 * \param rect an SDL_Rect structure representing the area in pixels relative
1362 * to the to current viewport, or NULL for the entire viewport
1363 * \param format an SDL_PixelFormatEnum value of the desired format of the
1364 * pixel data, or 0 to use the format of the rendering target
1365 * \param pixels a pointer to the pixel data to copy into
1366 * \param pitch the pitch of the `pixels` parameter
1367 * \returns 0 on success or a negative error code on failure; call
1368 * SDL_GetError() for more information.
1369 *
1370 * \since This function is available since SDL 3.0.0.
1371 */
1372extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1373 const SDL_Rect *rect,
1374 Uint32 format,
1375 void *pixels, int pitch);
1376
1377/**
1378 * Update the screen with any rendering performed since the previous call.
1379 *
1380 * SDL's rendering functions operate on a backbuffer; that is, calling a
1381 * rendering function such as SDL_RenderLine() does not directly put a line on
1382 * the screen, but rather updates the backbuffer. As such, you compose your
1383 * entire scene and *present* the composed backbuffer to the screen as a
1384 * complete picture.
1385 *
1386 * Therefore, when using SDL's rendering API, one does all drawing intended
1387 * for the frame, and then calls this function once per frame to present the
1388 * final drawing to the user.
1389 *
1390 * The backbuffer should be considered invalidated after each present; do not
1391 * assume that previous contents will exist between frames. You are strongly
1392 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1393 * starting each new frame's drawing, even if you plan to overwrite every
1394 * pixel.
1395 *
1396 * \param renderer the rendering context
1397 * \returns 0 on success or a negative error code on failure; call
1398 * SDL_GetError() for more information.
1399 *
1400 * \threadsafety You may only call this function on the main thread.
1401 *
1402 * \since This function is available since SDL 3.0.0.
1403 *
1404 * \sa SDL_RenderClear
1405 * \sa SDL_RenderLine
1406 * \sa SDL_RenderLines
1407 * \sa SDL_RenderPoint
1408 * \sa SDL_RenderPoints
1409 * \sa SDL_RenderRect
1410 * \sa SDL_RenderRects
1411 * \sa SDL_RenderFillRect
1412 * \sa SDL_RenderFillRects
1413 * \sa SDL_SetRenderDrawBlendMode
1414 * \sa SDL_SetRenderDrawColor
1415 */
1416extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1417
1418/**
1419 * Destroy the specified texture.
1420 *
1421 * Passing NULL or an otherwise invalid texture will set the SDL error message
1422 * to "Invalid texture".
1423 *
1424 * \param texture the texture to destroy
1425 *
1426 * \since This function is available since SDL 3.0.0.
1427 *
1428 * \sa SDL_CreateTexture
1429 * \sa SDL_CreateTextureFromSurface
1430 */
1431extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1432
1433/**
1434 * Destroy the rendering context for a window and free associated textures.
1435 *
1436 * If `renderer` is NULL, this function will return immediately after setting
1437 * the SDL error message to "Invalid renderer". See SDL_GetError().
1438 *
1439 * \param renderer the rendering context
1440 *
1441 * \since This function is available since SDL 3.0.0.
1442 *
1443 * \sa SDL_CreateRenderer
1444 */
1445extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1446
1447/**
1448 * Force the rendering context to flush any pending commands to the underlying
1449 * rendering API.
1450 *
1451 * You do not need to (and in fact, shouldn't) call this function unless you
1452 * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
1453 * addition to using an SDL_Renderer.
1454 *
1455 * This is for a very-specific case: if you are using SDL's render API, you
1456 * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
1457 * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
1458 * calls in addition to SDL render API calls. If all of this applies, you
1459 * should call SDL_RenderFlush() between calls to SDL's render API and the
1460 * low-level API you're using in cooperation.
1461 *
1462 * In all other cases, you can ignore this function. This is only here to get
1463 * maximum performance out of a specific situation. In all other cases, SDL
1464 * will do the right thing, perhaps at a performance loss.
1465 *
1466 * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
1467 * and earlier, as earlier versions did not queue rendering commands at all,
1468 * instead flushing them to the OS immediately.
1469 *
1470 * \param renderer the rendering context
1471 * \returns 0 on success or a negative error code on failure; call
1472 * SDL_GetError() for more information.
1473 *
1474 * \since This function is available since SDL 3.0.0.
1475 */
1476extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
1477
1478
1479/**
1480 * Bind an OpenGL/ES/ES2 texture to the current context.
1481 *
1482 * This is for use with OpenGL instructions when rendering OpenGL primitives
1483 * directly.
1484 *
1485 * If not NULL, `texw` and `texh` will be filled with the width and height
1486 * values suitable for the provided texture. In most cases, both will be 1.0,
1487 * however, on systems that support the GL_ARB_texture_rectangle extension,
1488 * these values will actually be the pixel width and height used to create the
1489 * texture, so this factor needs to be taken into account when providing
1490 * texture coordinates to OpenGL.
1491 *
1492 * You need a renderer to create an SDL_Texture, therefore you can only use
1493 * this function with an implicit OpenGL context from SDL_CreateRenderer(),
1494 * not with your own OpenGL context. If you need control over your OpenGL
1495 * context, you need to write your own texture-loading methods.
1496 *
1497 * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
1498 * re-order the color channels in the shaders phase, so the uploaded texture
1499 * may have swapped color channels.
1500 *
1501 * \param texture the texture to bind to the current OpenGL/ES/ES2 context
1502 * \param texw a pointer to a float value which will be filled with the
1503 * texture width or NULL if you don't need that value
1504 * \param texh a pointer to a float value which will be filled with the
1505 * texture height or NULL if you don't need that value
1506 * \returns 0 on success or a negative error code on failure; call
1507 * SDL_GetError() for more information.
1508 *
1509 * \since This function is available since SDL 3.0.0.
1510 *
1511 * \sa SDL_GL_MakeCurrent
1512 * \sa SDL_GL_UnbindTexture
1513 */
1514extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
1515
1516/**
1517 * Unbind an OpenGL/ES/ES2 texture from the current context.
1518 *
1519 * See SDL_GL_BindTexture() for examples on how to use these functions
1520 *
1521 * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
1522 * \returns 0 on success or a negative error code on failure; call
1523 * SDL_GetError() for more information.
1524 *
1525 * \since This function is available since SDL 3.0.0.
1526 *
1527 * \sa SDL_GL_BindTexture
1528 * \sa SDL_GL_MakeCurrent
1529 */
1530extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
1531
1532/**
1533 * Get the CAMetalLayer associated with the given Metal renderer.
1534 *
1535 * This function returns `void *`, so SDL doesn't have to include Metal's
1536 * headers, but it can be safely cast to a `CAMetalLayer *`.
1537 *
1538 * \param renderer The renderer to query
1539 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1540 * Metal renderer
1541 *
1542 * \since This function is available since SDL 3.0.0.
1543 *
1544 * \sa SDL_GetRenderMetalCommandEncoder
1545 */
1546extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1547
1548/**
1549 * Get the Metal command encoder for the current frame
1550 *
1551 * This function returns `void *`, so SDL doesn't have to include Metal's
1552 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1553 *
1554 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1555 * SDL a drawable to render to, which might happen if the window is
1556 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1557 * render targets, just the window's backbuffer. Check your return values!
1558 *
1559 * \param renderer The renderer to query
1560 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1561 * renderer isn't a Metal renderer or there was an error.
1562 *
1563 * \since This function is available since SDL 3.0.0.
1564 *
1565 * \sa SDL_GetRenderMetalLayer
1566 */
1567extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1568
1569/**
1570 * Toggle VSync of the given renderer.
1571 *
1572 * \param renderer The renderer to toggle
1573 * \param vsync 1 for on, 0 for off. All other values are reserved
1574 * \returns 0 on success or a negative error code on failure; call
1575 * SDL_GetError() for more information.
1576 *
1577 * \since This function is available since SDL 3.0.0.
1578 */
1579extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1580
1581/**
1582 * Get VSync of the given renderer.
1583 *
1584 * \param renderer The renderer to toggle
1585 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1586 * reserved
1587 * \returns 0 on success or a negative error code on failure; call
1588 * SDL_GetError() for more information.
1589 *
1590 * \since This function is available since SDL 3.0.0.
1591 */
1592extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
1593
1594/* Ends C function definitions when using C++ */
1595#ifdef __cplusplus
1596}
1597#endif
1598#include <SDL3/SDL_close_code.h>
1599
1600#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:123
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