SDL 3.0
SDL_render.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_render.h
24 *
25 * \brief Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 * * single pixel points
29 * * single pixel lines
30 * * filled rectangles
31 * * texture images
32 *
33 * The primitives may be drawn in opaque, blended, or additive modes.
34 *
35 * The texture images may be drawn in opaque, blended, or additive modes.
36 * They can have an additional color tint or alpha modulation applied to
37 * them, and may also be stretched with linear interpolation.
38 *
39 * This API is designed to accelerate simple 2D operations. You may
40 * want more functionality such as polygons and particle effects and
41 * in that case you should use SDL's OpenGL/Direct3D support or one
42 * of the many good 3D engines.
43 *
44 * These functions must be called from the main thread.
45 * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
46 */
47
48#ifndef SDL_render_h_
49#define SDL_render_h_
50
51#include <SDL3/SDL_stdinc.h>
52#include <SDL3/SDL_events.h>
53#include <SDL3/SDL_rect.h>
54#include <SDL3/SDL_video.h>
55
56#include <SDL3/SDL_begin_code.h>
57/* Set up for C function definitions, even when using C++ */
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62/**
63 * Flags used when creating a rendering context
64 */
65typedef enum
66{
67 SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
68 SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
69 acceleration */
70 SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
71 with the refresh rate */
73
74/**
75 * Information on the capabilities of a render driver or context.
76 */
77typedef struct SDL_RendererInfo
78{
79 const char *name; /**< The name of the renderer */
80 Uint32 flags; /**< Supported ::SDL_RendererFlags */
81 Uint32 num_texture_formats; /**< The number of available texture formats */
82 Uint32 texture_formats[16]; /**< The available texture formats */
83 int max_texture_width; /**< The maximum texture width */
84 int max_texture_height; /**< The maximum texture height */
86
87/**
88 * Vertex structure
89 */
90typedef struct SDL_Vertex
91{
92 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
93 SDL_Color color; /**< Vertex color */
94 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
96
97/**
98 * The scaling mode for a texture.
99 */
100typedef enum
101{
102 SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */
103 SDL_SCALEMODE_LINEAR, /**< linear filtering */
104 SDL_SCALEMODE_BEST /**< anisotropic filtering */
106
107/**
108 * The access pattern allowed for a texture.
109 */
110typedef enum
111{
112 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
113 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
114 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
116
117/**
118 * The texture channel modulation used in SDL_RenderTexture().
119 */
120typedef enum
121{
122 SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */
123 SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */
124 SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */
126
127/**
128 * Flip constants for SDL_RenderTextureRotated
129 */
130typedef enum
131{
132 SDL_FLIP_NONE = 0x00000000, /**< Do not flip */
133 SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */
134 SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */
136
137/**
138 * How the logical size is mapped to the output
139 */
140typedef enum
141{
142 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
143 SDL_LOGICAL_PRESENTATION_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
239 * coordinates, but you can call SDL_SetRenderLogicalPresentation() to enable
240 * high DPI 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 or
341 * 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 rendering
359 * target in pixels, otherwise if a logical size is set, it will return the
360 * 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. A
840 * render target is created at the specified size and used for rendering and
841 * 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, or
873 * 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
914 * coordinates
915 * \param window_y a pointer filled with the y coordinate in window
916 * coordinates
917 * \returns 0 on success or a negative error code on failure; call
918 * SDL_GetError() for more information.
919 *
920 * \since This function is available since SDL 3.0.0.
921 *
922 * \sa SDL_SetRenderLogicalPresentation
923 * \sa SDL_SetRenderScale
924 */
925extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
926
927/**
928 * Convert the coordinates in an event to render coordinates.
929 *
930 * Touch coordinates are converted from normalized coordinates in the window
931 * to non-normalized rendering coordinates.
932 *
933 * Once converted, the coordinates may be outside the rendering area.
934 *
935 * \param renderer the rendering context
936 * \param event the event to modify
937 * \returns 0 on success or a negative error code on failure; call
938 * SDL_GetError() for more information.
939 *
940 * \since This function is available since SDL 3.0.0.
941 *
942 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
943 */
944extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
945
946/**
947 * Set the drawing area for rendering on the current target.
948 *
949 * \param renderer the rendering context
950 * \param rect the SDL_Rect structure representing the drawing area, or NULL
951 * to set the viewport to the entire target
952 * \returns 0 on success or a negative error code on failure; call
953 * SDL_GetError() for more information.
954 *
955 * \since This function is available since SDL 3.0.0.
956 *
957 * \sa SDL_GetRenderViewport
958 */
959extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
960
961/**
962 * Get the drawing area for the current target.
963 *
964 * \param renderer the rendering context
965 * \param rect an SDL_Rect structure filled in with the current drawing area
966 * \returns 0 on success or a negative error code on failure; call
967 * SDL_GetError() for more information.
968 *
969 * \since This function is available since SDL 3.0.0.
970 *
971 * \sa SDL_SetRenderViewport
972 */
973extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
974
975/**
976 * Set the clip rectangle for rendering on the specified target.
977 *
978 * \param renderer the rendering context
979 * \param rect an SDL_Rect structure representing the clip area, relative to
980 * the viewport, or NULL to disable clipping
981 * \returns 0 on success or a negative error code on failure; call
982 * SDL_GetError() for more information.
983 *
984 * \since This function is available since SDL 3.0.0.
985 *
986 * \sa SDL_GetRenderClipRect
987 * \sa SDL_RenderClipEnabled
988 */
989extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
990
991/**
992 * Get the clip rectangle for the current target.
993 *
994 * \param renderer the rendering context
995 * \param rect an SDL_Rect structure filled in with the current clipping area
996 * or an empty rectangle if clipping is disabled
997 * \returns 0 on success or a negative error code on failure; call
998 * SDL_GetError() for more information.
999 *
1000 * \since This function is available since SDL 3.0.0.
1001 *
1002 * \sa SDL_RenderClipEnabled
1003 * \sa SDL_SetRenderClipRect
1004 */
1005extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1006
1007/**
1008 * Get whether clipping is enabled on the given renderer.
1009 *
1010 * \param renderer the rendering context
1011 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
1012 * SDL_GetError() for more information.
1013 *
1014 * \since This function is available since SDL 3.0.0.
1015 *
1016 * \sa SDL_GetRenderClipRect
1017 * \sa SDL_SetRenderClipRect
1018 */
1019extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1020
1021/**
1022 * Set the drawing scale for rendering on the current target.
1023 *
1024 * The drawing coordinates are scaled by the x/y scaling factors before they
1025 * are used by the renderer. This allows resolution independent drawing with a
1026 * single coordinate system.
1027 *
1028 * If this results in scaling or subpixel drawing by the rendering backend, it
1029 * will be handled using the appropriate quality hints. For best results use
1030 * integer scaling factors.
1031 *
1032 * \param renderer the rendering context
1033 * \param scaleX the horizontal scaling factor
1034 * \param scaleY the vertical scaling factor
1035 * \returns 0 on success or a negative error code on failure; call
1036 * SDL_GetError() for more information.
1037 *
1038 * \since This function is available since SDL 3.0.0.
1039 *
1040 * \sa SDL_GetRenderScale
1041 */
1042extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1043
1044/**
1045 * Get the drawing scale for the current target.
1046 *
1047 * \param renderer the rendering context
1048 * \param scaleX a pointer filled in with the horizontal scaling factor
1049 * \param scaleY a pointer filled in with the vertical scaling factor
1050 * \returns 0 on success or a negative error code on failure; call
1051 * SDL_GetError() for more information.
1052 *
1053 * \since This function is available since SDL 3.0.0.
1054 *
1055 * \sa SDL_SetRenderScale
1056 */
1057extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1058
1059/**
1060 * Set the color used for drawing operations (Rect, Line and Clear).
1061 *
1062 * Set the color for drawing or filling rectangles, lines, and points, and for
1063 * SDL_RenderClear().
1064 *
1065 * \param renderer the rendering context
1066 * \param r the red value used to draw on the rendering target
1067 * \param g the green value used to draw on the rendering target
1068 * \param b the blue value used to draw on the rendering target
1069 * \param a the alpha value used to draw on the rendering target; usually
1070 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1071 * specify how the alpha channel is used
1072 * \returns 0 on success or a negative error code on failure; call
1073 * SDL_GetError() for more information.
1074 *
1075 * \since This function is available since SDL 3.0.0.
1076 *
1077 * \sa SDL_GetRenderDrawColor
1078 * \sa SDL_RenderClear
1079 * \sa SDL_RenderLine
1080 * \sa SDL_RenderLines
1081 * \sa SDL_RenderPoint
1082 * \sa SDL_RenderPoints
1083 * \sa SDL_RenderRect
1084 * \sa SDL_RenderRects
1085 * \sa SDL_RenderFillRect
1086 * \sa SDL_RenderFillRects
1087 */
1088extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1089
1090/**
1091 * Get the color used for drawing operations (Rect, Line and Clear).
1092 *
1093 * \param renderer the rendering context
1094 * \param r a pointer filled in with the red value used to draw on the
1095 * rendering target
1096 * \param g a pointer filled in with the green value used to draw on the
1097 * rendering target
1098 * \param b a pointer filled in with the blue value used to draw on the
1099 * rendering target
1100 * \param a a pointer filled in with the alpha value used to draw on the
1101 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1102 * \returns 0 on success or a negative error code on failure; call
1103 * SDL_GetError() for more information.
1104 *
1105 * \since This function is available since SDL 3.0.0.
1106 *
1107 * \sa SDL_SetRenderDrawColor
1108 */
1109extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1110
1111/**
1112 * Set the blend mode used for drawing operations (Fill and Line).
1113 *
1114 * If the blend mode is not supported, the closest supported mode is chosen.
1115 *
1116 * \param renderer the rendering context
1117 * \param blendMode the SDL_BlendMode to use for blending
1118 * \returns 0 on success or a negative error code on failure; call
1119 * SDL_GetError() for more information.
1120 *
1121 * \since This function is available since SDL 3.0.0.
1122 *
1123 * \sa SDL_GetRenderDrawBlendMode
1124 * \sa SDL_RenderLine
1125 * \sa SDL_RenderLines
1126 * \sa SDL_RenderPoint
1127 * \sa SDL_RenderPoints
1128 * \sa SDL_RenderRect
1129 * \sa SDL_RenderRects
1130 * \sa SDL_RenderFillRect
1131 * \sa SDL_RenderFillRects
1132 */
1133extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1134
1135/**
1136 * Get the blend mode used for drawing operations.
1137 *
1138 * \param renderer the rendering context
1139 * \param blendMode a pointer filled in with the current SDL_BlendMode
1140 * \returns 0 on success or a negative error code on failure; call
1141 * SDL_GetError() for more information.
1142 *
1143 * \since This function is available since SDL 3.0.0.
1144 *
1145 * \sa SDL_SetRenderDrawBlendMode
1146 */
1147extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1148
1149/**
1150 * Clear the current rendering target with the drawing color.
1151 *
1152 * This function clears the entire rendering target, ignoring the viewport and
1153 * the clip rectangle.
1154 *
1155 * \param renderer the rendering context
1156 * \returns 0 on success or a negative error code on failure; call
1157 * SDL_GetError() for more information.
1158 *
1159 * \since This function is available since SDL 3.0.0.
1160 *
1161 * \sa SDL_SetRenderDrawColor
1162 */
1163extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1164
1165/**
1166 * Draw a point on the current rendering target at subpixel precision.
1167 *
1168 * \param renderer The renderer which should draw a point.
1169 * \param x The x coordinate of the point.
1170 * \param y The y coordinate of the point.
1171 * \returns 0 on success, or -1 on error
1172 *
1173 * \since This function is available since SDL 3.0.0.
1174 */
1175extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1176
1177/**
1178 * Draw multiple points on the current rendering target at subpixel precision.
1179 *
1180 * \param renderer The renderer which should draw multiple points.
1181 * \param points The points to draw
1182 * \param count The number of points to draw
1183 * \returns 0 on success or a negative error code on failure; call
1184 * SDL_GetError() for more information.
1185 *
1186 * \since This function is available since SDL 3.0.0.
1187 */
1188extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1189
1190/**
1191 * Draw a line on the current rendering target at subpixel precision.
1192 *
1193 * \param renderer The renderer which should draw a line.
1194 * \param x1 The x coordinate of the start point.
1195 * \param y1 The y coordinate of the start point.
1196 * \param x2 The x coordinate of the end point.
1197 * \param y2 The y coordinate of the end point.
1198 * \returns 0 on success, or -1 on error
1199 *
1200 * \since This function is available since SDL 3.0.0.
1201 */
1202extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1203
1204/**
1205 * Draw a series of connected lines on the current rendering target at
1206 * subpixel precision.
1207 *
1208 * \param renderer The renderer which should draw multiple lines.
1209 * \param points The points along the lines
1210 * \param count The number of points, drawing count-1 lines
1211 * \returns 0 on success or a negative error code on failure; call
1212 * SDL_GetError() for more information.
1213 *
1214 * \since This function is available since SDL 3.0.0.
1215 */
1216extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1217
1218/**
1219 * Draw a rectangle on the current rendering target at subpixel precision.
1220 *
1221 * \param renderer The renderer which should draw a rectangle.
1222 * \param rect A pointer to the destination rectangle, or NULL to outline the
1223 * entire rendering target.
1224 * \returns 0 on success, or -1 on error
1225 *
1226 * \since This function is available since SDL 3.0.0.
1227 */
1228extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1229
1230/**
1231 * Draw some number of rectangles on the current rendering target at subpixel
1232 * precision.
1233 *
1234 * \param renderer The renderer which should draw multiple rectangles.
1235 * \param rects A pointer to an array of destination rectangles.
1236 * \param count The number of rectangles.
1237 * \returns 0 on success or a negative error code on failure; call
1238 * SDL_GetError() for more information.
1239 *
1240 * \since This function is available since SDL 3.0.0.
1241 */
1242extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1243
1244/**
1245 * Fill a rectangle on the current rendering target with the drawing color at
1246 * subpixel precision.
1247 *
1248 * \param renderer The renderer which should fill a rectangle.
1249 * \param rect A pointer to the destination rectangle, or NULL for the entire
1250 * rendering target.
1251 * \returns 0 on success, or -1 on error
1252 *
1253 * \since This function is available since SDL 3.0.0.
1254 */
1255extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1256
1257/**
1258 * Fill some number of rectangles on the current rendering target with the
1259 * drawing color at subpixel precision.
1260 *
1261 * \param renderer The renderer which should fill multiple rectangles.
1262 * \param rects A pointer to an array of destination rectangles.
1263 * \param count The number of rectangles.
1264 * \returns 0 on success or a negative error code on failure; call
1265 * SDL_GetError() for more information.
1266 *
1267 * \since This function is available since SDL 3.0.0.
1268 */
1269extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1270
1271/**
1272 * Copy a portion of the texture to the current rendering target at subpixel
1273 * precision.
1274 *
1275 * \param renderer The renderer which should copy parts of a texture.
1276 * \param texture The source texture.
1277 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1278 * texture.
1279 * \param dstrect A pointer to the destination rectangle, or NULL for the
1280 * entire rendering target.
1281 * \returns 0 on success, or -1 on error
1282 *
1283 * \since This function is available since SDL 3.0.0.
1284 */
1285extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
1286
1287/**
1288 * Copy a portion of the source texture to the current rendering target, with
1289 * rotation and flipping, at subpixel precision.
1290 *
1291 * \param renderer The renderer which should copy parts of a texture.
1292 * \param texture The source texture.
1293 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1294 * texture.
1295 * \param dstrect A pointer to the destination rectangle, or NULL for the
1296 * entire rendering target.
1297 * \param angle An angle in degrees that indicates the rotation that will be
1298 * applied to dstrect, rotating it in a clockwise direction
1299 * \param center A pointer to a point indicating the point around which
1300 * dstrect will be rotated (if NULL, rotation will be done
1301 * around dstrect.w/2, dstrect.h/2).
1302 * \param flip An SDL_RendererFlip value stating which flipping actions should
1303 * be performed on the texture
1304 * \returns 0 on success or a negative error code on failure; call
1305 * SDL_GetError() for more information.
1306 *
1307 * \since This function is available since SDL 3.0.0.
1308 */
1309extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
1310 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
1311 const double angle, const SDL_FPoint *center,
1312 const SDL_RendererFlip flip);
1313
1314/**
1315 * Render a list of triangles, optionally using a texture and indices into the
1316 * vertex array Color and alpha modulation is done per vertex
1317 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1318 *
1319 * \param renderer The rendering context.
1320 * \param texture (optional) The SDL texture to use.
1321 * \param vertices Vertices.
1322 * \param num_vertices Number of vertices.
1323 * \param indices (optional) An array of integer indices into the 'vertices'
1324 * array, if NULL all vertices will be rendered in sequential
1325 * order.
1326 * \param num_indices Number of indices.
1327 * \returns 0 on success, or -1 if the operation is not supported
1328 *
1329 * \since This function is available since SDL 3.0.0.
1330 *
1331 * \sa SDL_RenderGeometryRaw
1332 * \sa SDL_Vertex
1333 */
1334extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1335 SDL_Texture *texture,
1336 const SDL_Vertex *vertices, int num_vertices,
1337 const int *indices, int num_indices);
1338
1339/**
1340 * Render a list of triangles, optionally using a texture and indices into the
1341 * vertex arrays Color and alpha modulation is done per vertex
1342 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1343 *
1344 * \param renderer The rendering context.
1345 * \param texture (optional) The SDL texture to use.
1346 * \param xy Vertex positions
1347 * \param xy_stride Byte size to move from one element to the next element
1348 * \param color Vertex colors (as SDL_Color)
1349 * \param color_stride Byte size to move from one element to the next element
1350 * \param uv Vertex normalized texture coordinates
1351 * \param uv_stride Byte size to move from one element to the next element
1352 * \param num_vertices Number of vertices.
1353 * \param indices (optional) An array of indices into the 'vertices' arrays,
1354 * if NULL all vertices will be rendered in sequential order.
1355 * \param num_indices Number of indices.
1356 * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
1357 * \returns 0 on success or a negative error code on failure; call
1358 * SDL_GetError() for more information.
1359 *
1360 * \since This function is available since SDL 3.0.0.
1361 *
1362 * \sa SDL_RenderGeometry
1363 * \sa SDL_Vertex
1364 */
1365extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1366 SDL_Texture *texture,
1367 const float *xy, int xy_stride,
1368 const SDL_Color *color, int color_stride,
1369 const float *uv, int uv_stride,
1370 int num_vertices,
1371 const void *indices, int num_indices, int size_indices);
1372
1373/**
1374 * Read pixels from the current rendering target to an array of pixels.
1375 *
1376 * **WARNING**: This is a very slow operation, and should not be used
1377 * frequently. If you're using this on the main rendering target, it should be
1378 * called after rendering and before SDL_RenderPresent().
1379 *
1380 * `pitch` specifies the number of bytes between rows in the destination
1381 * `pixels` data. This allows you to write to a subrectangle or have padded
1382 * rows in the destination. Generally, `pitch` should equal the number of
1383 * pixels per row in the `pixels` data times the number of bytes per pixel,
1384 * but it might contain additional padding (for example, 24bit RGB Windows
1385 * Bitmap data pads all rows to multiples of 4 bytes).
1386 *
1387 * \param renderer the rendering context
1388 * \param rect an SDL_Rect structure representing the area in pixels relative
1389 * to the to current viewport, or NULL for the entire viewport
1390 * \param format an SDL_PixelFormatEnum value of the desired format of the
1391 * pixel data, or 0 to use the format of the rendering target
1392 * \param pixels a pointer to the pixel data to copy into
1393 * \param pitch the pitch of the `pixels` parameter
1394 * \returns 0 on success or a negative error code on failure; call
1395 * SDL_GetError() for more information.
1396 *
1397 * \since This function is available since SDL 3.0.0.
1398 */
1399extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1400 const SDL_Rect *rect,
1401 Uint32 format,
1402 void *pixels, int pitch);
1403
1404/**
1405 * Update the screen with any rendering performed since the previous call.
1406 *
1407 * SDL's rendering functions operate on a backbuffer; that is, calling a
1408 * rendering function such as SDL_RenderLine() does not directly put a line on
1409 * the screen, but rather updates the backbuffer. As such, you compose your
1410 * entire scene and *present* the composed backbuffer to the screen as a
1411 * complete picture.
1412 *
1413 * Therefore, when using SDL's rendering API, one does all drawing intended
1414 * for the frame, and then calls this function once per frame to present the
1415 * final drawing to the user.
1416 *
1417 * The backbuffer should be considered invalidated after each present; do not
1418 * assume that previous contents will exist between frames. You are strongly
1419 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1420 * starting each new frame's drawing, even if you plan to overwrite every
1421 * pixel.
1422 *
1423 * \param renderer the rendering context
1424 * \returns 0 on success or a negative error code on failure; call
1425 * SDL_GetError() for more information.
1426 *
1427 * \threadsafety You may only call this function on the main thread.
1428 *
1429 * \since This function is available since SDL 3.0.0.
1430 *
1431 * \sa SDL_RenderClear
1432 * \sa SDL_RenderLine
1433 * \sa SDL_RenderLines
1434 * \sa SDL_RenderPoint
1435 * \sa SDL_RenderPoints
1436 * \sa SDL_RenderRect
1437 * \sa SDL_RenderRects
1438 * \sa SDL_RenderFillRect
1439 * \sa SDL_RenderFillRects
1440 * \sa SDL_SetRenderDrawBlendMode
1441 * \sa SDL_SetRenderDrawColor
1442 */
1443extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1444
1445/**
1446 * Destroy the specified texture.
1447 *
1448 * Passing NULL or an otherwise invalid texture will set the SDL error message
1449 * to "Invalid texture".
1450 *
1451 * \param texture the texture to destroy
1452 *
1453 * \since This function is available since SDL 3.0.0.
1454 *
1455 * \sa SDL_CreateTexture
1456 * \sa SDL_CreateTextureFromSurface
1457 */
1458extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1459
1460/**
1461 * Destroy the rendering context for a window and free associated textures.
1462 *
1463 * If `renderer` is NULL, this function will return immediately after setting
1464 * the SDL error message to "Invalid renderer". See SDL_GetError().
1465 *
1466 * \param renderer the rendering context
1467 *
1468 * \since This function is available since SDL 3.0.0.
1469 *
1470 * \sa SDL_CreateRenderer
1471 */
1472extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1473
1474/**
1475 * Force the rendering context to flush any pending commands to the underlying
1476 * rendering API.
1477 *
1478 * You do not need to (and in fact, shouldn't) call this function unless you
1479 * are planning to call into OpenGL/Direct3D/Metal/whatever directly in
1480 * addition to using an SDL_Renderer.
1481 *
1482 * This is for a very-specific case: if you are using SDL's render API, you
1483 * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
1484 * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
1485 * calls in addition to SDL render API calls. If all of this applies, you
1486 * should call SDL_RenderFlush() between calls to SDL's render API and the
1487 * low-level API you're using in cooperation.
1488 *
1489 * In all other cases, you can ignore this function. This is only here to get
1490 * maximum performance out of a specific situation. In all other cases, SDL
1491 * will do the right thing, perhaps at a performance loss.
1492 *
1493 * This function is first available in SDL 2.0.10, and is not needed in 2.0.9
1494 * and earlier, as earlier versions did not queue rendering commands at all,
1495 * instead flushing them to the OS immediately.
1496 *
1497 * \param renderer the rendering context
1498 * \returns 0 on success or a negative error code on failure; call
1499 * SDL_GetError() for more information.
1500 *
1501 * \since This function is available since SDL 3.0.0.
1502 */
1503extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer *renderer);
1504
1505
1506/**
1507 * Bind an OpenGL/ES/ES2 texture to the current context.
1508 *
1509 * This is for use with OpenGL instructions when rendering OpenGL primitives
1510 * directly.
1511 *
1512 * If not NULL, `texw` and `texh` will be filled with the width and height
1513 * values suitable for the provided texture. In most cases, both will be 1.0,
1514 * however, on systems that support the GL_ARB_texture_rectangle extension,
1515 * these values will actually be the pixel width and height used to create the
1516 * texture, so this factor needs to be taken into account when providing
1517 * texture coordinates to OpenGL.
1518 *
1519 * You need a renderer to create an SDL_Texture, therefore you can only use
1520 * this function with an implicit OpenGL context from SDL_CreateRenderer(),
1521 * not with your own OpenGL context. If you need control over your OpenGL
1522 * context, you need to write your own texture-loading methods.
1523 *
1524 * Also note that SDL may upload RGB textures as BGR (or vice-versa), and
1525 * re-order the color channels in the shaders phase, so the uploaded texture
1526 * may have swapped color channels.
1527 *
1528 * \param texture the texture to bind to the current OpenGL/ES/ES2 context
1529 * \param texw a pointer to a float value which will be filled with the
1530 * texture width or NULL if you don't need that value
1531 * \param texh a pointer to a float value which will be filled with the
1532 * texture height or NULL if you don't need that value
1533 * \returns 0 on success or a negative error code on failure; call
1534 * SDL_GetError() for more information.
1535 *
1536 * \since This function is available since SDL 3.0.0.
1537 *
1538 * \sa SDL_GL_MakeCurrent
1539 * \sa SDL_GL_UnbindTexture
1540 */
1541extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh);
1542
1543/**
1544 * Unbind an OpenGL/ES/ES2 texture from the current context.
1545 *
1546 * See SDL_GL_BindTexture() for examples on how to use these functions
1547 *
1548 * \param texture the texture to unbind from the current OpenGL/ES/ES2 context
1549 * \returns 0 on success or a negative error code on failure; call
1550 * SDL_GetError() for more information.
1551 *
1552 * \since This function is available since SDL 3.0.0.
1553 *
1554 * \sa SDL_GL_BindTexture
1555 * \sa SDL_GL_MakeCurrent
1556 */
1557extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture);
1558
1559/**
1560 * Get the CAMetalLayer associated with the given Metal renderer.
1561 *
1562 * This function returns `void *`, so SDL doesn't have to include Metal's
1563 * headers, but it can be safely cast to a `CAMetalLayer *`.
1564 *
1565 * \param renderer The renderer to query
1566 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1567 * Metal renderer
1568 *
1569 * \since This function is available since SDL 3.0.0.
1570 *
1571 * \sa SDL_GetRenderMetalCommandEncoder
1572 */
1573extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1574
1575/**
1576 * Get the Metal command encoder for the current frame
1577 *
1578 * This function returns `void *`, so SDL doesn't have to include Metal's
1579 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1580 *
1581 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1582 * SDL a drawable to render to, which might happen if the window is
1583 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1584 * render targets, just the window's backbacker. Check your return values!
1585 *
1586 * \param renderer The renderer to query
1587 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1588 * renderer isn't a Metal renderer or there was an error.
1589 *
1590 * \since This function is available since SDL 3.0.0.
1591 *
1592 * \sa SDL_GetRenderMetalLayer
1593 */
1594extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1595
1596/**
1597 * Toggle VSync of the given renderer.
1598 *
1599 * \param renderer The renderer to toggle
1600 * \param vsync 1 for on, 0 for off. All other values are reserved
1601 * \returns 0 on success or a negative error code on failure; call
1602 * SDL_GetError() for more information.
1603 *
1604 * \since This function is available since SDL 3.0.0.
1605 */
1606extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1607
1608/**
1609 * Get VSync of the given renderer.
1610 *
1611 * \param renderer The renderer to toggle
1612 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1613 * reserved
1614 * \returns 0 on success or a negative error code on failure; call
1615 * SDL_GetError() for more information.
1616 *
1617 * \since This function is available since SDL 3.0.0.
1618 */
1619extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
1620
1621/* Ends C function definitions when using C++ */
1622#ifdef __cplusplus
1623}
1624#endif
1625#include <SDL3/SDL_close_code.h>
1626
1627#endif /* SDL_render_h_ */
SDL_BlendMode
The blend mode used in SDL_RenderTexture() and drawing operations.
Definition: SDL_blendmode.h:41
Header file for SDL_rect definition and management functions.
void SDL_DestroyTexture(SDL_Texture *texture)
int SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode)
int SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
struct SDL_Texture SDL_Texture
Definition: SDL_render.h: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)
int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
void SDL_UnlockTexture(SDL_Texture *texture)
int SDL_GetNumRenderDrivers(void)
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_RendererFlags
Definition: SDL_render.h:66
@ SDL_RENDERER_SOFTWARE
Definition: SDL_render.h:67
@ SDL_RENDERER_ACCELERATED
Definition: SDL_render.h:68
@ SDL_RENDERER_PRESENTVSYNC
Definition: SDL_render.h:70
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
int SDL_GL_UnbindTexture(SDL_Texture *texture)
int SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
SDL_RendererFlip
Definition: SDL_render.h:131
@ SDL_FLIP_VERTICAL
Definition: SDL_render.h:134
@ SDL_FLIP_NONE
Definition: SDL_render.h:132
@ SDL_FLIP_HORIZONTAL
Definition: SDL_render.h:133
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
SDL_TextureAccess
Definition: SDL_render.h:111
@ SDL_TEXTUREACCESS_STATIC
Definition: SDL_render.h:112
@ SDL_TEXTUREACCESS_STREAMING
Definition: SDL_render.h:113
@ SDL_TEXTUREACCESS_TARGET
Definition: SDL_render.h:114
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
int SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_SetTextureUserData(SDL_Texture *texture, void *userdata)
SDL_ScaleMode
Definition: SDL_render.h:101
@ SDL_SCALEMODE_LINEAR
Definition: SDL_render.h:103
@ SDL_SCALEMODE_NEAREST
Definition: SDL_render.h:102
@ SDL_SCALEMODE_BEST
Definition: SDL_render.h:104
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
SDL_bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
int SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
SDL_TextureModulate
Definition: SDL_render.h:121
@ SDL_TEXTUREMODULATE_NONE
Definition: SDL_render.h:122
@ SDL_TEXTUREMODULATE_ALPHA
Definition: SDL_render.h:124
@ SDL_TEXTUREMODULATE_COLOR
Definition: SDL_render.h:123
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
SDL_RendererLogicalPresentation
Definition: SDL_render.h:141
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition: SDL_render.h: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_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_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
int SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
int SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
int SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_RenderPresent(SDL_Renderer *renderer)
This is a general header that includes C language support.
uint8_t Uint8
Definition: SDL_stdinc.h:147
SDL_bool
Definition: SDL_stdinc.h:130
uint32_t Uint32
Definition: SDL_stdinc.h:171
Header file for SDL video functions.
struct SDL_Window SDL_Window
The type used to identify a window.
Definition: SDL_video.h:124
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:594