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_rect.h>
53#include <SDL3/SDL_video.h>
54
55#include <SDL3/SDL_begin_code.h>
56/* Set up for C function definitions, even when using C++ */
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/**
62 * Flags used when creating a rendering context
63 */
64typedef enum
65{
66 SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
67 SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
68 acceleration */
69 SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
70 with the refresh rate */
72
73/**
74 * Information on the capabilities of a render driver or context.
75 */
76typedef struct SDL_RendererInfo
77{
78 const char *name; /**< The name of the renderer */
79 Uint32 flags; /**< Supported ::SDL_RendererFlags */
80 Uint32 num_texture_formats; /**< The number of available texture formats */
81 Uint32 texture_formats[16]; /**< The available texture formats */
82 int max_texture_width; /**< The maximum texture width */
83 int max_texture_height; /**< The maximum texture height */
85
86/**
87 * Vertex structure
88 */
89typedef struct SDL_Vertex
90{
91 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
92 SDL_Color color; /**< Vertex color */
93 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
95
96/**
97 * The scaling mode for a texture.
98 */
99typedef enum
100{
101 SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
102 SDL_SCALEMODE_LINEAR, /**< linear filtering */
103 SDL_SCALEMODE_BEST /**< anisotropic filtering */
105
106/**
107 * The access pattern allowed for a texture.
108 */
109typedef enum
110{
111 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
112 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
113 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
115
116/**
117 * The texture channel modulation used in SDL_RenderTexture().
118 */
119typedef enum
120{
121 SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
122 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
123 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
125
126/**
127 * Flip constants for SDL_RenderTextureRotated
128 */
129typedef enum
130{
131 SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
132 SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
133 SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
135
136/**
137 * How the logical size is mapped to the output
138 */
139typedef enum
140{
141 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
142 SDL_LOGICAL_PRESENTATION_MATCH, /**< The rendered content matches the window size in screen coordinates */
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 -1 on error; call SDL_GetError() for more
218 * 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 screen coordinates,
238 * but you can call SDL_SetRenderLogicalPresentation() to enable high DPI
239 * rendering or change the content size and 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 screen coordinates of a rendering context.
320 *
321 * This returns the true output size in screen coordinates, ignoring any
322 * render targets or logical size and presentation.
323 *
324 * \param renderer the rendering context
325 * \param w a pointer filled in with the width in screen coordinates
326 * \param h a pointer filled in with the height in screen coordinates
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_GetRenderWindowSize(SDL_Renderer *renderer, int *w, int *h);
335
336/**
337 * Get the output size in pixels of a rendering context.
338 *
339 * This returns the true output size in pixels, ignoring any render targets
340 * or logical size and presentation.
341 *
342 * \param renderer the rendering context
343 * \param w a pointer filled in with the width in pixels
344 * \param h a pointer filled in with the height in pixels
345 * \returns 0 on success or a negative error code on failure; call
346 * SDL_GetError() for more information.
347 *
348 * \since This function is available since SDL 3.0.0.
349 *
350 * \sa SDL_GetRenderer
351 */
352extern DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
353
354/**
355 * Get the current output size in pixels of a rendering context.
356 *
357 * If a rendering target is active, this will return the size of the
358 * rendering target in pixels, otherwise if a logical size is set, it will
359 * return the logical size, otherwise it will return the value of
360 * SDL_GetRenderOutputSize().
361 *
362 * \param renderer the rendering context
363 * \param w a pointer filled in with the current width
364 * \param h a pointer filled in with the current height
365 * \returns 0 on success or a negative error code on failure; call
366 * SDL_GetError() for more information.
367 *
368 * \since This function is available since SDL 3.0.0.
369 *
370 * \sa SDL_GetRenderOutputSize
371 * \sa SDL_GetRenderer
372 */
373extern DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
374
375/**
376 * Create a texture for a rendering context.
377 *
378 * You can set the texture scaling method by setting
379 * `SDL_HINT_RENDER_SCALE_QUALITY` before creating the texture.
380 *
381 * \param renderer the rendering context
382 * \param format one of the enumerated values in SDL_PixelFormatEnum
383 * \param access one of the enumerated values in SDL_TextureAccess
384 * \param w the width of the texture in pixels
385 * \param h the height of the texture in pixels
386 * \returns a pointer to the created texture or NULL if no rendering context
387 * was active, the format was unsupported, or the width or height
388 * were out of range; call SDL_GetError() for more information.
389 *
390 * \since This function is available since SDL 3.0.0.
391 *
392 * \sa SDL_CreateTextureFromSurface
393 * \sa SDL_DestroyTexture
394 * \sa SDL_QueryTexture
395 * \sa SDL_UpdateTexture
396 */
397extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h);
398
399/**
400 * Create a texture from an existing surface.
401 *
402 * The surface is not modified or freed by this function.
403 *
404 * The SDL_TextureAccess hint for the created texture is
405 * `SDL_TEXTUREACCESS_STATIC`.
406 *
407 * The pixel format of the created texture may be different from the pixel
408 * format of the surface. Use SDL_QueryTexture() to query the pixel format of
409 * the texture.
410 *
411 * \param renderer the rendering context
412 * \param surface the SDL_Surface structure containing pixel data used to fill
413 * the texture
414 * \returns the created texture or NULL on failure; call SDL_GetError() for
415 * more information.
416 *
417 * \since This function is available since SDL 3.0.0.
418 *
419 * \sa SDL_CreateTexture
420 * \sa SDL_DestroyTexture
421 * \sa SDL_QueryTexture
422 */
423extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
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 -1 if the texture is not valid.
571 *
572 * \since This function is available since SDL 3.0.0.
573 *
574 * \sa SDL_GetTextureScaleMode
575 */
576extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
577
578/**
579 * Get the scale mode used for texture scale operations.
580 *
581 * \param texture the texture to query.
582 * \param scaleMode a pointer filled in with the current scale mode.
583 * \return 0 on success, or -1 if the texture is not valid.
584 *
585 * \since This function is available since SDL 3.0.0.
586 *
587 * \sa SDL_SetTextureScaleMode
588 */
589extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
590
591/**
592 * Associate a user-specified pointer with a texture.
593 *
594 * \param texture the texture to update.
595 * \param userdata the pointer to associate with the texture.
596 * \returns 0 on success, or -1 if the texture is not valid.
597 *
598 * \since This function is available since SDL 3.0.0.
599 *
600 * \sa SDL_GetTextureUserData
601 */
602extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *userdata);
603
604/**
605 * Get the user-specified pointer associated with a texture
606 *
607 * \param texture the texture to query.
608 * \return the pointer associated with the texture, or NULL if the texture is
609 * not valid.
610 *
611 * \since This function is available since SDL 3.0.0.
612 *
613 * \sa SDL_SetTextureUserData
614 */
615extern DECLSPEC void *SDLCALL SDL_GetTextureUserData(SDL_Texture *texture);
616
617/**
618 * Update the given texture rectangle with new pixel data.
619 *
620 * The pixel data must be in the pixel format of the texture. Use
621 * SDL_QueryTexture() to query the pixel format of the texture.
622 *
623 * This is a fairly slow function, intended for use with static textures that
624 * do not change often.
625 *
626 * If the texture is intended to be updated often, it is preferred to create
627 * the texture as streaming and use the locking functions referenced below.
628 * While this function will work with streaming textures, for optimization
629 * reasons you may not get the pixels back if you lock the texture afterward.
630 *
631 * \param texture the texture to update
632 * \param rect an SDL_Rect structure representing the area to update, or NULL
633 * to update the entire texture
634 * \param pixels the raw pixel data in the format of the texture
635 * \param pitch the number of bytes in a row of pixel data, including padding
636 * between lines
637 * \returns 0 on success or a negative error code on failure; call
638 * SDL_GetError() for more information.
639 *
640 * \since This function is available since SDL 3.0.0.
641 *
642 * \sa SDL_CreateTexture
643 * \sa SDL_LockTexture
644 * \sa SDL_UnlockTexture
645 */
646extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
647
648/**
649 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
650 * data.
651 *
652 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
653 * block of Y and U/V planes in the proper order, but this function is
654 * available if your pixel data is not contiguous.
655 *
656 * \param texture the texture to update
657 * \param rect a pointer to the rectangle of pixels to update, or NULL to
658 * update the entire texture
659 * \param Yplane the raw pixel data for the Y plane
660 * \param Ypitch the number of bytes between rows of pixel data for the Y
661 * plane
662 * \param Uplane the raw pixel data for the U plane
663 * \param Upitch the number of bytes between rows of pixel data for the U
664 * plane
665 * \param Vplane the raw pixel data for the V plane
666 * \param Vpitch the number of bytes between rows of pixel data for the V
667 * plane
668 * \returns 0 on success or -1 if the texture is not valid; call
669 * SDL_GetError() for more information.
670 *
671 * \since This function is available since SDL 3.0.0.
672 *
673 * \sa SDL_UpdateTexture
674 */
675extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
676 const SDL_Rect *rect,
677 const Uint8 *Yplane, int Ypitch,
678 const Uint8 *Uplane, int Upitch,
679 const Uint8 *Vplane, int Vpitch);
680
681/**
682 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
683 *
684 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
685 * block of NV12/21 planes in the proper order, but this function is available
686 * if your pixel data is not contiguous.
687 *
688 * \param texture the texture to update
689 * \param rect a pointer to the rectangle of pixels to update, or NULL to
690 * update the entire texture.
691 * \param Yplane the raw pixel data for the Y plane.
692 * \param Ypitch the number of bytes between rows of pixel data for the Y
693 * plane.
694 * \param UVplane the raw pixel data for the UV plane.
695 * \param UVpitch the number of bytes between rows of pixel data for the UV
696 * plane.
697 * \return 0 on success, or -1 if the texture is not valid.
698 *
699 * \since This function is available since SDL 3.0.0.
700 */
701extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
702 const SDL_Rect *rect,
703 const Uint8 *Yplane, int Ypitch,
704 const Uint8 *UVplane, int UVpitch);
705
706/**
707 * Lock a portion of the texture for **write-only** pixel access.
708 *
709 * As an optimization, the pixels made available for editing don't necessarily
710 * contain the old texture data. This is a write-only operation, and if you
711 * need to keep a copy of the texture data you should do that at the
712 * application level.
713 *
714 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
715 * changes.
716 *
717 * \param texture the texture to lock for access, which was created with
718 * `SDL_TEXTUREACCESS_STREAMING`
719 * \param rect an SDL_Rect structure representing the area to lock for access;
720 * NULL to lock the entire texture
721 * \param pixels this is filled in with a pointer to the locked pixels,
722 * appropriately offset by the locked area
723 * \param pitch this is filled in with the pitch of the locked pixels; the
724 * pitch is the length of one row in bytes
725 * \returns 0 on success or a negative error code if the texture is not valid
726 * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
727 * SDL_GetError() for more information.
728 *
729 * \since This function is available since SDL 3.0.0.
730 *
731 * \sa SDL_UnlockTexture
732 */
733extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
734 const SDL_Rect *rect,
735 void **pixels, int *pitch);
736
737/**
738 * Lock a portion of the texture for **write-only** pixel access, and expose
739 * it as a SDL surface.
740 *
741 * Besides providing an SDL_Surface instead of raw pixel data, this function
742 * operates like SDL_LockTexture.
743 *
744 * As an optimization, the pixels made available for editing don't necessarily
745 * contain the old texture data. This is a write-only operation, and if you
746 * need to keep a copy of the texture data you should do that at the
747 * application level.
748 *
749 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
750 * changes.
751 *
752 * The returned surface is freed internally after calling SDL_UnlockTexture()
753 * or SDL_DestroyTexture(). The caller should not free it.
754 *
755 * \param texture the texture to lock for access, which was created with
756 * `SDL_TEXTUREACCESS_STREAMING`
757 * \param rect a pointer to the rectangle to lock for access. If the rect is
758 * NULL, the entire texture will be locked
759 * \param surface this is filled in with an SDL surface representing the
760 * locked area
761 * \returns 0 on success, or -1 if the texture is not valid or was not created
762 * with `SDL_TEXTUREACCESS_STREAMING`
763 *
764 * \since This function is available since SDL 3.0.0.
765 *
766 * \sa SDL_LockTexture
767 * \sa SDL_UnlockTexture
768 */
769extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
770 const SDL_Rect *rect,
771 SDL_Surface **surface);
772
773/**
774 * Unlock a texture, uploading the changes to video memory, if needed.
775 *
776 * **Warning**: Please note that SDL_LockTexture() is intended to be
777 * write-only; it will not guarantee the previous contents of the texture will
778 * be provided. You must fully initialize any area of a texture that you lock
779 * before unlocking it, as the pixels might otherwise be uninitialized memory.
780 *
781 * Which is to say: locking and immediately unlocking a texture can result in
782 * corrupted textures, depending on the renderer in use.
783 *
784 * \param texture a texture locked by SDL_LockTexture()
785 *
786 * \returns 0 on success or a negative error code on failure; call
787 * SDL_GetError() for more information.
788 *
789 * \since This function is available since SDL 3.0.0.
790 *
791 * \sa SDL_LockTexture
792 */
793extern DECLSPEC int SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
794
795/**
796 * Set a texture as the current rendering target.
797 *
798 * Before using this function, you should check the
799 * `SDL_RENDERER_TARGETTEXTURE` bit in the flags of SDL_RendererInfo to see if
800 * render targets are supported.
801 *
802 * The default render target is the window for which the renderer was created.
803 * To stop rendering to a texture and render to the window again, call this
804 * function with a NULL `texture`.
805 *
806 * \param renderer the rendering context
807 * \param texture the targeted texture, which must be created with the
808 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
809 * window instead of a texture.
810 * \returns 0 on success or a negative error code on failure; call
811 * SDL_GetError() for more information.
812 *
813 * \since This function is available since SDL 3.0.0.
814 *
815 * \sa SDL_GetRenderTarget
816 */
817extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
818
819/**
820 * Get the current render target.
821 *
822 * The default render target is the window for which the renderer was created,
823 * and is reported a NULL here.
824 *
825 * \param renderer the rendering context
826 * \returns the current render target or NULL for the default render target.
827 *
828 * \since This function is available since SDL 3.0.0.
829 *
830 * \sa SDL_SetRenderTarget
831 */
832extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
833
834/**
835 * Set a device independent resolution and presentation mode for rendering.
836 *
837 * This function sets the width and height of the logical rendering output.
838 * A render target is created at the specified size and used for rendering
839 * and then copied to the output during presentation.
840 *
841 * When a renderer is created, the logical size is set to match the window
842 * size in screen coordinates. The actual output size may be higher pixel
843 * density, and can be queried with SDL_GetRenderOutputSize().
844 *
845 * You can disable logical coordinates by setting the mode to
846 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full
847 * resolution of the output window.
848 *
849 * You can convert coordinates in an event into rendering coordinates using
850 * SDL_ConvertEventToRenderCoordinates().
851 *
852 * \param renderer the rendering context
853 * \param w the width of the logical resolution
854 * \param h the height of the logical resolution
855 * \param mode the presentation mode used
856 * \param scale_mode the scale mode used
857 * \returns 0 on success or a negative error code on failure; call
858 * SDL_GetError() for more information.
859 *
860 * \since This function is available since SDL 3.0.0.
861 *
862 * \sa SDL_ConvertEventToRenderCoordinates
863 * \sa SDL_GetRenderLogicalPresentation
864 */
865extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
866
867/**
868 * Get device independent resolution and presentation mode for rendering.
869 *
870 * This function gets the width and height of the logical rendering output,
871 * or the output size in pixels if a logical resolution is not enabled.
872 *
873 * \param renderer the rendering context
874 * \param w an int to be filled with the width
875 * \param h an int to be filled with the height
876 * \param mode a pointer filled in with the presentation mode
877 * \param scale_mode a pointer filled in with the scale mode
878 * \returns 0 on success or a negative error code on failure; call
879 * SDL_GetError() for more information.
880 *
881 * \since This function is available since SDL 3.0.0.
882 *
883 * \sa SDL_SetRenderLogicalPresentation
884 */
885extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
886
887/**
888 * Get a point in render coordinates when given a point in window coordinates.
889 *
890 * \param renderer the rendering context
891 * \param window_x the x coordinate in window coordinates
892 * \param window_y the y coordinate in window coordinates
893 * \param x a pointer filled with the x coordinate in render coordinates
894 * \param y a pointer filled with the y coordinate in render coordinates
895 * \returns 0 on success or a negative error code on failure; call
896 * SDL_GetError() for more information.
897 *
898 * \since This function is available since SDL 3.0.0.
899 *
900 * \sa SDL_SetRenderLogicalPresentation
901 * \sa SDL_SetRenderScale
902 */
903extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
904
905/**
906 * Get a point in window coordinates when given a point in render coordinates.
907 *
908 * \param renderer the rendering context
909 * \param x the x coordinate in render coordinates
910 * \param y the y coordinate in render coordinates
911 * \param window_x a pointer filled with the x coordinate in window coordinates
912 * \param window_y a pointer filled with the y coordinate in window coordinates
913 * \returns 0 on success or a negative error code on failure; call
914 * SDL_GetError() for more information.
915 *
916 * \since This function is available since SDL 3.0.0.
917 *
918 * \sa SDL_SetRenderLogicalPresentation
919 * \sa SDL_SetRenderScale
920 */
921extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
922
923/**
924 * Convert the coordinates in an event to render coordinates.
925 *
926 * Touch coordinates are converted from normalized coordinates in the window
927 * to non-normalized rendering coordinates.
928 *
929 * Once converted, the coordinates may be outside the rendering area.
930 *
931 * \param renderer the rendering context
932 * \param event the event to modify
933 * \returns 0 on success or a negative error code on failure; call
934 * SDL_GetError() for more information.
935 *
936 * \since This function is available since SDL 3.0.0.
937 *
938 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
939 */
940extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
941
942/**
943 * Set the drawing area for rendering on the current target.
944 *
945 * \param renderer the rendering context
946 * \param rect the SDL_Rect structure representing the drawing area, or NULL
947 * to set the viewport to the entire target
948 * \returns 0 on success or a negative error code on failure; call
949 * SDL_GetError() for more information.
950 *
951 * \since This function is available since SDL 3.0.0.
952 *
953 * \sa SDL_GetRenderViewport
954 */
955extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
956
957/**
958 * Get the drawing area for the current target.
959 *
960 * \param renderer the rendering context
961 * \param rect an SDL_Rect structure filled in with the current drawing area
962 * \returns 0 on success or a negative error code on failure; call
963 * SDL_GetError() for more information.
964 *
965 * \since This function is available since SDL 3.0.0.
966 *
967 * \sa SDL_SetRenderViewport
968 */
969extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
970
971/**
972 * Set the clip rectangle for rendering on the specified target.
973 *
974 * \param renderer the rendering context
975 * \param rect an SDL_Rect structure representing the clip area, relative to
976 * the viewport, or NULL to disable clipping
977 * \returns 0 on success or a negative error code on failure; call
978 * SDL_GetError() for more information.
979 *
980 * \since This function is available since SDL 3.0.0.
981 *
982 * \sa SDL_GetRenderClipRect
983 * \sa SDL_RenderClipEnabled
984 */
985extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
986
987/**
988 * Get the clip rectangle for the current target.
989 *
990 * \param renderer the rendering context
991 * \param rect an SDL_Rect structure filled in with the current clipping area
992 * or an empty rectangle if clipping is disabled
993 * \returns 0 on success or a negative error code on failure; call
994 * SDL_GetError() for more information.
995 *
996 * \since This function is available since SDL 3.0.0.
997 *
998 * \sa SDL_RenderClipEnabled
999 * \sa SDL_SetRenderClipRect
1000 */
1001extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1002
1003/**
1004 * Get whether clipping is enabled on the given renderer.
1005 *
1006 * \param renderer the rendering context
1007 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
1008 * SDL_GetError() for more information.
1009 *
1010 * \since This function is available since SDL 3.0.0.
1011 *
1012 * \sa SDL_GetRenderClipRect
1013 * \sa SDL_SetRenderClipRect
1014 */
1015extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1016
1017/**
1018 * Set the drawing scale for rendering on the current target.
1019 *
1020 * The drawing coordinates are scaled by the x/y scaling factors before they
1021 * are used by the renderer. This allows resolution independent drawing with a
1022 * single coordinate system.
1023 *
1024 * If this results in scaling or subpixel drawing by the rendering backend, it
1025 * will be handled using the appropriate quality hints. For best results use
1026 * integer scaling factors.
1027 *
1028 * \param renderer the rendering context
1029 * \param scaleX the horizontal scaling factor
1030 * \param scaleY the vertical scaling factor
1031 * \returns 0 on success or a negative error code on failure; call
1032 * SDL_GetError() for more information.
1033 *
1034 * \since This function is available since SDL 3.0.0.
1035 *
1036 * \sa SDL_GetRenderScale
1037 */
1038extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1039
1040/**
1041 * Get the drawing scale for the current target.
1042 *
1043 * \param renderer the rendering context
1044 * \param scaleX a pointer filled in with the horizontal scaling factor
1045 * \param scaleY a pointer filled in with the vertical scaling factor
1046 * \returns 0 on success or a negative error code on failure; call
1047 * SDL_GetError() for more information.
1048 *
1049 * \since This function is available since SDL 3.0.0.
1050 *
1051 * \sa SDL_SetRenderScale
1052 */
1053extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1054
1055/**
1056 * Set the color used for drawing operations (Rect, Line and Clear).
1057 *
1058 * Set the color for drawing or filling rectangles, lines, and points, and for
1059 * SDL_RenderClear().
1060 *
1061 * \param renderer the rendering context
1062 * \param r the red value used to draw on the rendering target
1063 * \param g the green value used to draw on the rendering target
1064 * \param b the blue value used to draw on the rendering target
1065 * \param a the alpha value used to draw on the rendering target; usually
1066 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1067 * specify how the alpha channel is used
1068 * \returns 0 on success or a negative error code on failure; call
1069 * SDL_GetError() for more information.
1070 *
1071 * \since This function is available since SDL 3.0.0.
1072 *
1073 * \sa SDL_GetRenderDrawColor
1074 * \sa SDL_RenderClear
1075 * \sa SDL_RenderLine
1076 * \sa SDL_RenderLines
1077 * \sa SDL_RenderPoint
1078 * \sa SDL_RenderPoints
1079 * \sa SDL_RenderRect
1080 * \sa SDL_RenderRects
1081 * \sa SDL_RenderFillRect
1082 * \sa SDL_RenderFillRects
1083 */
1084extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1085
1086/**
1087 * Get the color used for drawing operations (Rect, Line and Clear).
1088 *
1089 * \param renderer the rendering context
1090 * \param r a pointer filled in with the red value used to draw on the
1091 * rendering target
1092 * \param g a pointer filled in with the green value used to draw on the
1093 * rendering target
1094 * \param b a pointer filled in with the blue value used to draw on the
1095 * rendering target
1096 * \param a a pointer filled in with the alpha value used to draw on the
1097 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1098 * \returns 0 on success or a negative error code on failure; call
1099 * SDL_GetError() for more information.
1100 *
1101 * \since This function is available since SDL 3.0.0.
1102 *
1103 * \sa SDL_SetRenderDrawColor
1104 */
1105extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1106
1107/**
1108 * Set the blend mode used for drawing operations (Fill and Line).
1109 *
1110 * If the blend mode is not supported, the closest supported mode is chosen.
1111 *
1112 * \param renderer the rendering context
1113 * \param blendMode the SDL_BlendMode to use for blending
1114 * \returns 0 on success or a negative error code on failure; call
1115 * SDL_GetError() for more information.
1116 *
1117 * \since This function is available since SDL 3.0.0.
1118 *
1119 * \sa SDL_GetRenderDrawBlendMode
1120 * \sa SDL_RenderLine
1121 * \sa SDL_RenderLines
1122 * \sa SDL_RenderPoint
1123 * \sa SDL_RenderPoints
1124 * \sa SDL_RenderRect
1125 * \sa SDL_RenderRects
1126 * \sa SDL_RenderFillRect
1127 * \sa SDL_RenderFillRects
1128 */
1129extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1130
1131/**
1132 * Get the blend mode used for drawing operations.
1133 *
1134 * \param renderer the rendering context
1135 * \param blendMode a pointer filled in with the current SDL_BlendMode
1136 * \returns 0 on success or a negative error code on failure; call
1137 * SDL_GetError() for more information.
1138 *
1139 * \since This function is available since SDL 3.0.0.
1140 *
1141 * \sa SDL_SetRenderDrawBlendMode
1142 */
1143extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1144
1145/**
1146 * Clear the current rendering target with the drawing color.
1147 *
1148 * This function clears the entire rendering target, ignoring the viewport and
1149 * the clip rectangle.
1150 *
1151 * \param renderer the rendering context
1152 * \returns 0 on success or a negative error code on failure; call
1153 * SDL_GetError() for more information.
1154 *
1155 * \since This function is available since SDL 3.0.0.
1156 *
1157 * \sa SDL_SetRenderDrawColor
1158 */
1159extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1160
1161/**
1162 * Draw a point on the current rendering target at subpixel precision.
1163 *
1164 * \param renderer The renderer which should draw a point.
1165 * \param x The x coordinate of the point.
1166 * \param y The y coordinate of the point.
1167 * \return 0 on success, or -1 on error
1168 *
1169 * \since This function is available since SDL 3.0.0.
1170 */
1171extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1172
1173/**
1174 * Draw multiple points on the current rendering target at subpixel precision.
1175 *
1176 * \param renderer The renderer which should draw multiple points.
1177 * \param points The points to draw
1178 * \param count The number of points to draw
1179 * \return 0 on success, or -1 on error
1180 *
1181 * \since This function is available since SDL 3.0.0.
1182 */
1183extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1184
1185/**
1186 * Draw a line on the current rendering target at subpixel precision.
1187 *
1188 * \param renderer The renderer which should draw a line.
1189 * \param x1 The x coordinate of the start point.
1190 * \param y1 The y coordinate of the start point.
1191 * \param x2 The x coordinate of the end point.
1192 * \param y2 The y coordinate of the end point.
1193 * \return 0 on success, or -1 on error
1194 *
1195 * \since This function is available since SDL 3.0.0.
1196 */
1197extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1198
1199/**
1200 * Draw a series of connected lines on the current rendering target at
1201 * subpixel precision.
1202 *
1203 * \param renderer The renderer which should draw multiple lines.
1204 * \param points The points along the lines
1205 * \param count The number of points, drawing count-1 lines
1206 * \return 0 on success, or -1 on error
1207 *
1208 * \since This function is available since SDL 3.0.0.
1209 */
1210extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1211
1212/**
1213 * Draw a rectangle on the current rendering target at subpixel precision.
1214 *
1215 * \param renderer The renderer which should draw a rectangle.
1216 * \param rect A pointer to the destination rectangle, or NULL to outline the
1217 * entire rendering target.
1218 * \return 0 on success, or -1 on error
1219 *
1220 * \since This function is available since SDL 3.0.0.
1221 */
1222extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1223
1224/**
1225 * Draw some number of rectangles on the current rendering target at subpixel
1226 * precision.
1227 *
1228 * \param renderer The renderer which should draw multiple rectangles.
1229 * \param rects A pointer to an array of destination rectangles.
1230 * \param count The number of rectangles.
1231 * \return 0 on success, or -1 on error
1232 *
1233 * \since This function is available since SDL 3.0.0.
1234 */
1235extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1236
1237/**
1238 * Fill a rectangle on the current rendering target with the drawing color at
1239 * subpixel precision.
1240 *
1241 * \param renderer The renderer which should fill a rectangle.
1242 * \param rect A pointer to the destination rectangle, or NULL for the entire
1243 * rendering target.
1244 * \return 0 on success, or -1 on error
1245 *
1246 * \since This function is available since SDL 3.0.0.
1247 */
1248extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1249
1250/**
1251 * Fill some number of rectangles on the current rendering target with the
1252 * drawing color at subpixel precision.
1253 *
1254 * \param renderer The renderer which should fill multiple rectangles.
1255 * \param rects A pointer to an array of destination rectangles.
1256 * \param count The number of rectangles.
1257 * \return 0 on success, or -1 on error
1258 *
1259 * \since This function is available since SDL 3.0.0.
1260 */
1261extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1262
1263/**
1264 * Copy a portion of the texture to the current rendering target at subpixel
1265 * precision.
1266 *
1267 * \param renderer The renderer which should copy parts of a texture.
1268 * \param texture The source texture.
1269 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1270 * texture.
1271 * \param dstrect A pointer to the destination rectangle, or NULL for the
1272 * entire rendering target.
1273 * \return 0 on success, or -1 on error
1274 *
1275 * \since This function is available since SDL 3.0.0.
1276 */
1277extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect);
1278
1279/**
1280 * Copy a portion of the source texture to the current rendering target, with
1281 * rotation and flipping, at subpixel precision.
1282 *
1283 * \param renderer The renderer which should copy parts of a texture.
1284 * \param texture The source texture.
1285 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1286 * texture.
1287 * \param dstrect A pointer to the destination rectangle, or NULL for the
1288 * entire rendering target.
1289 * \param angle An angle in degrees that indicates the rotation that will be
1290 * applied to dstrect, rotating it in a clockwise direction
1291 * \param center A pointer to a point indicating the point around which
1292 * dstrect will be rotated (if NULL, rotation will be done
1293 * around dstrect.w/2, dstrect.h/2).
1294 * \param flip An SDL_RendererFlip value stating which flipping actions should
1295 * be performed on the texture
1296 * \return 0 on success, or -1 on error
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_Rect *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 * \return 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,
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 * \return 0 on success, or -1 if the operation is not supported
1349 *
1350 * \since This function is available since SDL 3.0.0.
1351 *
1352 * \sa SDL_RenderGeometry
1353 * \sa SDL_Vertex
1354 */
1355extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1357 const float *xy, int xy_stride,
1358 const SDL_Color *color, int color_stride,
1359 const float *uv, int uv_stride,
1360 int num_vertices,
1361 const void *indices, int num_indices, int size_indices);
1362
1363/**
1364 * Read pixels from the current rendering target to an array of pixels.
1365 *
1366 * **WARNING**: This is a very slow operation, and should not be used
1367 * frequently. If you're using this on the main rendering target, it should be
1368 * called after rendering and before SDL_RenderPresent().
1369 *
1370 * `pitch` specifies the number of bytes between rows in the destination
1371 * `pixels` data. This allows you to write to a subrectangle or have padded
1372 * rows in the destination. Generally, `pitch` should equal the number of
1373 * pixels per row in the `pixels` data times the number of bytes per pixel,
1374 * but it might contain additional padding (for example, 24bit RGB Windows
1375 * Bitmap data pads all rows to multiples of 4 bytes).
1376 *
1377 * \param renderer the rendering context
1378 * \param rect an SDL_Rect structure representing the area in pixels relative
1379 * to the to current viewport, or NULL for the entire viewport
1380 * \param format an SDL_PixelFormatEnum value of the desired format of the
1381 * pixel data, or 0 to use the format of the rendering target
1382 * \param pixels a pointer to the pixel data to copy into
1383 * \param pitch the pitch of the `pixels` parameter
1384 * \returns 0 on success or a negative error code on failure; call
1385 * SDL_GetError() for more information.
1386 *
1387 * \since This function is available since SDL 3.0.0.
1388 */
1389extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1390 const SDL_Rect *rect,
1391 Uint32 format,
1392 void *pixels, int pitch);
1393
1394/**
1395 * Update the screen with any rendering performed since the previous call.
1396 *
1397 * SDL's rendering functions operate on a backbuffer; that is, calling a
1398 * rendering function such as SDL_RenderLine() does not directly put a line on
1399 * the screen, but rather updates the backbuffer. As such, you compose your
1400 * entire scene and *present* the composed backbuffer to the screen as a
1401 * complete picture.
1402 *
1403 * Therefore, when using SDL's rendering API, one does all drawing intended
1404 * for the frame, and then calls this function once per frame to present the
1405 * final drawing to the user.
1406 *
1407 * The backbuffer should be considered invalidated after each present; do not
1408 * assume that previous contents will exist between frames. You are strongly
1409 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1410 * starting each new frame's drawing, even if you plan to overwrite every
1411 * pixel.
1412 *
1413 * \param renderer the rendering context
1414 * \returns 0 on success or a negative error code on failure; call
1415 * SDL_GetError() for more information.
1416 *
1417 * \threadsafety You may only call this function on the main thread.
1418 *
1419 * \since This function is available since SDL 3.0.0.
1420 *
1421 * \sa SDL_RenderClear
1422 * \sa SDL_RenderLine
1423 * \sa SDL_RenderLines
1424 * \sa SDL_RenderPoint
1425 * \sa SDL_RenderPoints
1426 * \sa SDL_RenderRect
1427 * \sa SDL_RenderRects
1428 * \sa SDL_RenderFillRect
1429 * \sa SDL_RenderFillRects
1430 * \sa SDL_SetRenderDrawBlendMode
1431 * \sa SDL_SetRenderDrawColor
1432 */
1433extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1434
1435/**
1436 * Destroy the specified texture.
1437 *
1438 * Passing NULL or an otherwise invalid texture will set the SDL error message
1439 * to "Invalid texture".
1440 *
1441 * \param texture the texture to destroy
1442 * \returns 0 on success or a negative error code on failure; call
1443 * SDL_GetError() for more information.
1444 *
1445 * \since This function is available since SDL 3.0.0.
1446 *
1447 * \sa SDL_CreateTexture
1448 * \sa SDL_CreateTextureFromSurface
1449 */
1450extern DECLSPEC int SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1451
1452/**
1453 * Destroy the rendering context for a window and free associated textures.
1454 *
1455 * If `renderer` is NULL, this function will return immediately after setting
1456 * the SDL error message to "Invalid renderer". See SDL_GetError().
1457 *
1458 * \param renderer the rendering context
1459 * \returns 0 on success or a negative error code on failure; call
1460 * SDL_GetError() for more information.
1461 *
1462 * \since This function is available since SDL 3.0.0.
1463 *
1464 * \sa SDL_CreateRenderer
1465 */
1466extern DECLSPEC int SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1467
1468/**
1469 * Force the rendering context to flush any pending commands to the underlying
1470 * rendering API.
1471 *
1472 * You do not need to (and in fact, shouldn't) call this function unless you
1473 * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
1474 * addition to using an SDL_Renderer.
1475 *
1476 * This is for a very-specific case: if you are using SDL's render API, you
1477 * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
1478 * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
1479 * calls in addition to SDL render API calls. If all of this applies, you
1480 * should call SDL_RenderFlush() between calls to SDL's render API and the
1481 * low-level API you're using in cooperation.
1482 *
1483 * In all other cases, you can ignore this function. This is only here to get
1484 * maximum performance out of a specific situation. In all other cases, SDL
1485 * will do the right thing, perhaps at a performance loss.
1486 *
1487 * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
1488 * and earlier, as earlier versions did not queue rendering commands at all,
1489 * instead flushing them to the OS immediately.
1490 *
1491 * \param renderer the rendering context
1492 * \returns 0 on success or a negative error code on failure; call
1493 * SDL_GetError() for more information.
1494 *
1495 * \since This function is available since SDL 3.0.0.
1496 */
1497extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
1498
1499
1500/**
1501 * Bind an OpenGL/ES/ES2 texture to the current context.
1502 *
1503 * This is for use with OpenGL instructions when rendering OpenGL primitives
1504 * directly.
1505 *
1506 * If not NULL, `texw` and `texh` will be filled with the width and height
1507 * values suitable for the provided texture. In most cases, both will be 1.0,
1508 * however, on systems that support the GL_ARB_texture_rectangle extension,
1509 * these values will actually be the pixel width and height used to create the
1510 * texture, so this factor needs to be taken into account when providing
1511 * texture coordinates to OpenGL.
1512 *
1513 * You need a renderer to create an SDL_Texture, therefore you can only use
1514 * this function with an implicit OpenGL context from SDL_CreateRenderer(),
1515 * not with your own OpenGL context. If you need control over your OpenGL
1516 * context, you need to write your own texture-loading methods.
1517 *
1518 * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
1519 * re-order the color channels in the shaders phase, so the uploaded texture
1520 * may have swapped color channels.
1521 *
1522 * \param texture the texture to bind to the current OpenGL/ES/ES2 context
1523 * \param texw a pointer to a float value which will be filled with the
1524 * texture width or NULL if you don't need that value
1525 * \param texh a pointer to a float value which will be filled with the
1526 * texture height or NULL if you don't need that value
1527 * \returns 0 on success, or -1 if the operation is not supported; call
1528 * SDL_GetError() for more information.
1529 *
1530 * \since This function is available since SDL 3.0.0.
1531 *
1532 * \sa SDL_GL_MakeCurrent
1533 * \sa SDL_GL_UnbindTexture
1534 */
1535extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
1536
1537/**
1538 * Unbind an OpenGL/ES/ES2 texture from the current context.
1539 *
1540 * See SDL_GL_BindTexture() for examples on how to use these functions
1541 *
1542 * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
1543 * \returns 0 on success, or -1 if the operation is not supported
1544 *
1545 * \since This function is available since SDL 3.0.0.
1546 *
1547 * \sa SDL_GL_BindTexture
1548 * \sa SDL_GL_MakeCurrent
1549 */
1550extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
1551
1552/**
1553 * Get the CAMetalLayer associated with the given Metal renderer.
1554 *
1555 * This function returns `void *`, so SDL doesn't have to include Metal's
1556 * headers, but it can be safely cast to a `CAMetalLayer *`.
1557 *
1558 * \param renderer The renderer to query
1559 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1560 * Metal renderer
1561 *
1562 * \since This function is available since SDL 3.0.0.
1563 *
1564 * \sa SDL_GetRenderMetalCommandEncoder
1565 */
1566extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1567
1568/**
1569 * Get the Metal command encoder for the current frame
1570 *
1571 * This function returns `void *`, so SDL doesn't have to include Metal's
1572 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1573 *
1574 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1575 * SDL a drawable to render to, which might happen if the window is
1576 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1577 * render targets, just the window's backbacker. Check your return values!
1578 *
1579 * \param renderer The renderer to query
1580 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1581 * renderer isn't a Metal renderer or there was an error.
1582 *
1583 * \since This function is available since SDL 3.0.0.
1584 *
1585 * \sa SDL_GetRenderMetalLayer
1586 */
1587extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1588
1589/**
1590 * Toggle VSync of the given renderer.
1591 *
1592 * \param renderer The renderer to toggle
1593 * \param vsync 1 for on, 0 for off. All other values are reserved
1594 * \returns a 0 int on success, or non-zero on failure
1595 *
1596 * \since This function is available since SDL 3.0.0.
1597 */
1598extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1599
1600/**
1601 * Get VSync of the given renderer.
1602 *
1603 * \param renderer The renderer to toggle
1604 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1605 * reserved
1606 * \returns a 0 int on success, or non-zero on failure
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.
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
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)
int SDL_UnlockTexture(SDL_Texture *texture)
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)
int SDL_GetNumRenderDrivers(void)
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_RendererFlags
Definition: SDL_render.h:65
@ SDL_RENDERER_SOFTWARE
Definition: SDL_render.h:66
@ SDL_RENDERER_ACCELERATED
Definition: SDL_render.h:67
@ SDL_RENDERER_PRESENTVSYNC
Definition: SDL_render.h:69
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:130
@ SDL_FLIP_VERTICAL
Definition: SDL_render.h:133
@ SDL_FLIP_NONE
Definition: SDL_render.h:131
@ SDL_FLIP_HORIZONTAL
Definition: SDL_render.h:132
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:110
@ SDL_TEXTUREACCESS_STATIC
Definition: SDL_render.h:111
@ SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:112
@ SDL_TEXTUREACCESS_TARGET
Definition: SDL_render.h:113
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:100
@ SDL_SCALEMODE_LINEAR
Definition: SDL_render.h:102
@ SDL_SCALEMODE_NEAREST
Definition: SDL_render.h:101
@ SDL_SCALEMODE_BEST
Definition: SDL_render.h:103
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:120
@ SDL_TEXTUREMODULATE_NONE
Definition: SDL_render.h:121
@ SDL_TEXTUREMODULATE_ALPHA
Definition: SDL_render.h:123
@ SDL_TEXTUREMODULATE_COLOR
Definition: SDL_render.h:122
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:140
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition: SDL_render.h:144
@ SDL_LOGICAL_PRESENTATION_MATCH
Definition: SDL_render.h:142
@ SDL_LOGICAL_PRESENTATION_DISABLED
Definition: SDL_render.h:141
@ 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_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)
int SDL_DestroyTexture(SDL_Texture *texture)
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: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_DestroyRenderer(SDL_Renderer *renderer)
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:78
int max_texture_height
Definition: SDL_render.h:83
Uint32 texture_formats[16]
Definition: SDL_render.h:81
Uint32 num_texture_formats
Definition: SDL_render.h:80
A collection of pixels used in software blitting.
Definition: SDL_surface.h:73
SDL_FPoint tex_coord
Definition: SDL_render.h:93
SDL_Color color
Definition: SDL_render.h:92
SDL_FPoint position
Definition: SDL_render.h:91
General event structure.
Definition: SDL_events.h:588