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