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: https://github.com/libsdl-org/SDL/issues/986
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
408
409/**
410 * Get the DXGI resource associated with a texture.
411 *
412 * This is available when using the direct3d11 and direct3d12 renderers.
413 *
414 * Once you are done using the resource, you should release it to avoid a
415 * resource leak.
416 *
417 * \param texture the texture from which to get the associated resource
418 * \returns the DXGI resource associated with given texture or NULL if it is
419 * not available; call SDL_GetError() for more information.
420 *
421 * \since This function is available since SDL 3.0.0.
422 */
423extern DECLSPEC IDXGIResource* SDLCALL SDL_GetTextureDXGIResource(SDL_Texture *texture);
424
425/**
426 * Query the attributes of a texture.
427 *
428 * \param texture the texture to query
429 * \param format a pointer filled in with the raw format of the texture; the
430 * actual format may differ, but pixel transfers will use this
431 * format (one of the SDL_PixelFormatEnum values). This argument
432 * can be NULL if you don't need this information.
433 * \param access a pointer filled in with the actual access to the texture
434 * (one of the SDL_TextureAccess values). This argument can be
435 * NULL if you don't need this information.
436 * \param w a pointer filled in with the width of the texture in pixels. This
437 * argument can be NULL if you don't need this information.
438 * \param h a pointer filled in with the height of the texture in pixels. This
439 * argument can be NULL if you don't need this information.
440 * \returns 0 on success or a negative error code on failure; call
441 * SDL_GetError() for more information.
442 *
443 * \since This function is available since SDL 3.0.0.
444 *
445 * \sa SDL_CreateTexture
446 */
447extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
448
449/**
450 * Set an additional color value multiplied into render copy operations.
451 *
452 * When this texture is rendered, during the copy operation each source color
453 * channel is modulated by the appropriate color value according to the
454 * following formula:
455 *
456 * `srcC = srcC * (color / 255)`
457 *
458 * Color modulation is not always supported by the renderer; it will return -1
459 * if color modulation is not supported.
460 *
461 * \param texture the texture to update
462 * \param r the red color value multiplied into copy operations
463 * \param g the green color value multiplied into copy operations
464 * \param b the blue color value multiplied into copy operations
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_GetTextureColorMod
471 * \sa SDL_SetTextureAlphaMod
472 */
473extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
474
475
476/**
477 * Get the additional color value multiplied into render copy operations.
478 *
479 * \param texture the texture to query
480 * \param r a pointer filled in with the current red color value
481 * \param g a pointer filled in with the current green color value
482 * \param b a pointer filled in with the current blue color value
483 * \returns 0 on success or a negative error code on failure; call
484 * SDL_GetError() for more information.
485 *
486 * \since This function is available since SDL 3.0.0.
487 *
488 * \sa SDL_GetTextureAlphaMod
489 * \sa SDL_SetTextureColorMod
490 */
491extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
492
493/**
494 * Set an additional alpha value multiplied into render copy operations.
495 *
496 * When this texture is rendered, during the copy operation the source alpha
497 * value is modulated by this alpha value according to the following formula:
498 *
499 * `srcA = srcA * (alpha / 255)`
500 *
501 * Alpha modulation is not always supported by the renderer; it will return -1
502 * if alpha modulation is not supported.
503 *
504 * \param texture the texture to update
505 * \param alpha the source alpha value multiplied into copy operations
506 * \returns 0 on success or a negative error code on failure; call
507 * SDL_GetError() for more information.
508 *
509 * \since This function is available since SDL 3.0.0.
510 *
511 * \sa SDL_GetTextureAlphaMod
512 * \sa SDL_SetTextureColorMod
513 */
514extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
515
516/**
517 * Get the additional alpha value multiplied into render copy operations.
518 *
519 * \param texture the texture to query
520 * \param alpha a pointer filled in with the current alpha value
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_GetTextureColorMod
527 * \sa SDL_SetTextureAlphaMod
528 */
529extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
530
531/**
532 * Set the blend mode for a texture, used by SDL_RenderTexture().
533 *
534 * If the blend mode is not supported, the closest supported mode is chosen
535 * and this function returns -1.
536 *
537 * \param texture the texture to update
538 * \param blendMode the SDL_BlendMode to use for texture blending
539 * \returns 0 on success or a negative error code on failure; call
540 * SDL_GetError() for more information.
541 *
542 * \since This function is available since SDL 3.0.0.
543 *
544 * \sa SDL_GetTextureBlendMode
545 * \sa SDL_RenderTexture
546 */
547extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
548
549/**
550 * Get the blend mode used for texture copy operations.
551 *
552 * \param texture the texture to query
553 * \param blendMode a pointer filled in with the current SDL_BlendMode
554 * \returns 0 on success or a negative error code on failure; call
555 * SDL_GetError() for more information.
556 *
557 * \since This function is available since SDL 3.0.0.
558 *
559 * \sa SDL_SetTextureBlendMode
560 */
561extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
562
563/**
564 * Set the scale mode used for texture scale operations.
565 *
566 * If the scale mode is not supported, the closest supported mode is chosen.
567 *
568 * \param texture The texture to update.
569 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
570 * \returns 0 on success or a negative error code on failure; call
571 * SDL_GetError() for more information.
572 *
573 * \since This function is available since SDL 3.0.0.
574 *
575 * \sa SDL_GetTextureScaleMode
576 */
577extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
578
579/**
580 * Get the scale mode used for texture scale operations.
581 *
582 * \param texture the texture to query.
583 * \param scaleMode a pointer filled in with the current scale mode.
584 * \returns 0 on success or a negative error code on failure; call
585 * SDL_GetError() for more information.
586 *
587 * \since This function is available since SDL 3.0.0.
588 *
589 * \sa SDL_SetTextureScaleMode
590 */
591extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
592
593/**
594 * Associate a user-specified pointer with a texture.
595 *
596 * \param texture the texture to update.
597 * \param userdata the pointer to associate with the texture.
598 * \returns 0 on success or a negative error code on failure; call
599 * SDL_GetError() for more information.
600 *
601 * \since This function is available since SDL 3.0.0.
602 *
603 * \sa SDL_GetTextureUserData
604 */
605extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *userdata);
606
607/**
608 * Get the user-specified pointer associated with a texture
609 *
610 * \param texture the texture to query.
611 * \returns the pointer associated with the texture, or NULL if the texture is
612 * not valid.
613 *
614 * \since This function is available since SDL 3.0.0.
615 *
616 * \sa SDL_SetTextureUserData
617 */
618extern DECLSPEC void *SDLCALL SDL_GetTextureUserData(SDL_Texture *texture);
619
620/**
621 * Update the given texture rectangle with new pixel data.
622 *
623 * The pixel data must be in the pixel format of the texture. Use
624 * SDL_QueryTexture() to query the pixel format of the texture.
625 *
626 * This is a fairly slow function, intended for use with static textures that
627 * do not change often.
628 *
629 * If the texture is intended to be updated often, it is preferred to create
630 * the texture as streaming and use the locking functions referenced below.
631 * While this function will work with streaming textures, for optimization
632 * reasons you may not get the pixels back if you lock the texture afterward.
633 *
634 * \param texture the texture to update
635 * \param rect an SDL_Rect structure representing the area to update, or NULL
636 * to update the entire texture
637 * \param pixels the raw pixel data in the format of the texture
638 * \param pitch the number of bytes in a row of pixel data, including padding
639 * between lines
640 * \returns 0 on success or a negative error code on failure; call
641 * SDL_GetError() for more information.
642 *
643 * \since This function is available since SDL 3.0.0.
644 *
645 * \sa SDL_CreateTexture
646 * \sa SDL_LockTexture
647 * \sa SDL_UnlockTexture
648 */
649extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
650
651/**
652 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
653 * data.
654 *
655 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
656 * block of Y and U/V planes in the proper order, but this function is
657 * available if your pixel data is not contiguous.
658 *
659 * \param texture the texture to update
660 * \param rect a pointer to the rectangle of pixels to update, or NULL to
661 * update the entire texture
662 * \param Yplane the raw pixel data for the Y plane
663 * \param Ypitch the number of bytes between rows of pixel data for the Y
664 * plane
665 * \param Uplane the raw pixel data for the U plane
666 * \param Upitch the number of bytes between rows of pixel data for the U
667 * plane
668 * \param Vplane the raw pixel data for the V plane
669 * \param Vpitch the number of bytes between rows of pixel data for the V
670 * plane
671 * \returns 0 on success or a negative error code on failure; call
672 * SDL_GetError() for more information.
673 *
674 * \since This function is available since SDL 3.0.0.
675 *
676 * \sa SDL_UpdateTexture
677 */
678extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
679 const SDL_Rect *rect,
680 const Uint8 *Yplane, int Ypitch,
681 const Uint8 *Uplane, int Upitch,
682 const Uint8 *Vplane, int Vpitch);
683
684/**
685 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
686 *
687 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
688 * block of NV12/21 planes in the proper order, but this function is available
689 * if your pixel data is not contiguous.
690 *
691 * \param texture the texture to update
692 * \param rect a pointer to the rectangle of pixels to update, or NULL to
693 * update the entire texture.
694 * \param Yplane the raw pixel data for the Y plane.
695 * \param Ypitch the number of bytes between rows of pixel data for the Y
696 * plane.
697 * \param UVplane the raw pixel data for the UV plane.
698 * \param UVpitch the number of bytes between rows of pixel data for the UV
699 * plane.
700 * \returns 0 on success or a negative error code on failure; call
701 * SDL_GetError() for more information.
702 *
703 * \since This function is available since SDL 3.0.0.
704 */
705extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
706 const SDL_Rect *rect,
707 const Uint8 *Yplane, int Ypitch,
708 const Uint8 *UVplane, int UVpitch);
709
710/**
711 * Lock a portion of the texture for **write-only** pixel access.
712 *
713 * As an optimization, the pixels made available for editing don't necessarily
714 * contain the old texture data. This is a write-only operation, and if you
715 * need to keep a copy of the texture data you should do that at the
716 * application level.
717 *
718 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
719 * changes.
720 *
721 * \param texture the texture to lock for access, which was created with
722 * `SDL_TEXTUREACCESS_STREAMING`
723 * \param rect an SDL_Rect structure representing the area to lock for access;
724 * NULL to lock the entire texture
725 * \param pixels this is filled in with a pointer to the locked pixels,
726 * appropriately offset by the locked area
727 * \param pitch this is filled in with the pitch of the locked pixels; the
728 * pitch is the length of one row in bytes
729 * \returns 0 on success or a negative error code if the texture is not valid
730 * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
731 * SDL_GetError() for more information.
732 *
733 * \since This function is available since SDL 3.0.0.
734 *
735 * \sa SDL_UnlockTexture
736 */
737extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
738 const SDL_Rect *rect,
739 void **pixels, int *pitch);
740
741/**
742 * Lock a portion of the texture for **write-only** pixel access, and expose
743 * it as a SDL surface.
744 *
745 * Besides providing an SDL_Surface instead of raw pixel data, this function
746 * operates like SDL_LockTexture.
747 *
748 * As an optimization, the pixels made available for editing don't necessarily
749 * contain the old texture data. This is a write-only operation, and if you
750 * need to keep a copy of the texture data you should do that at the
751 * application level.
752 *
753 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
754 * changes.
755 *
756 * The returned surface is freed internally after calling SDL_UnlockTexture()
757 * or SDL_DestroyTexture(). The caller should not free it.
758 *
759 * \param texture the texture to lock for access, which must be created with
760 * `SDL_TEXTUREACCESS_STREAMING`
761 * \param rect a pointer to the rectangle to lock for access. If the rect is
762 * NULL, the entire texture will be locked
763 * \param surface this is filled in with an SDL surface representing the
764 * locked area
765 * \returns 0 on success or a negative error code on failure; call
766 * SDL_GetError() for more information.
767 *
768 * \since This function is available since SDL 3.0.0.
769 *
770 * \sa SDL_LockTexture
771 * \sa SDL_UnlockTexture
772 */
773extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
774 const SDL_Rect *rect,
775 SDL_Surface **surface);
776
777/**
778 * Unlock a texture, uploading the changes to video memory, if needed.
779 *
780 * **Warning**: Please note that SDL_LockTexture() is intended to be
781 * write-only; it will not guarantee the previous contents of the texture will
782 * be provided. You must fully initialize any area of a texture that you lock
783 * before unlocking it, as the pixels might otherwise be uninitialized memory.
784 *
785 * Which is to say: locking and immediately unlocking a texture can result in
786 * corrupted textures, depending on the renderer in use.
787 *
788 * \param texture a texture locked by SDL_LockTexture()
789 *
790 * \since This function is available since SDL 3.0.0.
791 *
792 * \sa SDL_LockTexture
793 */
794extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
795
796/**
797 * Set a texture as the current rendering target.
798 *
799 * The default render target is the window for which the renderer was created.
800 * To stop rendering to a texture and render to the window again, call this
801 * function with a NULL `texture`.
802 *
803 * \param renderer the rendering context
804 * \param texture the targeted texture, which must be created with the
805 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
806 * window instead of a texture.
807 * \returns 0 on success or a negative error code on failure; call
808 * SDL_GetError() for more information.
809 *
810 * \since This function is available since SDL 3.0.0.
811 *
812 * \sa SDL_GetRenderTarget
813 */
814extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
815
816/**
817 * Get the current render target.
818 *
819 * The default render target is the window for which the renderer was created,
820 * and is reported a NULL here.
821 *
822 * \param renderer the rendering context
823 * \returns the current render target or NULL for the default render target.
824 *
825 * \since This function is available since SDL 3.0.0.
826 *
827 * \sa SDL_SetRenderTarget
828 */
829extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
830
831/**
832 * Set a device independent resolution and presentation mode for rendering.
833 *
834 * This function sets the width and height of the logical rendering output. A
835 * render target is created at the specified size and used for rendering and
836 * then copied to the output during presentation.
837 *
838 * You can disable logical coordinates by setting the mode to
839 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
840 * resolution of the output window.
841 *
842 * You can convert coordinates in an event into rendering coordinates using
843 * SDL_ConvertEventToRenderCoordinates().
844 *
845 * \param renderer the rendering context
846 * \param w the width of the logical resolution
847 * \param h the height of the logical resolution
848 * \param mode the presentation mode used
849 * \param scale_mode the scale mode used
850 * \returns 0 on success or a negative error code on failure; call
851 * SDL_GetError() for more information.
852 *
853 * \since This function is available since SDL 3.0.0.
854 *
855 * \sa SDL_ConvertEventToRenderCoordinates
856 * \sa SDL_GetRenderLogicalPresentation
857 */
858extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
859
860/**
861 * Get device independent resolution and presentation mode for rendering.
862 *
863 * This function gets the width and height of the logical rendering output, or
864 * the output size in pixels if a logical resolution is not enabled.
865 *
866 * \param renderer the rendering context
867 * \param w an int to be filled with the width
868 * \param h an int to be filled with the height
869 * \param mode a pointer filled in with the presentation mode
870 * \param scale_mode a pointer filled in with the scale mode
871 * \returns 0 on success or a negative error code on failure; call
872 * SDL_GetError() for more information.
873 *
874 * \since This function is available since SDL 3.0.0.
875 *
876 * \sa SDL_SetRenderLogicalPresentation
877 */
878extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
879
880/**
881 * Get a point in render coordinates when given a point in window coordinates.
882 *
883 * \param renderer the rendering context
884 * \param window_x the x coordinate in window coordinates
885 * \param window_y the y coordinate in window coordinates
886 * \param x a pointer filled with the x coordinate in render coordinates
887 * \param y a pointer filled with the y coordinate in render coordinates
888 * \returns 0 on success or a negative error code on failure; call
889 * SDL_GetError() for more information.
890 *
891 * \since This function is available since SDL 3.0.0.
892 *
893 * \sa SDL_SetRenderLogicalPresentation
894 * \sa SDL_SetRenderScale
895 */
896extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
897
898/**
899 * Get a point in window coordinates when given a point in render coordinates.
900 *
901 * \param renderer the rendering context
902 * \param x the x coordinate in render coordinates
903 * \param y the y coordinate in render coordinates
904 * \param window_x a pointer filled with the x coordinate in window
905 * coordinates
906 * \param window_y a pointer filled with the y coordinate in window
907 * coordinates
908 * \returns 0 on success or a negative error code on failure; call
909 * SDL_GetError() for more information.
910 *
911 * \since This function is available since SDL 3.0.0.
912 *
913 * \sa SDL_SetRenderLogicalPresentation
914 * \sa SDL_SetRenderScale
915 */
916extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
917
918/**
919 * Convert the coordinates in an event to render coordinates.
920 *
921 * Touch coordinates are converted from normalized coordinates in the window
922 * to non-normalized rendering coordinates.
923 *
924 * Once converted, the coordinates may be outside the rendering area.
925 *
926 * \param renderer the rendering context
927 * \param event the event to modify
928 * \returns 0 on success or a negative error code on failure; call
929 * SDL_GetError() for more information.
930 *
931 * \since This function is available since SDL 3.0.0.
932 *
933 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
934 */
935extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
936
937/**
938 * Set the drawing area for rendering on the current target.
939 *
940 * \param renderer the rendering context
941 * \param rect the SDL_Rect structure representing the drawing area, or NULL
942 * to set the viewport to the entire target
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_GetRenderViewport
949 */
950extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
951
952/**
953 * Get the drawing area for the current target.
954 *
955 * \param renderer the rendering context
956 * \param rect an SDL_Rect structure filled in with the current drawing area
957 * \returns 0 on success or a negative error code on failure; call
958 * SDL_GetError() for more information.
959 *
960 * \since This function is available since SDL 3.0.0.
961 *
962 * \sa SDL_SetRenderViewport
963 */
964extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
965
966/**
967 * Set the clip rectangle for rendering on the specified target.
968 *
969 * \param renderer the rendering context
970 * \param rect an SDL_Rect structure representing the clip area, relative to
971 * the viewport, or NULL to disable clipping
972 * \returns 0 on success or a negative error code on failure; call
973 * SDL_GetError() for more information.
974 *
975 * \since This function is available since SDL 3.0.0.
976 *
977 * \sa SDL_GetRenderClipRect
978 * \sa SDL_RenderClipEnabled
979 */
980extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
981
982/**
983 * Get the clip rectangle for the current target.
984 *
985 * \param renderer the rendering context
986 * \param rect an SDL_Rect structure filled in with the current clipping area
987 * or an empty rectangle if clipping is disabled
988 * \returns 0 on success or a negative error code on failure; call
989 * SDL_GetError() for more information.
990 *
991 * \since This function is available since SDL 3.0.0.
992 *
993 * \sa SDL_RenderClipEnabled
994 * \sa SDL_SetRenderClipRect
995 */
996extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
997
998/**
999 * Get whether clipping is enabled on the given renderer.
1000 *
1001 * \param renderer the rendering context
1002 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
1003 * SDL_GetError() for more information.
1004 *
1005 * \since This function is available since SDL 3.0.0.
1006 *
1007 * \sa SDL_GetRenderClipRect
1008 * \sa SDL_SetRenderClipRect
1009 */
1010extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1011
1012/**
1013 * Set the drawing scale for rendering on the current target.
1014 *
1015 * The drawing coordinates are scaled by the x/y scaling factors before they
1016 * are used by the renderer. This allows resolution independent drawing with a
1017 * single coordinate system.
1018 *
1019 * If this results in scaling or subpixel drawing by the rendering backend, it
1020 * will be handled using the appropriate quality hints. For best results use
1021 * integer scaling factors.
1022 *
1023 * \param renderer the rendering context
1024 * \param scaleX the horizontal scaling factor
1025 * \param scaleY the vertical scaling factor
1026 * \returns 0 on success or a negative error code on failure; call
1027 * SDL_GetError() for more information.
1028 *
1029 * \since This function is available since SDL 3.0.0.
1030 *
1031 * \sa SDL_GetRenderScale
1032 */
1033extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1034
1035/**
1036 * Get the drawing scale for the current target.
1037 *
1038 * \param renderer the rendering context
1039 * \param scaleX a pointer filled in with the horizontal scaling factor
1040 * \param scaleY a pointer filled in with the vertical scaling factor
1041 * \returns 0 on success or a negative error code on failure; call
1042 * SDL_GetError() for more information.
1043 *
1044 * \since This function is available since SDL 3.0.0.
1045 *
1046 * \sa SDL_SetRenderScale
1047 */
1048extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1049
1050/**
1051 * Set the color used for drawing operations (Rect, Line and Clear).
1052 *
1053 * Set the color for drawing or filling rectangles, lines, and points, and for
1054 * SDL_RenderClear().
1055 *
1056 * \param renderer the rendering context
1057 * \param r the red value used to draw on the rendering target
1058 * \param g the green value used to draw on the rendering target
1059 * \param b the blue value used to draw on the rendering target
1060 * \param a the alpha value used to draw on the rendering target; usually
1061 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1062 * specify how the alpha channel is used
1063 * \returns 0 on success or a negative error code on failure; call
1064 * SDL_GetError() for more information.
1065 *
1066 * \since This function is available since SDL 3.0.0.
1067 *
1068 * \sa SDL_GetRenderDrawColor
1069 * \sa SDL_RenderClear
1070 * \sa SDL_RenderLine
1071 * \sa SDL_RenderLines
1072 * \sa SDL_RenderPoint
1073 * \sa SDL_RenderPoints
1074 * \sa SDL_RenderRect
1075 * \sa SDL_RenderRects
1076 * \sa SDL_RenderFillRect
1077 * \sa SDL_RenderFillRects
1078 */
1079extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1080
1081/**
1082 * Get the color used for drawing operations (Rect, Line and Clear).
1083 *
1084 * \param renderer the rendering context
1085 * \param r a pointer filled in with the red value used to draw on the
1086 * rendering target
1087 * \param g a pointer filled in with the green value used to draw on the
1088 * rendering target
1089 * \param b a pointer filled in with the blue value used to draw on the
1090 * rendering target
1091 * \param a a pointer filled in with the alpha value used to draw on the
1092 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1093 * \returns 0 on success or a negative error code on failure; call
1094 * SDL_GetError() for more information.
1095 *
1096 * \since This function is available since SDL 3.0.0.
1097 *
1098 * \sa SDL_SetRenderDrawColor
1099 */
1100extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1101
1102/**
1103 * Set the blend mode used for drawing operations (Fill and Line).
1104 *
1105 * If the blend mode is not supported, the closest supported mode is chosen.
1106 *
1107 * \param renderer the rendering context
1108 * \param blendMode the SDL_BlendMode to use for blending
1109 * \returns 0 on success or a negative error code on failure; call
1110 * SDL_GetError() for more information.
1111 *
1112 * \since This function is available since SDL 3.0.0.
1113 *
1114 * \sa SDL_GetRenderDrawBlendMode
1115 * \sa SDL_RenderLine
1116 * \sa SDL_RenderLines
1117 * \sa SDL_RenderPoint
1118 * \sa SDL_RenderPoints
1119 * \sa SDL_RenderRect
1120 * \sa SDL_RenderRects
1121 * \sa SDL_RenderFillRect
1122 * \sa SDL_RenderFillRects
1123 */
1124extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1125
1126/**
1127 * Get the blend mode used for drawing operations.
1128 *
1129 * \param renderer the rendering context
1130 * \param blendMode a pointer filled in with the current SDL_BlendMode
1131 * \returns 0 on success or a negative error code on failure; call
1132 * SDL_GetError() for more information.
1133 *
1134 * \since This function is available since SDL 3.0.0.
1135 *
1136 * \sa SDL_SetRenderDrawBlendMode
1137 */
1138extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1139
1140/**
1141 * Clear the current rendering target with the drawing color.
1142 *
1143 * This function clears the entire rendering target, ignoring the viewport and
1144 * the clip rectangle.
1145 *
1146 * \param renderer the rendering context
1147 * \returns 0 on success or a negative error code on failure; call
1148 * SDL_GetError() for more information.
1149 *
1150 * \since This function is available since SDL 3.0.0.
1151 *
1152 * \sa SDL_SetRenderDrawColor
1153 */
1154extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1155
1156/**
1157 * Draw a point on the current rendering target at subpixel precision.
1158 *
1159 * \param renderer The renderer which should draw a point.
1160 * \param x The x coordinate of the point.
1161 * \param y The y coordinate of the point.
1162 * \returns 0 on success, or -1 on error
1163 *
1164 * \since This function is available since SDL 3.0.0.
1165 */
1166extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1167
1168/**
1169 * Draw multiple points on the current rendering target at subpixel precision.
1170 *
1171 * \param renderer The renderer which should draw multiple points.
1172 * \param points The points to draw
1173 * \param count The number of points to draw
1174 * \returns 0 on success or a negative error code on failure; call
1175 * SDL_GetError() for more information.
1176 *
1177 * \since This function is available since SDL 3.0.0.
1178 */
1179extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1180
1181/**
1182 * Draw a line on the current rendering target at subpixel precision.
1183 *
1184 * \param renderer The renderer which should draw a line.
1185 * \param x1 The x coordinate of the start point.
1186 * \param y1 The y coordinate of the start point.
1187 * \param x2 The x coordinate of the end point.
1188 * \param y2 The y coordinate of the end point.
1189 * \returns 0 on success, or -1 on error
1190 *
1191 * \since This function is available since SDL 3.0.0.
1192 */
1193extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1194
1195/**
1196 * Draw a series of connected lines on the current rendering target at
1197 * subpixel precision.
1198 *
1199 * \param renderer The renderer which should draw multiple lines.
1200 * \param points The points along the lines
1201 * \param count The number of points, drawing count-1 lines
1202 * \returns 0 on success or a negative error code on failure; call
1203 * SDL_GetError() for more information.
1204 *
1205 * \since This function is available since SDL 3.0.0.
1206 */
1207extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1208
1209/**
1210 * Draw a rectangle on the current rendering target at subpixel precision.
1211 *
1212 * \param renderer The renderer which should draw a rectangle.
1213 * \param rect A pointer to the destination rectangle, or NULL to outline the
1214 * entire rendering target.
1215 * \returns 0 on success, or -1 on error
1216 *
1217 * \since This function is available since SDL 3.0.0.
1218 */
1219extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1220
1221/**
1222 * Draw some number of rectangles on the current rendering target at subpixel
1223 * precision.
1224 *
1225 * \param renderer The renderer which should draw multiple rectangles.
1226 * \param rects A pointer to an array of destination rectangles.
1227 * \param count The number of rectangles.
1228 * \returns 0 on success or a negative error code on failure; call
1229 * SDL_GetError() for more information.
1230 *
1231 * \since This function is available since SDL 3.0.0.
1232 */
1233extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1234
1235/**
1236 * Fill a rectangle on the current rendering target with the drawing color at
1237 * subpixel precision.
1238 *
1239 * \param renderer The renderer which should fill a rectangle.
1240 * \param rect A pointer to the destination rectangle, or NULL for the entire
1241 * rendering target.
1242 * \returns 0 on success, or -1 on error
1243 *
1244 * \since This function is available since SDL 3.0.0.
1245 */
1246extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1247
1248/**
1249 * Fill some number of rectangles on the current rendering target with the
1250 * drawing color at subpixel precision.
1251 *
1252 * \param renderer The renderer which should fill multiple rectangles.
1253 * \param rects A pointer to an array of destination rectangles.
1254 * \param count The number of rectangles.
1255 * \returns 0 on success or a negative error code on failure; call
1256 * SDL_GetError() for more information.
1257 *
1258 * \since This function is available since SDL 3.0.0.
1259 */
1260extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1261
1262/**
1263 * Copy a portion of the texture to the current rendering target at subpixel
1264 * precision.
1265 *
1266 * \param renderer The renderer which should copy parts of a texture.
1267 * \param texture The source texture.
1268 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1269 * texture.
1270 * \param dstrect A pointer to the destination rectangle, or NULL for the
1271 * entire rendering target.
1272 * \returns 0 on success, or -1 on error
1273 *
1274 * \since This function is available since SDL 3.0.0.
1275 */
1276extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
1277
1278/**
1279 * Copy a portion of the source texture to the current rendering target, with
1280 * rotation and flipping, at subpixel precision.
1281 *
1282 * \param renderer The renderer which should copy parts of a texture.
1283 * \param texture The source texture.
1284 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1285 * texture.
1286 * \param dstrect A pointer to the destination rectangle, or NULL for the
1287 * entire rendering target.
1288 * \param angle An angle in degrees that indicates the rotation that will be
1289 * applied to dstrect, rotating it in a clockwise direction
1290 * \param center A pointer to a point indicating the point around which
1291 * dstrect will be rotated (if NULL, rotation will be done
1292 * around dstrect.w/2, dstrect.h/2).
1293 * \param flip An SDL_RendererFlip value stating which flipping actions should
1294 * be performed on the texture
1295 * \returns 0 on success or a negative error code on failure; call
1296 * SDL_GetError() for more information.
1297 *
1298 * \since This function is available since SDL 3.0.0.
1299 */
1300extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
1301 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
1302 const double angle, const SDL_FPoint *center,
1303 const SDL_RendererFlip flip);
1304
1305/**
1306 * Render a list of triangles, optionally using a texture and indices into the
1307 * vertex array Color and alpha modulation is done per vertex
1308 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1309 *
1310 * \param renderer The rendering context.
1311 * \param texture (optional) The SDL texture to use.
1312 * \param vertices Vertices.
1313 * \param num_vertices Number of vertices.
1314 * \param indices (optional) An array of integer indices into the 'vertices'
1315 * array, if NULL all vertices will be rendered in sequential
1316 * order.
1317 * \param num_indices Number of indices.
1318 * \returns 0 on success, or -1 if the operation is not supported
1319 *
1320 * \since This function is available since SDL 3.0.0.
1321 *
1322 * \sa SDL_RenderGeometryRaw
1323 * \sa SDL_Vertex
1324 */
1325extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1326 SDL_Texture *texture,
1327 const SDL_Vertex *vertices, int num_vertices,
1328 const int *indices, int num_indices);
1329
1330/**
1331 * Render a list of triangles, optionally using a texture and indices into the
1332 * vertex arrays Color and alpha modulation is done per vertex
1333 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1334 *
1335 * \param renderer The rendering context.
1336 * \param texture (optional) The SDL texture to use.
1337 * \param xy Vertex positions
1338 * \param xy_stride Byte size to move from one element to the next element
1339 * \param color Vertex colors (as SDL_Color)
1340 * \param color_stride Byte size to move from one element to the next element
1341 * \param uv Vertex normalized texture coordinates
1342 * \param uv_stride Byte size to move from one element to the next element
1343 * \param num_vertices Number of vertices.
1344 * \param indices (optional) An array of indices into the 'vertices' arrays,
1345 * if NULL all vertices will be rendered in sequential order.
1346 * \param num_indices Number of indices.
1347 * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
1348 * \returns 0 on success or a negative error code on failure; call
1349 * SDL_GetError() for more information.
1350 *
1351 * \since This function is available since SDL 3.0.0.
1352 *
1353 * \sa SDL_RenderGeometry
1354 * \sa SDL_Vertex
1355 */
1356extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1357 SDL_Texture *texture,
1358 const float *xy, int xy_stride,
1359 const SDL_Color *color, int color_stride,
1360 const float *uv, int uv_stride,
1361 int num_vertices,
1362 const void *indices, int num_indices, int size_indices);
1363
1364/**
1365 * Read pixels from the current rendering target to an array of pixels.
1366 *
1367 * **WARNING**: This is a very slow operation, and should not be used
1368 * frequently. If you're using this on the main rendering target, it should be
1369 * called after rendering and before SDL_RenderPresent().
1370 *
1371 * `pitch` specifies the number of bytes between rows in the destination
1372 * `pixels` data. This allows you to write to a subrectangle or have padded
1373 * rows in the destination. Generally, `pitch` should equal the number of
1374 * pixels per row in the `pixels` data times the number of bytes per pixel,
1375 * but it might contain additional padding (for example, 24bit RGB Windows
1376 * Bitmap data pads all rows to multiples of 4 bytes).
1377 *
1378 * \param renderer the rendering context
1379 * \param rect an SDL_Rect structure representing the area in pixels relative
1380 * to the to current viewport, or NULL for the entire viewport
1381 * \param format an SDL_PixelFormatEnum value of the desired format of the
1382 * pixel data, or 0 to use the format of the rendering target
1383 * \param pixels a pointer to the pixel data to copy into
1384 * \param pitch the pitch of the `pixels` parameter
1385 * \returns 0 on success or a negative error code on failure; call
1386 * SDL_GetError() for more information.
1387 *
1388 * \since This function is available since SDL 3.0.0.
1389 */
1390extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1391 const SDL_Rect *rect,
1392 Uint32 format,
1393 void *pixels, int pitch);
1394
1395/**
1396 * Update the screen with any rendering performed since the previous call.
1397 *
1398 * SDL's rendering functions operate on a backbuffer; that is, calling a
1399 * rendering function such as SDL_RenderLine() does not directly put a line on
1400 * the screen, but rather updates the backbuffer. As such, you compose your
1401 * entire scene and *present* the composed backbuffer to the screen as a
1402 * complete picture.
1403 *
1404 * Therefore, when using SDL's rendering API, one does all drawing intended
1405 * for the frame, and then calls this function once per frame to present the
1406 * final drawing to the user.
1407 *
1408 * The backbuffer should be considered invalidated after each present; do not
1409 * assume that previous contents will exist between frames. You are strongly
1410 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1411 * starting each new frame's drawing, even if you plan to overwrite every
1412 * pixel.
1413 *
1414 * \param renderer the rendering context
1415 * \returns 0 on success or a negative error code on failure; call
1416 * SDL_GetError() for more information.
1417 *
1418 * \threadsafety You may only call this function on the main thread.
1419 *
1420 * \since This function is available since SDL 3.0.0.
1421 *
1422 * \sa SDL_RenderClear
1423 * \sa SDL_RenderLine
1424 * \sa SDL_RenderLines
1425 * \sa SDL_RenderPoint
1426 * \sa SDL_RenderPoints
1427 * \sa SDL_RenderRect
1428 * \sa SDL_RenderRects
1429 * \sa SDL_RenderFillRect
1430 * \sa SDL_RenderFillRects
1431 * \sa SDL_SetRenderDrawBlendMode
1432 * \sa SDL_SetRenderDrawColor
1433 */
1434extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1435
1436/**
1437 * Destroy the specified texture.
1438 *
1439 * Passing NULL or an otherwise invalid texture will set the SDL error message
1440 * to "Invalid texture".
1441 *
1442 * \param texture the texture to destroy
1443 *
1444 * \since This function is available since SDL 3.0.0.
1445 *
1446 * \sa SDL_CreateTexture
1447 * \sa SDL_CreateTextureFromSurface
1448 */
1449extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1450
1451/**
1452 * Destroy the rendering context for a window and free associated textures.
1453 *
1454 * If `renderer` is NULL, this function will return immediately after setting
1455 * the SDL error message to "Invalid renderer". See SDL_GetError().
1456 *
1457 * \param renderer the rendering context
1458 *
1459 * \since This function is available since SDL 3.0.0.
1460 *
1461 * \sa SDL_CreateRenderer
1462 */
1463extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1464
1465/**
1466 * Force the rendering context to flush any pending commands to the underlying
1467 * rendering API.
1468 *
1469 * You do not need to (and in fact, shouldn't) call this function unless you
1470 * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
1471 * addition to using an SDL_Renderer.
1472 *
1473 * This is for a very-specific case: if you are using SDL's render API, you
1474 * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
1475 * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
1476 * calls in addition to SDL render API calls. If all of this applies, you
1477 * should call SDL_RenderFlush() between calls to SDL's render API and the
1478 * low-level API you're using in cooperation.
1479 *
1480 * In all other cases, you can ignore this function. This is only here to get
1481 * maximum performance out of a specific situation. In all other cases, SDL
1482 * will do the right thing, perhaps at a performance loss.
1483 *
1484 * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
1485 * and earlier, as earlier versions did not queue rendering commands at all,
1486 * instead flushing them to the OS immediately.
1487 *
1488 * \param renderer the rendering context
1489 * \returns 0 on success or a negative error code on failure; call
1490 * SDL_GetError() for more information.
1491 *
1492 * \since This function is available since SDL 3.0.0.
1493 */
1494extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
1495
1496
1497/**
1498 * Bind an OpenGL/ES/ES2 texture to the current context.
1499 *
1500 * This is for use with OpenGL instructions when rendering OpenGL primitives
1501 * directly.
1502 *
1503 * If not NULL, `texw` and `texh` will be filled with the width and height
1504 * values suitable for the provided texture. In most cases, both will be 1.0,
1505 * however, on systems that support the GL_ARB_texture_rectangle extension,
1506 * these values will actually be the pixel width and height used to create the
1507 * texture, so this factor needs to be taken into account when providing
1508 * texture coordinates to OpenGL.
1509 *
1510 * You need a renderer to create an SDL_Texture, therefore you can only use
1511 * this function with an implicit OpenGL context from SDL_CreateRenderer(),
1512 * not with your own OpenGL context. If you need control over your OpenGL
1513 * context, you need to write your own texture-loading methods.
1514 *
1515 * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
1516 * re-order the color channels in the shaders phase, so the uploaded texture
1517 * may have swapped color channels.
1518 *
1519 * \param texture the texture to bind to the current OpenGL/ES/ES2 context
1520 * \param texw a pointer to a float value which will be filled with the
1521 * texture width or NULL if you don't need that value
1522 * \param texh a pointer to a float value which will be filled with the
1523 * texture height or NULL if you don't need that value
1524 * \returns 0 on success or a negative error code on failure; call
1525 * SDL_GetError() for more information.
1526 *
1527 * \since This function is available since SDL 3.0.0.
1528 *
1529 * \sa SDL_GL_MakeCurrent
1530 * \sa SDL_GL_UnbindTexture
1531 */
1532extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
1533
1534/**
1535 * Unbind an OpenGL/ES/ES2 texture from the current context.
1536 *
1537 * See SDL_GL_BindTexture() for examples on how to use these functions
1538 *
1539 * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
1540 * \returns 0 on success or a negative error code on failure; call
1541 * SDL_GetError() for more information.
1542 *
1543 * \since This function is available since SDL 3.0.0.
1544 *
1545 * \sa SDL_GL_BindTexture
1546 * \sa SDL_GL_MakeCurrent
1547 */
1548extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
1549
1550/**
1551 * Get the CAMetalLayer associated with the given Metal renderer.
1552 *
1553 * This function returns `void *`, so SDL doesn't have to include Metal's
1554 * headers, but it can be safely cast to a `CAMetalLayer *`.
1555 *
1556 * \param renderer The renderer to query
1557 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1558 * Metal renderer
1559 *
1560 * \since This function is available since SDL 3.0.0.
1561 *
1562 * \sa SDL_GetRenderMetalCommandEncoder
1563 */
1564extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1565
1566/**
1567 * Get the Metal command encoder for the current frame
1568 *
1569 * This function returns `void *`, so SDL doesn't have to include Metal's
1570 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1571 *
1572 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1573 * SDL a drawable to render to, which might happen if the window is
1574 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1575 * render targets, just the window's backbuffer. Check your return values!
1576 *
1577 * \param renderer The renderer to query
1578 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1579 * renderer isn't a Metal renderer or there was an error.
1580 *
1581 * \since This function is available since SDL 3.0.0.
1582 *
1583 * \sa SDL_GetRenderMetalLayer
1584 */
1585extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1586
1587/**
1588 * Toggle VSync of the given renderer.
1589 *
1590 * \param renderer The renderer to toggle
1591 * \param vsync 1 for on, 0 for off. All other values are reserved
1592 * \returns 0 on success or a negative error code on failure; call
1593 * SDL_GetError() for more information.
1594 *
1595 * \since This function is available since SDL 3.0.0.
1596 */
1597extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1598
1599/**
1600 * Get VSync of the given renderer.
1601 *
1602 * \param renderer The renderer to toggle
1603 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1604 * reserved
1605 * \returns 0 on success or a negative error code on failure; call
1606 * SDL_GetError() for more information.
1607 *
1608 * \since This function is available since SDL 3.0.0.
1609 */
1610extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
1611
1612/* Ends C function definitions when using C++ */
1613#ifdef __cplusplus
1614}
1615#endif
1616#include <SDL3/SDL_close_code.h>
1617
1618#endif /* SDL_render_h_ */
SDL_BlendMode
The blend mode used in SDL_RenderTexture() and drawing operations.
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)
struct IDXGIResource IDXGIResource
Definition SDL_render.h:407
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)
IDXGIResource * SDL_GetTextureDXGIResource(SDL_Texture *texture)
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
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:87
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:611