SDL 3.0
SDL_render.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 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 * # CategoryRender
24 *
25 * Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 *
29 * - single pixel points
30 * - single pixel lines
31 * - filled rectangles
32 * - texture images
33 * - 2D polygons
34 *
35 * The primitives may be drawn in opaque, blended, or additive modes.
36 *
37 * The texture images may be drawn in opaque, blended, or additive modes. They
38 * can have an additional color tint or alpha modulation applied to them, and
39 * may also be stretched with linear interpolation.
40 *
41 * This API is designed to accelerate simple 2D operations. You may want more
42 * functionality such as polygons and particle effects and in that case you
43 * should use SDL's OpenGL/Direct3D support, the SDL3 GPU API, or one of the
44 * many good 3D engines.
45 *
46 * These functions must be called from the main thread. See this bug for
47 * details: https://github.com/libsdl-org/SDL/issues/986
48 */
49
50#ifndef SDL_render_h_
51#define SDL_render_h_
52
53#include <SDL3/SDL_stdinc.h>
54#include <SDL3/SDL_blendmode.h>
55#include <SDL3/SDL_error.h>
56#include <SDL3/SDL_events.h>
57#include <SDL3/SDL_pixels.h>
58#include <SDL3/SDL_properties.h>
59#include <SDL3/SDL_rect.h>
60#include <SDL3/SDL_surface.h>
61#include <SDL3/SDL_video.h>
62
63#include <SDL3/SDL_begin_code.h>
64/* Set up for C function definitions, even when using C++ */
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69/**
70 * The name of the software renderer.
71 *
72 * \since This macro is available since SDL 3.0.0.
73 */
74#define SDL_SOFTWARE_RENDERER "software"
75
76/**
77 * Vertex structure.
78 *
79 * \since This struct is available since SDL 3.0.0.
80 */
81typedef struct SDL_Vertex
82{
83 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
84 SDL_FColor color; /**< Vertex color */
85 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
87
88/**
89 * The access pattern allowed for a texture.
90 *
91 * \since This enum is available since SDL 3.0.0.
92 */
94{
95 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
96 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
97 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
99
100/**
101 * How the logical size is mapped to the output.
102 *
103 * \since This enum is available since SDL 3.0.0.
104 */
106{
107 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
108 SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
109 SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars */
110 SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
111 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE /**< The rendered content is scaled up by integer multiples to fit the output resolution */
113
114/**
115 * A structure representing rendering state
116 *
117 * \since This struct is available since SDL 3.0.0.
118 */
120
121#ifndef SDL_INTERNAL
122
123/**
124 * An efficient driver-specific representation of pixel data
125 *
126 * \since This struct is available since SDL 3.0.0.
127 *
128 * \sa SDL_CreateTexture
129 * \sa SDL_CreateTextureFromSurface
130 * \sa SDL_CreateTextureWithProperties
131 * \sa SDL_DestroyTexture
132 */
134{
135 SDL_PixelFormat format; /**< The format of the texture, read-only */
136 int w; /**< The width of the texture, read-only. */
137 int h; /**< The height of the texture, read-only. */
138
139 int refcount; /**< Application reference count, used when freeing texture */
140};
141#endif /* !SDL_INTERNAL */
142
143typedef struct SDL_Texture SDL_Texture;
144
145/* Function prototypes */
146
147/**
148 * Get the number of 2D rendering drivers available for the current display.
149 *
150 * A render driver is a set of code that handles rendering and texture
151 * management on a particular display. Normally there is only one, but some
152 * drivers may have several available with different capabilities.
153 *
154 * There may be none if SDL was compiled without render support.
155 *
156 * \returns the number of built in render drivers.
157 *
158 * \threadsafety It is safe to call this function from any thread.
159 *
160 * \since This function is available since SDL 3.0.0.
161 *
162 * \sa SDL_CreateRenderer
163 * \sa SDL_GetRenderDriver
164 */
165extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
166
167/**
168 * Use this function to get the name of a built in 2D rendering driver.
169 *
170 * The list of rendering drivers is given in the order that they are normally
171 * initialized by default; the drivers that seem more reasonable to choose
172 * first (as far as the SDL developers believe) are earlier in the list.
173 *
174 * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
175 * "direct3d12" or "metal". These never have Unicode characters, and are not
176 * meant to be proper names.
177 *
178 * \param index the index of the rendering driver; the value ranges from 0 to
179 * SDL_GetNumRenderDrivers() - 1.
180 * \returns the name of the rendering driver at the requested index, or NULL
181 * if an invalid index was specified.
182 *
183 * \threadsafety It is safe to call this function from any thread.
184 *
185 * \since This function is available since SDL 3.0.0.
186 *
187 * \sa SDL_GetNumRenderDrivers
188 */
189extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index);
190
191/**
192 * Create a window and default renderer.
193 *
194 * \param title the title of the window, in UTF-8 encoding.
195 * \param width the width of the window.
196 * \param height the height of the window.
197 * \param window_flags the flags used to create the window (see
198 * SDL_CreateWindow()).
199 * \param window a pointer filled with the window, or NULL on error.
200 * \param renderer a pointer filled with the renderer, or NULL on error.
201 * \returns true on success or false on failure; call SDL_GetError() for more
202 * information.
203 *
204 * \threadsafety You may only call this function from the main thread.
205 *
206 * \since This function is available since SDL 3.0.0.
207 *
208 * \sa SDL_CreateRenderer
209 * \sa SDL_CreateWindow
210 */
211extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer);
212
213/**
214 * Create a 2D rendering context for a window.
215 *
216 * If you want a specific renderer, you can specify its name here. A list of
217 * available renderers can be obtained by calling SDL_GetRenderDriver multiple
218 * times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you don't
219 * need a specific renderer, specify NULL and SDL will attempt to choose the
220 * best option for you, based on what is available on the user's system.
221 *
222 * By default the rendering size matches the window size in pixels, but you
223 * can call SDL_SetRenderLogicalPresentation() to change the content size and
224 * scaling options.
225 *
226 * \param window the window where rendering is displayed.
227 * \param name the name of the rendering driver to initialize, or NULL to
228 * initialize the first one supporting the requested flags.
229 * \returns a valid rendering context or NULL if there was an error; call
230 * SDL_GetError() for more information.
231 *
232 * \threadsafety You may only call this function from the main thread.
233 *
234 * \since This function is available since SDL 3.0.0.
235 *
236 * \sa SDL_CreateRendererWithProperties
237 * \sa SDL_CreateSoftwareRenderer
238 * \sa SDL_DestroyRenderer
239 * \sa SDL_GetNumRenderDrivers
240 * \sa SDL_GetRenderDriver
241 * \sa SDL_GetRendererName
242 */
243extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name);
244
245/**
246 * Create a 2D rendering context for a window, with the specified properties.
247 *
248 * These are the supported properties:
249 *
250 * - `SDL_PROP_RENDERER_CREATE_NAME_STRING`: the name of the rendering driver
251 * to use, if a specific one is desired
252 * - `SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`: the window where rendering is
253 * displayed, required if this isn't a software renderer using a surface
254 * - `SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`: the surface where rendering
255 * is displayed, if you want a software renderer without a window
256 * - `SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace
257 * value describing the colorspace for output to the display, defaults to
258 * SDL_COLORSPACE_SRGB. The direct3d11, direct3d12, and metal renderers
259 * support SDL_COLORSPACE_SRGB_LINEAR, which is a linear color space and
260 * supports HDR output. If you select SDL_COLORSPACE_SRGB_LINEAR, drawing
261 * still uses the sRGB colorspace, but values can go beyond 1.0 and float
262 * (linear) format textures can be used for HDR content.
263 * - `SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER`: non-zero if you want
264 * present synchronized with the refresh rate. This property can take any
265 * value that is supported by SDL_SetRenderVSync() for the renderer.
266 *
267 * With the vulkan renderer:
268 *
269 * - `SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER`: the VkInstance to use
270 * with the renderer, optional.
271 * - `SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR to use
272 * with the renderer, optional.
273 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER`: the
274 * VkPhysicalDevice to use with the renderer, optional.
275 * - `SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER`: the VkDevice to use
276 * with the renderer, optional.
277 * - `SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the
278 * queue family index used for rendering.
279 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the
280 * queue family index used for presentation.
281 *
282 * \param props the properties to use.
283 * \returns a valid rendering context or NULL if there was an error; call
284 * SDL_GetError() for more information.
285 *
286 * \threadsafety You may only call this function from the main thread.
287 *
288 * \since This function is available since SDL 3.0.0.
289 *
290 * \sa SDL_CreateProperties
291 * \sa SDL_CreateRenderer
292 * \sa SDL_CreateSoftwareRenderer
293 * \sa SDL_DestroyRenderer
294 * \sa SDL_GetRendererName
295 */
297
298#define SDL_PROP_RENDERER_CREATE_NAME_STRING "SDL.renderer.create.name"
299#define SDL_PROP_RENDERER_CREATE_WINDOW_POINTER "SDL.renderer.create.window"
300#define SDL_PROP_RENDERER_CREATE_SURFACE_POINTER "SDL.renderer.create.surface"
301#define SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.create.output_colorspace"
302#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER "SDL.renderer.create.present_vsync"
303#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER "SDL.renderer.create.vulkan.instance"
304#define SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER "SDL.renderer.create.vulkan.surface"
305#define SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.create.vulkan.physical_device"
306#define SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER "SDL.renderer.create.vulkan.device"
307#define SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.graphics_queue_family_index"
308#define SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.present_queue_family_index"
309
310/**
311 * Create a 2D software rendering context for a surface.
312 *
313 * Two other API which can be used to create SDL_Renderer:
314 * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
315 * create a software renderer, but they are intended to be used with an
316 * SDL_Window as the final destination and not an SDL_Surface.
317 *
318 * \param surface the SDL_Surface structure representing the surface where
319 * rendering is done.
320 * \returns a valid rendering context or NULL if there was an error; call
321 * SDL_GetError() for more information.
322 *
323 * \threadsafety You may only call this function from the main thread.
324 *
325 * \since This function is available since SDL 3.0.0.
326 *
327 * \sa SDL_DestroyRenderer
328 */
329extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
330
331/**
332 * Get the renderer associated with a window.
333 *
334 * \param window the window to query.
335 * \returns the rendering context on success or NULL on failure; call
336 * SDL_GetError() for more information.
337 *
338 * \threadsafety It is safe to call this function from any thread.
339 *
340 * \since This function is available since SDL 3.0.0.
341 */
342extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window);
343
344/**
345 * Get the window associated with a renderer.
346 *
347 * \param renderer the renderer to query.
348 * \returns the window on success or NULL on failure; call SDL_GetError() for
349 * more information.
350 *
351 * \threadsafety It is safe to call this function from any thread.
352 *
353 * \since This function is available since SDL 3.0.0.
354 */
355extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
356
357/**
358 * Get the name of a renderer.
359 *
360 * \param renderer the rendering context.
361 * \returns the name of the selected renderer, or NULL on failure; call
362 * SDL_GetError() for more information.
363 *
364 * \threadsafety It is safe to call this function from any thread.
365 *
366 * \since This function is available since SDL 3.0.0.
367 *
368 * \sa SDL_CreateRenderer
369 * \sa SDL_CreateRendererWithProperties
370 */
371extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer);
372
373/**
374 * Get the properties associated with a renderer.
375 *
376 * The following read-only properties are provided by SDL:
377 *
378 * - `SDL_PROP_RENDERER_NAME_STRING`: the name of the rendering driver
379 * - `SDL_PROP_RENDERER_WINDOW_POINTER`: the window where rendering is
380 * displayed, if any
381 * - `SDL_PROP_RENDERER_SURFACE_POINTER`: the surface where rendering is
382 * displayed, if this is a software renderer without a window
383 * - `SDL_PROP_RENDERER_VSYNC_NUMBER`: the current vsync setting
384 * - `SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`: the maximum texture width
385 * and height
386 * - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormat *)
387 * array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
388 * representing the available texture formats for this renderer.
389 * - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace value
390 * describing the colorspace for output to the display, defaults to
391 * SDL_COLORSPACE_SRGB.
392 * - `SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN`: true if the output colorspace is
393 * SDL_COLORSPACE_SRGB_LINEAR and the renderer is showing on a display with
394 * HDR enabled. This property can change dynamically when
395 * SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
396 * - `SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT`: the value of SDR white in the
397 * SDL_COLORSPACE_SRGB_LINEAR colorspace. When HDR is enabled, this value is
398 * automatically multiplied into the color scale. This property can change
399 * dynamically when SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
400 * - `SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT`: the additional high dynamic range
401 * that can be displayed, in terms of the SDR white point. When HDR is not
402 * enabled, this will be 1.0. This property can change dynamically when
403 * SDL_EVENT_DISPLAY_HDR_STATE_CHANGED is sent.
404 *
405 * With the direct3d renderer:
406 *
407 * - `SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`: the IDirect3DDevice9 associated
408 * with the renderer
409 *
410 * With the direct3d11 renderer:
411 *
412 * - `SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`: the ID3D11Device associated
413 * with the renderer
414 * - `SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER`: the IDXGISwapChain1
415 * associated with the renderer. This may change when the window is resized.
416 *
417 * With the direct3d12 renderer:
418 *
419 * - `SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`: the ID3D12Device associated
420 * with the renderer
421 * - `SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER`: the IDXGISwapChain4
422 * associated with the renderer.
423 * - `SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`: the ID3D12CommandQueue
424 * associated with the renderer
425 *
426 * With the vulkan renderer:
427 *
428 * - `SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER`: the VkInstance associated
429 * with the renderer
430 * - `SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR associated
431 * with the renderer
432 * - `SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER`: the VkPhysicalDevice
433 * associated with the renderer
434 * - `SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER`: the VkDevice associated with
435 * the renderer
436 * - `SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the queue
437 * family index used for rendering
438 * - `SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the queue
439 * family index used for presentation
440 * - `SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`: the number of
441 * swapchain images, or potential frames in flight, used by the Vulkan
442 * renderer
443 *
444 * \param renderer the rendering context.
445 * \returns a valid property ID on success or 0 on failure; call
446 * SDL_GetError() for more information.
447 *
448 * \threadsafety It is safe to call this function from any thread.
449 *
450 * \since This function is available since SDL 3.0.0.
451 */
452extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer);
453
454#define SDL_PROP_RENDERER_NAME_STRING "SDL.renderer.name"
455#define SDL_PROP_RENDERER_WINDOW_POINTER "SDL.renderer.window"
456#define SDL_PROP_RENDERER_SURFACE_POINTER "SDL.renderer.surface"
457#define SDL_PROP_RENDERER_VSYNC_NUMBER "SDL.renderer.vsync"
458#define SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER "SDL.renderer.max_texture_size"
459#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER "SDL.renderer.texture_formats"
460#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.output_colorspace"
461#define SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN "SDL.renderer.HDR_enabled"
462#define SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT "SDL.renderer.SDR_white_point"
463#define SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT "SDL.renderer.HDR_headroom"
464#define SDL_PROP_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device"
465#define SDL_PROP_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device"
466#define SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER "SDL.renderer.d3d11.swap_chain"
467#define SDL_PROP_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device"
468#define SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER "SDL.renderer.d3d12.swap_chain"
469#define SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER "SDL.renderer.d3d12.command_queue"
470#define SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER "SDL.renderer.vulkan.instance"
471#define SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER "SDL.renderer.vulkan.surface"
472#define SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.vulkan.physical_device"
473#define SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER "SDL.renderer.vulkan.device"
474#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.graphics_queue_family_index"
475#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.present_queue_family_index"
476#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER "SDL.renderer.vulkan.swapchain_image_count"
477
478/**
479 * Get the output size in pixels of a rendering context.
480 *
481 * This returns the true output size in pixels, ignoring any render targets or
482 * logical size and presentation.
483 *
484 * \param renderer the rendering context.
485 * \param w a pointer filled in with the width in pixels.
486 * \param h a pointer filled in with the height in pixels.
487 * \returns true on success or false on failure; call SDL_GetError() for more
488 * information.
489 *
490 * \threadsafety You may only call this function from the main thread.
491 *
492 * \since This function is available since SDL 3.0.0.
493 *
494 * \sa SDL_GetCurrentRenderOutputSize
495 */
496extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
497
498/**
499 * Get the current output size in pixels of a rendering context.
500 *
501 * If a rendering target is active, this will return the size of the rendering
502 * target in pixels, otherwise if a logical size is set, it will return the
503 * logical size, otherwise it will return the value of
504 * SDL_GetRenderOutputSize().
505 *
506 * \param renderer the rendering context.
507 * \param w a pointer filled in with the current width.
508 * \param h a pointer filled in with the current height.
509 * \returns true on success or false on failure; call SDL_GetError() for more
510 * information.
511 *
512 * \threadsafety You may only call this function from the main thread.
513 *
514 * \since This function is available since SDL 3.0.0.
515 *
516 * \sa SDL_GetRenderOutputSize
517 */
518extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
519
520/**
521 * Create a texture for a rendering context.
522 *
523 * The contents of a texture when first created are not defined.
524 *
525 * \param renderer the rendering context.
526 * \param format one of the enumerated values in SDL_PixelFormat.
527 * \param access one of the enumerated values in SDL_TextureAccess.
528 * \param w the width of the texture in pixels.
529 * \param h the height of the texture in pixels.
530 * \returns a pointer to the created texture or NULL if no rendering context
531 * was active, the format was unsupported, or the width or height
532 * were out of range; call SDL_GetError() for more information.
533 *
534 * \threadsafety You may only call this function from the main thread.
535 *
536 * \since This function is available since SDL 3.0.0.
537 *
538 * \sa SDL_CreateTextureFromSurface
539 * \sa SDL_CreateTextureWithProperties
540 * \sa SDL_DestroyTexture
541 * \sa SDL_GetTextureSize
542 * \sa SDL_UpdateTexture
543 */
544extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, SDL_TextureAccess access, int w, int h);
545
546/**
547 * Create a texture from an existing surface.
548 *
549 * The surface is not modified or freed by this function.
550 *
551 * The SDL_TextureAccess hint for the created texture is
552 * `SDL_TEXTUREACCESS_STATIC`.
553 *
554 * The pixel format of the created texture may be different from the pixel
555 * format of the surface, and can be queried using the
556 * SDL_PROP_TEXTURE_FORMAT_NUMBER property.
557 *
558 * \param renderer the rendering context.
559 * \param surface the SDL_Surface structure containing pixel data used to fill
560 * the texture.
561 * \returns the created texture or NULL on failure; call SDL_GetError() for
562 * more information.
563 *
564 * \threadsafety You may only call this function from the main thread.
565 *
566 * \since This function is available since SDL 3.0.0.
567 *
568 * \sa SDL_CreateTexture
569 * \sa SDL_CreateTextureWithProperties
570 * \sa SDL_DestroyTexture
571 */
572extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
573
574/**
575 * Create a texture for a rendering context with the specified properties.
576 *
577 * These are the supported properties:
578 *
579 * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_ColorSpace value
580 * describing the texture colorspace, defaults to SDL_COLORSPACE_SRGB_LINEAR
581 * for floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures,
582 * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for
583 * YUV textures.
584 * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in
585 * SDL_PixelFormat, defaults to the best RGBA format for the renderer
586 * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in
587 * SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC
588 * - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in
589 * pixels, required
590 * - `SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`: the height of the texture in
591 * pixels, required
592 * - `SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating
593 * point textures, this defines the value of 100% diffuse white, with higher
594 * values being displayed in the High Dynamic Range headroom. This defaults
595 * to 100 for HDR10 textures and 1.0 for floating point textures.
596 * - `SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT`: for HDR10 and floating
597 * point textures, this defines the maximum dynamic range used by the
598 * content, in terms of the SDR white point. This would be equivalent to
599 * maxCLL / SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT for HDR10 content.
600 * If this is defined, any values outside the range supported by the display
601 * will be scaled into the available HDR headroom, otherwise they are
602 * clipped.
603 *
604 * With the direct3d11 renderer:
605 *
606 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D
607 * associated with the texture, if you want to wrap an existing texture.
608 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
609 * associated with the U plane of a YUV texture, if you want to wrap an
610 * existing texture.
611 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
612 * associated with the V plane of a YUV texture, if you want to wrap an
613 * existing texture.
614 *
615 * With the direct3d12 renderer:
616 *
617 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`: the ID3D12Resource
618 * associated with the texture, if you want to wrap an existing texture.
619 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource
620 * associated with the U plane of a YUV texture, if you want to wrap an
621 * existing texture.
622 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource
623 * associated with the V plane of a YUV texture, if you want to wrap an
624 * existing texture.
625 *
626 * With the metal renderer:
627 *
628 * - `SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER`: the CVPixelBufferRef
629 * associated with the texture, if you want to create a texture from an
630 * existing pixel buffer.
631 *
632 * With the opengl renderer:
633 *
634 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`: the GLuint texture
635 * associated with the texture, if you want to wrap an existing texture.
636 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
637 * associated with the UV plane of an NV12 texture, if you want to wrap an
638 * existing texture.
639 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture
640 * associated with the U plane of a YUV texture, if you want to wrap an
641 * existing texture.
642 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture
643 * associated with the V plane of a YUV texture, if you want to wrap an
644 * existing texture.
645 *
646 * With the opengles2 renderer:
647 *
648 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
649 * associated with the texture, if you want to wrap an existing texture.
650 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
651 * associated with the texture, if you want to wrap an existing texture.
652 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
653 * associated with the UV plane of an NV12 texture, if you want to wrap an
654 * existing texture.
655 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
656 * associated with the U plane of a YUV texture, if you want to wrap an
657 * existing texture.
658 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
659 * associated with the V plane of a YUV texture, if you want to wrap an
660 * existing texture.
661 *
662 * With the vulkan renderer:
663 *
664 * - `SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`: the VkImage with layout
665 * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL associated with the texture, if
666 * you want to wrap an existing texture.
667 *
668 * \param renderer the rendering context.
669 * \param props the properties to use.
670 * \returns a pointer to the created texture or NULL if no rendering context
671 * was active, the format was unsupported, or the width or height
672 * were out of range; call SDL_GetError() for more information.
673 *
674 * \threadsafety You may only call this function from the main thread.
675 *
676 * \since This function is available since SDL 3.0.0.
677 *
678 * \sa SDL_CreateProperties
679 * \sa SDL_CreateTexture
680 * \sa SDL_CreateTextureFromSurface
681 * \sa SDL_DestroyTexture
682 * \sa SDL_GetTextureSize
683 * \sa SDL_UpdateTexture
684 */
685extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props);
686
687#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER "SDL.texture.create.colorspace"
688#define SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER "SDL.texture.create.format"
689#define SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER "SDL.texture.create.access"
690#define SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER "SDL.texture.create.width"
691#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER "SDL.texture.create.height"
692#define SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT "SDL.texture.create.SDR_white_point"
693#define SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT "SDL.texture.create.HDR_headroom"
694#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "SDL.texture.create.d3d11.texture"
695#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER "SDL.texture.create.d3d11.texture_u"
696#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER "SDL.texture.create.d3d11.texture_v"
697#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "SDL.texture.create.d3d12.texture"
698#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER "SDL.texture.create.d3d12.texture_u"
699#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER "SDL.texture.create.d3d12.texture_v"
700#define SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER "SDL.texture.create.metal.pixelbuffer"
701#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER "SDL.texture.create.opengl.texture"
702#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.create.opengl.texture_uv"
703#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.create.opengl.texture_u"
704#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.create.opengl.texture_v"
705#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.create.opengles2.texture"
706#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.create.opengles2.texture_uv"
707#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.create.opengles2.texture_u"
708#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.create.opengles2.texture_v"
709#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER "SDL.texture.create.vulkan.texture"
710
711/**
712 * Get the properties associated with a texture.
713 *
714 * The following read-only properties are provided by SDL:
715 *
716 * - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_ColorSpace value describing
717 * the texture colorspace.
718 * - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
719 * SDL_PixelFormat.
720 * - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
721 * SDL_TextureAccess.
722 * - `SDL_PROP_TEXTURE_WIDTH_NUMBER`: the width of the texture in pixels.
723 * - `SDL_PROP_TEXTURE_HEIGHT_NUMBER`: the height of the texture in pixels.
724 * - `SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
725 * textures, this defines the value of 100% diffuse white, with higher
726 * values being displayed in the High Dynamic Range headroom. This defaults
727 * to 100 for HDR10 textures and 1.0 for other textures.
728 * - `SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
729 * textures, this defines the maximum dynamic range used by the content, in
730 * terms of the SDR white point. If this is defined, any values outside the
731 * range supported by the display will be scaled into the available HDR
732 * headroom, otherwise they are clipped. This defaults to 1.0 for SDR
733 * textures, 4.0 for HDR10 textures, and no default for floating point
734 * textures.
735 *
736 * With the direct3d11 renderer:
737 *
738 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D associated
739 * with the texture
740 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
741 * associated with the U plane of a YUV texture
742 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
743 * associated with the V plane of a YUV texture
744 *
745 * With the direct3d12 renderer:
746 *
747 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`: the ID3D12Resource associated
748 * with the texture
749 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource associated
750 * with the U plane of a YUV texture
751 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource associated
752 * with the V plane of a YUV texture
753 *
754 * With the vulkan renderer:
755 *
756 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_POINTER`: the VkImage associated with
757 * the texture
758 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_U_POINTER`: the VkImage associated with
759 * the U plane of a YUV texture
760 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_V_POINTER`: the VkImage associated with
761 * the V plane of a YUV texture
762 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_UV_POINTER`: the VkImage associated with
763 * the UV plane of a NV12/NV21 texture
764 *
765 * With the opengl renderer:
766 *
767 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`: the GLuint texture associated
768 * with the texture
769 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
770 * associated with the UV plane of an NV12 texture
771 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture associated
772 * with the U plane of a YUV texture
773 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture associated
774 * with the V plane of a YUV texture
775 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`: the GLenum for the
776 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc)
777 * - `SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`: the texture coordinate width of
778 * the texture (0.0 - 1.0)
779 * - `SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`: the texture coordinate height of
780 * the texture (0.0 - 1.0)
781 *
782 * With the opengles2 renderer:
783 *
784 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
785 * associated with the texture
786 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
787 * associated with the UV plane of an NV12 texture
788 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
789 * associated with the U plane of a YUV texture
790 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
791 * associated with the V plane of a YUV texture
792 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the
793 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
794 *
795 * With the vulkan renderer:
796 *
797 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`: the VkImage associated with the
798 * texture
799 *
800 * \param texture the texture to query.
801 * \returns a valid property ID on success or 0 on failure; call
802 * SDL_GetError() for more information.
803 *
804 * \threadsafety It is safe to call this function from any thread.
805 *
806 * \since This function is available since SDL 3.0.0.
807 */
808extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
809
810#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER "SDL.texture.colorspace"
811#define SDL_PROP_TEXTURE_FORMAT_NUMBER "SDL.texture.format"
812#define SDL_PROP_TEXTURE_ACCESS_NUMBER "SDL.texture.access"
813#define SDL_PROP_TEXTURE_WIDTH_NUMBER "SDL.texture.width"
814#define SDL_PROP_TEXTURE_HEIGHT_NUMBER "SDL.texture.height"
815#define SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT "SDL.texture.SDR_white_point"
816#define SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT "SDL.texture.HDR_headroom"
817#define SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture"
818#define SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER "SDL.texture.d3d11.texture_u"
819#define SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER "SDL.texture.d3d11.texture_v"
820#define SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture"
821#define SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER "SDL.texture.d3d12.texture_u"
822#define SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER "SDL.texture.d3d12.texture_v"
823#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture"
824#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.opengl.texture_uv"
825#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.opengl.texture_u"
826#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.opengl.texture_v"
827#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER "SDL.texture.opengl.target"
828#define SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w"
829#define SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h"
830#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture"
831#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.opengles2.texture_uv"
832#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.opengles2.texture_u"
833#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
834#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER "SDL.texture.opengles2.target"
835#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER "SDL.texture.vulkan.texture"
836
837/**
838 * Get the renderer that created an SDL_Texture.
839 *
840 * \param texture the texture to query.
841 * \returns a pointer to the SDL_Renderer that created the texture, or NULL on
842 * failure; call SDL_GetError() for more information.
843 *
844 * \threadsafety It is safe to call this function from any thread.
845 *
846 * \since This function is available since SDL 3.0.0.
847 */
848extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Texture *texture);
849
850/**
851 * Get the size of a texture, as floating point values.
852 *
853 * \param texture the texture to query.
854 * \param w a pointer filled in with the width of the texture in pixels. This
855 * argument can be NULL if you don't need this information.
856 * \param h a pointer filled in with the height of the texture in pixels. This
857 * argument can be NULL if you don't need this information.
858 * \returns true on success or false on failure; call SDL_GetError() for more
859 * information.
860 *
861 * \threadsafety You may only call this function from the main thread.
862 *
863 * \since This function is available since SDL 3.0.0.
864 */
865extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h);
866
867/**
868 * Set an additional color value multiplied into render copy operations.
869 *
870 * When this texture is rendered, during the copy operation each source color
871 * channel is modulated by the appropriate color value according to the
872 * following formula:
873 *
874 * `srcC = srcC * (color / 255)`
875 *
876 * Color modulation is not always supported by the renderer; it will return
877 * false if color modulation is not supported.
878 *
879 * \param texture the texture to update.
880 * \param r the red color value multiplied into copy operations.
881 * \param g the green color value multiplied into copy operations.
882 * \param b the blue color value multiplied into copy operations.
883 * \returns true on success or false on failure; call SDL_GetError() for more
884 * information.
885 *
886 * \threadsafety You may only call this function from the main thread.
887 *
888 * \since This function is available since SDL 3.0.0.
889 *
890 * \sa SDL_GetTextureColorMod
891 * \sa SDL_SetTextureAlphaMod
892 * \sa SDL_SetTextureColorModFloat
893 */
894extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
895
896
897/**
898 * Set an additional color value multiplied into render copy operations.
899 *
900 * When this texture is rendered, during the copy operation each source color
901 * channel is modulated by the appropriate color value according to the
902 * following formula:
903 *
904 * `srcC = srcC * color`
905 *
906 * Color modulation is not always supported by the renderer; it will return
907 * false if color modulation is not supported.
908 *
909 * \param texture the texture to update.
910 * \param r the red color value multiplied into copy operations.
911 * \param g the green color value multiplied into copy operations.
912 * \param b the blue color value multiplied into copy operations.
913 * \returns true on success or false on failure; call SDL_GetError() for more
914 * information.
915 *
916 * \threadsafety You may only call this function from the main thread.
917 *
918 * \since This function is available since SDL 3.0.0.
919 *
920 * \sa SDL_GetTextureColorModFloat
921 * \sa SDL_SetTextureAlphaModFloat
922 * \sa SDL_SetTextureColorMod
923 */
924extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b);
925
926
927/**
928 * Get the additional color value multiplied into render copy operations.
929 *
930 * \param texture the texture to query.
931 * \param r a pointer filled in with the current red color value.
932 * \param g a pointer filled in with the current green color value.
933 * \param b a pointer filled in with the current blue color value.
934 * \returns true on success or false on failure; call SDL_GetError() for more
935 * information.
936 *
937 * \threadsafety You may only call this function from the main thread.
938 *
939 * \since This function is available since SDL 3.0.0.
940 *
941 * \sa SDL_GetTextureAlphaMod
942 * \sa SDL_GetTextureColorModFloat
943 * \sa SDL_SetTextureColorMod
944 */
945extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
946
947/**
948 * Get the additional color value multiplied into render copy operations.
949 *
950 * \param texture the texture to query.
951 * \param r a pointer filled in with the current red color value.
952 * \param g a pointer filled in with the current green color value.
953 * \param b a pointer filled in with the current blue color value.
954 * \returns true on success or false on failure; call SDL_GetError() for more
955 * information.
956 *
957 * \threadsafety You may only call this function from the main thread.
958 *
959 * \since This function is available since SDL 3.0.0.
960 *
961 * \sa SDL_GetTextureAlphaModFloat
962 * \sa SDL_GetTextureColorMod
963 * \sa SDL_SetTextureColorModFloat
964 */
965extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b);
966
967/**
968 * Set an additional alpha value multiplied into render copy operations.
969 *
970 * When this texture is rendered, during the copy operation the source alpha
971 * value is modulated by this alpha value according to the following formula:
972 *
973 * `srcA = srcA * (alpha / 255)`
974 *
975 * Alpha modulation is not always supported by the renderer; it will return
976 * false if alpha modulation is not supported.
977 *
978 * \param texture the texture to update.
979 * \param alpha the source alpha value multiplied into copy operations.
980 * \returns true on success or false on failure; call SDL_GetError() for more
981 * information.
982 *
983 * \threadsafety You may only call this function from the main thread.
984 *
985 * \since This function is available since SDL 3.0.0.
986 *
987 * \sa SDL_GetTextureAlphaMod
988 * \sa SDL_SetTextureAlphaModFloat
989 * \sa SDL_SetTextureColorMod
990 */
991extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
992
993/**
994 * Set an additional alpha value multiplied into render copy operations.
995 *
996 * When this texture is rendered, during the copy operation the source alpha
997 * value is modulated by this alpha value according to the following formula:
998 *
999 * `srcA = srcA * alpha`
1000 *
1001 * Alpha modulation is not always supported by the renderer; it will return
1002 * false if alpha modulation is not supported.
1003 *
1004 * \param texture the texture to update.
1005 * \param alpha the source alpha value multiplied into copy operations.
1006 * \returns true on success or false on failure; call SDL_GetError() for more
1007 * information.
1008 *
1009 * \threadsafety You may only call this function from the main thread.
1010 *
1011 * \since This function is available since SDL 3.0.0.
1012 *
1013 * \sa SDL_GetTextureAlphaModFloat
1014 * \sa SDL_SetTextureAlphaMod
1015 * \sa SDL_SetTextureColorModFloat
1016 */
1017extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha);
1018
1019/**
1020 * Get the additional alpha value multiplied into render copy operations.
1021 *
1022 * \param texture the texture to query.
1023 * \param alpha a pointer filled in with the current alpha value.
1024 * \returns true on success or false on failure; call SDL_GetError() for more
1025 * information.
1026 *
1027 * \threadsafety You may only call this function from the main thread.
1028 *
1029 * \since This function is available since SDL 3.0.0.
1030 *
1031 * \sa SDL_GetTextureAlphaModFloat
1032 * \sa SDL_GetTextureColorMod
1033 * \sa SDL_SetTextureAlphaMod
1034 */
1035extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
1036
1037/**
1038 * Get the additional alpha value multiplied into render copy operations.
1039 *
1040 * \param texture the texture to query.
1041 * \param alpha a pointer filled in with the current alpha value.
1042 * \returns true on success or false on failure; call SDL_GetError() for more
1043 * information.
1044 *
1045 * \threadsafety You may only call this function from the main thread.
1046 *
1047 * \since This function is available since SDL 3.0.0.
1048 *
1049 * \sa SDL_GetTextureAlphaMod
1050 * \sa SDL_GetTextureColorModFloat
1051 * \sa SDL_SetTextureAlphaModFloat
1052 */
1053extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha);
1054
1055/**
1056 * Set the blend mode for a texture, used by SDL_RenderTexture().
1057 *
1058 * If the blend mode is not supported, the closest supported mode is chosen
1059 * and this function returns false.
1060 *
1061 * \param texture the texture to update.
1062 * \param blendMode the SDL_BlendMode to use for texture blending.
1063 * \returns true on success or false on failure; call SDL_GetError() for more
1064 * information.
1065 *
1066 * \threadsafety You may only call this function from the main thread.
1067 *
1068 * \since This function is available since SDL 3.0.0.
1069 *
1070 * \sa SDL_GetTextureBlendMode
1071 */
1072extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
1073
1074/**
1075 * Get the blend mode used for texture copy operations.
1076 *
1077 * \param texture the texture to query.
1078 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1079 * \returns true on success or false on failure; call SDL_GetError() for more
1080 * information.
1081 *
1082 * \threadsafety You may only call this function from the main thread.
1083 *
1084 * \since This function is available since SDL 3.0.0.
1085 *
1086 * \sa SDL_SetTextureBlendMode
1087 */
1088extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
1089
1090/**
1091 * Set the scale mode used for texture scale operations.
1092 *
1093 * The default texture scale mode is SDL_SCALEMODE_LINEAR.
1094 *
1095 * If the scale mode is not supported, the closest supported mode is chosen.
1096 *
1097 * \param texture the texture to update.
1098 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
1099 * \returns true on success or false on failure; call SDL_GetError() for more
1100 * information.
1101 *
1102 * \threadsafety You may only call this function from the main thread.
1103 *
1104 * \since This function is available since SDL 3.0.0.
1105 *
1106 * \sa SDL_GetTextureScaleMode
1107 */
1108extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
1109
1110/**
1111 * Get the scale mode used for texture scale operations.
1112 *
1113 * \param texture the texture to query.
1114 * \param scaleMode a pointer filled in with the current scale mode.
1115 * \returns true on success or false on failure; call SDL_GetError() for more
1116 * information.
1117 *
1118 * \threadsafety You may only call this function from the main thread.
1119 *
1120 * \since This function is available since SDL 3.0.0.
1121 *
1122 * \sa SDL_SetTextureScaleMode
1123 */
1124extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
1125
1126/**
1127 * Update the given texture rectangle with new pixel data.
1128 *
1129 * The pixel data must be in the pixel format of the texture, which can be
1130 * queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
1131 *
1132 * This is a fairly slow function, intended for use with static textures that
1133 * do not change often.
1134 *
1135 * If the texture is intended to be updated often, it is preferred to create
1136 * the texture as streaming and use the locking functions referenced below.
1137 * While this function will work with streaming textures, for optimization
1138 * reasons you may not get the pixels back if you lock the texture afterward.
1139 *
1140 * \param texture the texture to update.
1141 * \param rect an SDL_Rect structure representing the area to update, or NULL
1142 * to update the entire texture.
1143 * \param pixels the raw pixel data in the format of the texture.
1144 * \param pitch the number of bytes in a row of pixel data, including padding
1145 * between lines.
1146 * \returns true on success or false on failure; call SDL_GetError() for more
1147 * information.
1148 *
1149 * \threadsafety You may only call this function from the main thread.
1150 *
1151 * \since This function is available since SDL 3.0.0.
1152 *
1153 * \sa SDL_LockTexture
1154 * \sa SDL_UnlockTexture
1155 * \sa SDL_UpdateNVTexture
1156 * \sa SDL_UpdateYUVTexture
1157 */
1158extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
1159
1160/**
1161 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
1162 * data.
1163 *
1164 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1165 * block of Y and U/V planes in the proper order, but this function is
1166 * available if your pixel data is not contiguous.
1167 *
1168 * \param texture the texture to update.
1169 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1170 * update the entire texture.
1171 * \param Yplane the raw pixel data for the Y plane.
1172 * \param Ypitch the number of bytes between rows of pixel data for the Y
1173 * plane.
1174 * \param Uplane the raw pixel data for the U plane.
1175 * \param Upitch the number of bytes between rows of pixel data for the U
1176 * plane.
1177 * \param Vplane the raw pixel data for the V plane.
1178 * \param Vpitch the number of bytes between rows of pixel data for the V
1179 * plane.
1180 * \returns true on success or false on failure; call SDL_GetError() for more
1181 * information.
1182 *
1183 * \threadsafety You may only call this function from the main thread.
1184 *
1185 * \since This function is available since SDL 3.0.0.
1186 *
1187 * \sa SDL_UpdateNVTexture
1188 * \sa SDL_UpdateTexture
1189 */
1190extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
1191 const SDL_Rect *rect,
1192 const Uint8 *Yplane, int Ypitch,
1193 const Uint8 *Uplane, int Upitch,
1194 const Uint8 *Vplane, int Vpitch);
1195
1196/**
1197 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
1198 *
1199 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1200 * block of NV12/21 planes in the proper order, but this function is available
1201 * if your pixel data is not contiguous.
1202 *
1203 * \param texture the texture to update.
1204 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1205 * update the entire texture.
1206 * \param Yplane the raw pixel data for the Y plane.
1207 * \param Ypitch the number of bytes between rows of pixel data for the Y
1208 * plane.
1209 * \param UVplane the raw pixel data for the UV plane.
1210 * \param UVpitch the number of bytes between rows of pixel data for the UV
1211 * plane.
1212 * \returns true on success or false on failure; call SDL_GetError() for more
1213 * information.
1214 *
1215 * \threadsafety You may only call this function from the main thread.
1216 *
1217 * \since This function is available since SDL 3.0.0.
1218 *
1219 * \sa SDL_UpdateTexture
1220 * \sa SDL_UpdateYUVTexture
1221 */
1222extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
1223 const SDL_Rect *rect,
1224 const Uint8 *Yplane, int Ypitch,
1225 const Uint8 *UVplane, int UVpitch);
1226
1227/**
1228 * Lock a portion of the texture for **write-only** pixel access.
1229 *
1230 * As an optimization, the pixels made available for editing don't necessarily
1231 * contain the old texture data. This is a write-only operation, and if you
1232 * need to keep a copy of the texture data you should do that at the
1233 * application level.
1234 *
1235 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1236 * changes.
1237 *
1238 * \param texture the texture to lock for access, which was created with
1239 * `SDL_TEXTUREACCESS_STREAMING`.
1240 * \param rect an SDL_Rect structure representing the area to lock for access;
1241 * NULL to lock the entire texture.
1242 * \param pixels this is filled in with a pointer to the locked pixels,
1243 * appropriately offset by the locked area.
1244 * \param pitch this is filled in with the pitch of the locked pixels; the
1245 * pitch is the length of one row in bytes.
1246 * \returns true on success or false if the texture is not valid or was not
1247 * created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError()
1248 * for more information.
1249 *
1250 * \threadsafety You may only call this function from the main thread.
1251 *
1252 * \since This function is available since SDL 3.0.0.
1253 *
1254 * \sa SDL_LockTextureToSurface
1255 * \sa SDL_UnlockTexture
1256 */
1257extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
1258 const SDL_Rect *rect,
1259 void **pixels, int *pitch);
1260
1261/**
1262 * Lock a portion of the texture for **write-only** pixel access, and expose
1263 * it as a SDL surface.
1264 *
1265 * Besides providing an SDL_Surface instead of raw pixel data, this function
1266 * operates like SDL_LockTexture.
1267 *
1268 * As an optimization, the pixels made available for editing don't necessarily
1269 * contain the old texture data. This is a write-only operation, and if you
1270 * need to keep a copy of the texture data you should do that at the
1271 * application level.
1272 *
1273 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1274 * changes.
1275 *
1276 * The returned surface is freed internally after calling SDL_UnlockTexture()
1277 * or SDL_DestroyTexture(). The caller should not free it.
1278 *
1279 * \param texture the texture to lock for access, which must be created with
1280 * `SDL_TEXTUREACCESS_STREAMING`.
1281 * \param rect a pointer to the rectangle to lock for access. If the rect is
1282 * NULL, the entire texture will be locked.
1283 * \param surface this is filled in with an SDL surface representing the
1284 * locked area.
1285 * \returns true on success or false on failure; call SDL_GetError() for more
1286 * information.
1287 *
1288 * \threadsafety You may only call this function from the main thread.
1289 *
1290 * \since This function is available since SDL 3.0.0.
1291 *
1292 * \sa SDL_LockTexture
1293 * \sa SDL_UnlockTexture
1294 */
1295extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface);
1296
1297/**
1298 * Unlock a texture, uploading the changes to video memory, if needed.
1299 *
1300 * **Warning**: Please note that SDL_LockTexture() is intended to be
1301 * write-only; it will not guarantee the previous contents of the texture will
1302 * be provided. You must fully initialize any area of a texture that you lock
1303 * before unlocking it, as the pixels might otherwise be uninitialized memory.
1304 *
1305 * Which is to say: locking and immediately unlocking a texture can result in
1306 * corrupted textures, depending on the renderer in use.
1307 *
1308 * \param texture a texture locked by SDL_LockTexture().
1309 *
1310 * \threadsafety You may only call this function from the main thread.
1311 *
1312 * \since This function is available since SDL 3.0.0.
1313 *
1314 * \sa SDL_LockTexture
1315 */
1316extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
1317
1318/**
1319 * Set a texture as the current rendering target.
1320 *
1321 * The default render target is the window for which the renderer was created.
1322 * To stop rendering to a texture and render to the window again, call this
1323 * function with a NULL `texture`.
1324 *
1325 * \param renderer the rendering context.
1326 * \param texture the targeted texture, which must be created with the
1327 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
1328 * window instead of a texture.
1329 * \returns true on success or false on failure; call SDL_GetError() for more
1330 * information.
1331 *
1332 * \threadsafety You may only call this function from the main thread.
1333 *
1334 * \since This function is available since SDL 3.0.0.
1335 *
1336 * \sa SDL_GetRenderTarget
1337 */
1338extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
1339
1340/**
1341 * Get the current render target.
1342 *
1343 * The default render target is the window for which the renderer was created,
1344 * and is reported a NULL here.
1345 *
1346 * \param renderer the rendering context.
1347 * \returns the current render target or NULL for the default render target.
1348 *
1349 * \threadsafety You may only call this function from the main thread.
1350 *
1351 * \since This function is available since SDL 3.0.0.
1352 *
1353 * \sa SDL_SetRenderTarget
1354 */
1355extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
1356
1357/**
1358 * Set a device independent resolution and presentation mode for rendering.
1359 *
1360 * This function sets the width and height of the logical rendering output.
1361 * The renderer will act as if the window is always the requested dimensions,
1362 * scaling to the actual window resolution as necessary.
1363 *
1364 * This can be useful for games that expect a fixed size, but would like to
1365 * scale the output to whatever is available, regardless of how a user resizes
1366 * a window, or if the display is high DPI.
1367 *
1368 * You can disable logical coordinates by setting the mode to
1369 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
1370 * resolution of the output window; it is safe to toggle logical presentation
1371 * during the rendering of a frame: perhaps most of the rendering is done to
1372 * specific dimensions but to make fonts look sharp, the app turns off logical
1373 * presentation while drawing text.
1374 *
1375 * Letterboxing will only happen if logical presentation is enabled during
1376 * SDL_RenderPresent; be sure to reenable it first if you were using it.
1377 *
1378 * You can convert coordinates in an event into rendering coordinates using
1379 * SDL_ConvertEventToRenderCoordinates().
1380 *
1381 * \param renderer the rendering context.
1382 * \param w the width of the logical resolution.
1383 * \param h the height of the logical resolution.
1384 * \param mode the presentation mode used.
1385 * \returns true on success or false on failure; call SDL_GetError() for more
1386 * information.
1387 *
1388 * \threadsafety You may only call this function from the main thread.
1389 *
1390 * \since This function is available since SDL 3.0.0.
1391 *
1392 * \sa SDL_ConvertEventToRenderCoordinates
1393 * \sa SDL_GetRenderLogicalPresentation
1394 * \sa SDL_GetRenderLogicalPresentationRect
1395 */
1396extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode);
1397
1398/**
1399 * Get device independent resolution and presentation mode for rendering.
1400 *
1401 * This function gets the width and height of the logical rendering output, or
1402 * the output size in pixels if a logical resolution is not enabled.
1403 *
1404 * \param renderer the rendering context.
1405 * \param w an int to be filled with the width.
1406 * \param h an int to be filled with the height.
1407 * \param mode the presentation mode used.
1408 * \returns true on success or false on failure; call SDL_GetError() for more
1409 * information.
1410 *
1411 * \threadsafety You may only call this function from the main thread.
1412 *
1413 * \since This function is available since SDL 3.0.0.
1414 *
1415 * \sa SDL_SetRenderLogicalPresentation
1416 */
1417extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode);
1418
1419/**
1420 * Get the final presentation rectangle for rendering.
1421 *
1422 * This function returns the calculated rectangle used for logical
1423 * presentation, based on the presentation mode and output size. If logical
1424 * presentation is disabled, it will fill the rectangle with the output size,
1425 * in pixels.
1426 *
1427 * \param renderer the rendering context.
1428 * \param rect a pointer filled in with the final presentation rectangle, may
1429 * be NULL.
1430 * \returns true on success or false on failure; call SDL_GetError() for more
1431 * information.
1432 *
1433 * \threadsafety You may only call this function from the main thread.
1434 *
1435 * \since This function is available since SDL 3.0.0.
1436 *
1437 * \sa SDL_SetRenderLogicalPresentation
1438 */
1439extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect);
1440
1441/**
1442 * Get a point in render coordinates when given a point in window coordinates.
1443 *
1444 * This takes into account several states:
1445 *
1446 * - The window dimensions.
1447 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1448 * - The scale (SDL_SetRenderScale)
1449 * - The viewport (SDL_SetRenderViewport)
1450 *
1451 * \param renderer the rendering context.
1452 * \param window_x the x coordinate in window coordinates.
1453 * \param window_y the y coordinate in window coordinates.
1454 * \param x a pointer filled with the x coordinate in render coordinates.
1455 * \param y a pointer filled with the y coordinate in render coordinates.
1456 * \returns true on success or false on failure; call SDL_GetError() for more
1457 * information.
1458 *
1459 * \threadsafety You may only call this function from the main thread.
1460 *
1461 * \since This function is available since SDL 3.0.0.
1462 *
1463 * \sa SDL_SetRenderLogicalPresentation
1464 * \sa SDL_SetRenderScale
1465 */
1466extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
1467
1468/**
1469 * Get a point in window coordinates when given a point in render coordinates.
1470 *
1471 * This takes into account several states:
1472 *
1473 * - The window dimensions.
1474 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1475 * - The scale (SDL_SetRenderScale)
1476 * - The viewport (SDL_SetRenderViewport)
1477 *
1478 * \param renderer the rendering context.
1479 * \param x the x coordinate in render coordinates.
1480 * \param y the y coordinate in render coordinates.
1481 * \param window_x a pointer filled with the x coordinate in window
1482 * coordinates.
1483 * \param window_y a pointer filled with the y coordinate in window
1484 * coordinates.
1485 * \returns true on success or false on failure; call SDL_GetError() for more
1486 * information.
1487 *
1488 * \threadsafety You may only call this function from the main thread.
1489 *
1490 * \since This function is available since SDL 3.0.0.
1491 *
1492 * \sa SDL_SetRenderLogicalPresentation
1493 * \sa SDL_SetRenderScale
1494 * \sa SDL_SetRenderViewport
1495 */
1496extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
1497
1498/**
1499 * Convert the coordinates in an event to render coordinates.
1500 *
1501 * This takes into account several states:
1502 *
1503 * - The window dimensions.
1504 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1505 * - The scale (SDL_SetRenderScale)
1506 * - The viewport (SDL_SetRenderViewport)
1507 *
1508 * Touch coordinates are converted from normalized coordinates in the window
1509 * to non-normalized rendering coordinates.
1510 *
1511 * Once converted, the coordinates may be outside the rendering area.
1512 *
1513 * \param renderer the rendering context.
1514 * \param event the event to modify.
1515 * \returns true on success or false on failure; call SDL_GetError() for more
1516 * information.
1517 *
1518 * \threadsafety You may only call this function from the main thread.
1519 *
1520 * \since This function is available since SDL 3.0.0.
1521 *
1522 * \sa SDL_RenderCoordinatesFromWindow
1523 */
1524extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
1525
1526/**
1527 * Set the drawing area for rendering on the current target.
1528 *
1529 * Drawing will clip to this area (separately from any clipping done with
1530 * SDL_SetRenderClipRect), and the top left of the area will become coordinate
1531 * (0, 0) for future drawing commands.
1532 *
1533 * The area's width and height must be >= 0.
1534 *
1535 * \param renderer the rendering context.
1536 * \param rect the SDL_Rect structure representing the drawing area, or NULL
1537 * to set the viewport to the entire target.
1538 * \returns true on success or false on failure; call SDL_GetError() for more
1539 * information.
1540 *
1541 * \threadsafety You may only call this function from the main thread.
1542 *
1543 * \since This function is available since SDL 3.0.0.
1544 *
1545 * \sa SDL_GetRenderViewport
1546 * \sa SDL_RenderViewportSet
1547 */
1548extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
1549
1550/**
1551 * Get the drawing area for the current target.
1552 *
1553 * \param renderer the rendering context.
1554 * \param rect an SDL_Rect structure filled in with the current drawing area.
1555 * \returns true on success or false on failure; call SDL_GetError() for more
1556 * information.
1557 *
1558 * \threadsafety You may only call this function from the main thread.
1559 *
1560 * \since This function is available since SDL 3.0.0.
1561 *
1562 * \sa SDL_RenderViewportSet
1563 * \sa SDL_SetRenderViewport
1564 */
1565extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
1566
1567/**
1568 * Return whether an explicit rectangle was set as the viewport.
1569 *
1570 * This is useful if you're saving and restoring the viewport and want to know
1571 * whether you should restore a specific rectangle or NULL. Note that the
1572 * viewport is always reset when changing rendering targets.
1573 *
1574 * \param renderer the rendering context.
1575 * \returns true if the viewport was set to a specific rectangle, or false if
1576 * it was set to NULL (the entire target).
1577 *
1578 * \threadsafety You may only call this function from the main thread.
1579 *
1580 * \since This function is available since SDL 3.0.0.
1581 *
1582 * \sa SDL_GetRenderViewport
1583 * \sa SDL_SetRenderViewport
1584 */
1585extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer);
1586
1587/**
1588 * Get the safe area for rendering within the current viewport.
1589 *
1590 * Some devices have portions of the screen which are partially obscured or
1591 * not interactive, possibly due to on-screen controls, curved edges, camera
1592 * notches, TV overscan, etc. This function provides the area of the current
1593 * viewport which is safe to have interactible content. You should continue
1594 * rendering into the rest of the render target, but it should not contain
1595 * visually important or interactible content.
1596 *
1597 * \param renderer the rendering context.
1598 * \param rect a pointer filled in with the area that is safe for interactive
1599 * content.
1600 * \returns true on success or false on failure; call SDL_GetError() for more
1601 * information.
1602 *
1603 * \threadsafety You may only call this function from the main thread.
1604 *
1605 * \since This function is available since SDL 3.0.0.
1606 */
1607extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect);
1608
1609/**
1610 * Set the clip rectangle for rendering on the specified target.
1611 *
1612 * \param renderer the rendering context.
1613 * \param rect an SDL_Rect structure representing the clip area, relative to
1614 * the viewport, or NULL to disable clipping.
1615 * \returns true on success or false on failure; call SDL_GetError() for more
1616 * information.
1617 *
1618 * \threadsafety You may only call this function from the main thread.
1619 *
1620 * \since This function is available since SDL 3.0.0.
1621 *
1622 * \sa SDL_GetRenderClipRect
1623 * \sa SDL_RenderClipEnabled
1624 */
1625extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
1626
1627/**
1628 * Get the clip rectangle for the current target.
1629 *
1630 * \param renderer the rendering context.
1631 * \param rect an SDL_Rect structure filled in with the current clipping area
1632 * or an empty rectangle if clipping is disabled.
1633 * \returns true on success or false on failure; call SDL_GetError() for more
1634 * information.
1635 *
1636 * \threadsafety You may only call this function from the main thread.
1637 *
1638 * \since This function is available since SDL 3.0.0.
1639 *
1640 * \sa SDL_RenderClipEnabled
1641 * \sa SDL_SetRenderClipRect
1642 */
1643extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1644
1645/**
1646 * Get whether clipping is enabled on the given renderer.
1647 *
1648 * \param renderer the rendering context.
1649 * \returns true if clipping is enabled or false if not; call SDL_GetError()
1650 * for more information.
1651 *
1652 * \threadsafety You may only call this function from the main thread.
1653 *
1654 * \since This function is available since SDL 3.0.0.
1655 *
1656 * \sa SDL_GetRenderClipRect
1657 * \sa SDL_SetRenderClipRect
1658 */
1659extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1660
1661/**
1662 * Set the drawing scale for rendering on the current target.
1663 *
1664 * The drawing coordinates are scaled by the x/y scaling factors before they
1665 * are used by the renderer. This allows resolution independent drawing with a
1666 * single coordinate system.
1667 *
1668 * If this results in scaling or subpixel drawing by the rendering backend, it
1669 * will be handled using the appropriate quality hints. For best results use
1670 * integer scaling factors.
1671 *
1672 * \param renderer the rendering context.
1673 * \param scaleX the horizontal scaling factor.
1674 * \param scaleY the vertical scaling factor.
1675 * \returns true on success or false on failure; call SDL_GetError() for more
1676 * information.
1677 *
1678 * \threadsafety You may only call this function from the main thread.
1679 *
1680 * \since This function is available since SDL 3.0.0.
1681 *
1682 * \sa SDL_GetRenderScale
1683 */
1684extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1685
1686/**
1687 * Get the drawing scale for the current target.
1688 *
1689 * \param renderer the rendering context.
1690 * \param scaleX a pointer filled in with the horizontal scaling factor.
1691 * \param scaleY a pointer filled in with the vertical scaling factor.
1692 * \returns true on success or false on failure; call SDL_GetError() for more
1693 * information.
1694 *
1695 * \threadsafety You may only call this function from the main thread.
1696 *
1697 * \since This function is available since SDL 3.0.0.
1698 *
1699 * \sa SDL_SetRenderScale
1700 */
1701extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1702
1703/**
1704 * Set the color used for drawing operations.
1705 *
1706 * Set the color for drawing or filling rectangles, lines, and points, and for
1707 * SDL_RenderClear().
1708 *
1709 * \param renderer the rendering context.
1710 * \param r the red value used to draw on the rendering target.
1711 * \param g the green value used to draw on the rendering target.
1712 * \param b the blue value used to draw on the rendering target.
1713 * \param a the alpha value used to draw on the rendering target; usually
1714 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1715 * specify how the alpha channel is used.
1716 * \returns true on success or false on failure; call SDL_GetError() for more
1717 * information.
1718 *
1719 * \threadsafety You may only call this function from the main thread.
1720 *
1721 * \since This function is available since SDL 3.0.0.
1722 *
1723 * \sa SDL_GetRenderDrawColor
1724 * \sa SDL_SetRenderDrawColorFloat
1725 */
1726extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1727
1728/**
1729 * Set the color used for drawing operations (Rect, Line and Clear).
1730 *
1731 * Set the color for drawing or filling rectangles, lines, and points, and for
1732 * SDL_RenderClear().
1733 *
1734 * \param renderer the rendering context.
1735 * \param r the red value used to draw on the rendering target.
1736 * \param g the green value used to draw on the rendering target.
1737 * \param b the blue value used to draw on the rendering target.
1738 * \param a the alpha value used to draw on the rendering target. Use
1739 * SDL_SetRenderDrawBlendMode to specify how the alpha channel is
1740 * used.
1741 * \returns true on success or false on failure; call SDL_GetError() for more
1742 * information.
1743 *
1744 * \threadsafety You may only call this function from the main thread.
1745 *
1746 * \since This function is available since SDL 3.0.0.
1747 *
1748 * \sa SDL_GetRenderDrawColorFloat
1749 * \sa SDL_SetRenderDrawColor
1750 */
1751extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a);
1752
1753/**
1754 * Get the color used for drawing operations (Rect, Line and Clear).
1755 *
1756 * \param renderer the rendering context.
1757 * \param r a pointer filled in with the red value used to draw on the
1758 * rendering target.
1759 * \param g a pointer filled in with the green value used to draw on the
1760 * rendering target.
1761 * \param b a pointer filled in with the blue value used to draw on the
1762 * rendering target.
1763 * \param a a pointer filled in with the alpha value used to draw on the
1764 * rendering target; usually `SDL_ALPHA_OPAQUE` (255).
1765 * \returns true on success or false on failure; call SDL_GetError() for more
1766 * information.
1767 *
1768 * \threadsafety You may only call this function from the main thread.
1769 *
1770 * \since This function is available since SDL 3.0.0.
1771 *
1772 * \sa SDL_GetRenderDrawColorFloat
1773 * \sa SDL_SetRenderDrawColor
1774 */
1775extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1776
1777/**
1778 * Get the color used for drawing operations (Rect, Line and Clear).
1779 *
1780 * \param renderer the rendering context.
1781 * \param r a pointer filled in with the red value used to draw on the
1782 * rendering target.
1783 * \param g a pointer filled in with the green value used to draw on the
1784 * rendering target.
1785 * \param b a pointer filled in with the blue value used to draw on the
1786 * rendering target.
1787 * \param a a pointer filled in with the alpha value used to draw on the
1788 * rendering target.
1789 * \returns true on success or false on failure; call SDL_GetError() for more
1790 * information.
1791 *
1792 * \threadsafety You may only call this function from the main thread.
1793 *
1794 * \since This function is available since SDL 3.0.0.
1795 *
1796 * \sa SDL_SetRenderDrawColorFloat
1797 * \sa SDL_GetRenderDrawColor
1798 */
1799extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a);
1800
1801/**
1802 * Set the color scale used for render operations.
1803 *
1804 * The color scale is an additional scale multiplied into the pixel color
1805 * value while rendering. This can be used to adjust the brightness of colors
1806 * during HDR rendering, or changing HDR video brightness when playing on an
1807 * SDR display.
1808 *
1809 * The color scale does not affect the alpha channel, only the color
1810 * brightness.
1811 *
1812 * \param renderer the rendering context.
1813 * \param scale the color scale value.
1814 * \returns true on success or false on failure; call SDL_GetError() for more
1815 * information.
1816 *
1817 * \threadsafety You may only call this function from the main thread.
1818 *
1819 * \since This function is available since SDL 3.0.0.
1820 *
1821 * \sa SDL_GetRenderColorScale
1822 */
1823extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale);
1824
1825/**
1826 * Get the color scale used for render operations.
1827 *
1828 * \param renderer the rendering context.
1829 * \param scale a pointer filled in with the current color scale value.
1830 * \returns true on success or false on failure; call SDL_GetError() for more
1831 * information.
1832 *
1833 * \threadsafety You may only call this function from the main thread.
1834 *
1835 * \since This function is available since SDL 3.0.0.
1836 *
1837 * \sa SDL_SetRenderColorScale
1838 */
1839extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale);
1840
1841/**
1842 * Set the blend mode used for drawing operations (Fill and Line).
1843 *
1844 * If the blend mode is not supported, the closest supported mode is chosen.
1845 *
1846 * \param renderer the rendering context.
1847 * \param blendMode the SDL_BlendMode to use for blending.
1848 * \returns true on success or false on failure; call SDL_GetError() for more
1849 * information.
1850 *
1851 * \threadsafety You may only call this function from the main thread.
1852 *
1853 * \since This function is available since SDL 3.0.0.
1854 *
1855 * \sa SDL_GetRenderDrawBlendMode
1856 */
1857extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1858
1859/**
1860 * Get the blend mode used for drawing operations.
1861 *
1862 * \param renderer the rendering context.
1863 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1864 * \returns true on success or false on failure; call SDL_GetError() for more
1865 * information.
1866 *
1867 * \threadsafety You may only call this function from the main thread.
1868 *
1869 * \since This function is available since SDL 3.0.0.
1870 *
1871 * \sa SDL_SetRenderDrawBlendMode
1872 */
1873extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1874
1875/**
1876 * Clear the current rendering target with the drawing color.
1877 *
1878 * This function clears the entire rendering target, ignoring the viewport and
1879 * the clip rectangle. Note, that clearing will also set/fill all pixels of
1880 * the rendering target to current renderer draw color, so make sure to invoke
1881 * SDL_SetRenderDrawColor() when needed.
1882 *
1883 * \param renderer the rendering context.
1884 * \returns true on success or false on failure; call SDL_GetError() for more
1885 * information.
1886 *
1887 * \threadsafety You may only call this function from the main thread.
1888 *
1889 * \since This function is available since SDL 3.0.0.
1890 *
1891 * \sa SDL_SetRenderDrawColor
1892 */
1893extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1894
1895/**
1896 * Draw a point on the current rendering target at subpixel precision.
1897 *
1898 * \param renderer the renderer which should draw a point.
1899 * \param x the x coordinate of the point.
1900 * \param y the y coordinate of the point.
1901 * \returns true on success or false on failure; call SDL_GetError() for more
1902 * information.
1903 *
1904 * \threadsafety You may only call this function from the main thread.
1905 *
1906 * \since This function is available since SDL 3.0.0.
1907 *
1908 * \sa SDL_RenderPoints
1909 */
1910extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1911
1912/**
1913 * Draw multiple points on the current rendering target at subpixel precision.
1914 *
1915 * \param renderer the renderer which should draw multiple points.
1916 * \param points the points to draw.
1917 * \param count the number of points to draw.
1918 * \returns true on success or false on failure; call SDL_GetError() for more
1919 * information.
1920 *
1921 * \threadsafety You may only call this function from the main thread.
1922 *
1923 * \since This function is available since SDL 3.0.0.
1924 *
1925 * \sa SDL_RenderPoint
1926 */
1927extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1928
1929/**
1930 * Draw a line on the current rendering target at subpixel precision.
1931 *
1932 * \param renderer the renderer which should draw a line.
1933 * \param x1 the x coordinate of the start point.
1934 * \param y1 the y coordinate of the start point.
1935 * \param x2 the x coordinate of the end point.
1936 * \param y2 the y coordinate of the end point.
1937 * \returns true on success or false on failure; call SDL_GetError() for more
1938 * information.
1939 *
1940 * \threadsafety You may only call this function from the main thread.
1941 *
1942 * \since This function is available since SDL 3.0.0.
1943 *
1944 * \sa SDL_RenderLines
1945 */
1946extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1947
1948/**
1949 * Draw a series of connected lines on the current rendering target at
1950 * subpixel precision.
1951 *
1952 * \param renderer the renderer which should draw multiple lines.
1953 * \param points the points along the lines.
1954 * \param count the number of points, drawing count-1 lines.
1955 * \returns true on success or false on failure; call SDL_GetError() for more
1956 * information.
1957 *
1958 * \threadsafety You may only call this function from the main thread.
1959 *
1960 * \since This function is available since SDL 3.0.0.
1961 *
1962 * \sa SDL_RenderLine
1963 */
1964extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1965
1966/**
1967 * Draw a rectangle on the current rendering target at subpixel precision.
1968 *
1969 * \param renderer the renderer which should draw a rectangle.
1970 * \param rect a pointer to the destination rectangle, or NULL to outline the
1971 * entire rendering target.
1972 * \returns true on success or false on failure; call SDL_GetError() for more
1973 * information.
1974 *
1975 * \threadsafety You may only call this function from the main thread.
1976 *
1977 * \since This function is available since SDL 3.0.0.
1978 *
1979 * \sa SDL_RenderRects
1980 */
1981extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1982
1983/**
1984 * Draw some number of rectangles on the current rendering target at subpixel
1985 * precision.
1986 *
1987 * \param renderer the renderer which should draw multiple rectangles.
1988 * \param rects a pointer to an array of destination rectangles.
1989 * \param count the number of rectangles.
1990 * \returns true on success or false on failure; call SDL_GetError() for more
1991 * information.
1992 *
1993 * \threadsafety You may only call this function from the main thread.
1994 *
1995 * \since This function is available since SDL 3.0.0.
1996 *
1997 * \sa SDL_RenderRect
1998 */
1999extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2000
2001/**
2002 * Fill a rectangle on the current rendering target with the drawing color at
2003 * subpixel precision.
2004 *
2005 * \param renderer the renderer which should fill a rectangle.
2006 * \param rect a pointer to the destination rectangle, or NULL for the entire
2007 * rendering target.
2008 * \returns true on success or false on failure; call SDL_GetError() for more
2009 * information.
2010 *
2011 * \threadsafety You may only call this function from the main thread.
2012 *
2013 * \since This function is available since SDL 3.0.0.
2014 *
2015 * \sa SDL_RenderFillRects
2016 */
2017extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
2018
2019/**
2020 * Fill some number of rectangles on the current rendering target with the
2021 * drawing color at subpixel precision.
2022 *
2023 * \param renderer the renderer which should fill multiple rectangles.
2024 * \param rects a pointer to an array of destination rectangles.
2025 * \param count the number of rectangles.
2026 * \returns true on success or false on failure; call SDL_GetError() for more
2027 * information.
2028 *
2029 * \threadsafety You may only call this function from the main thread.
2030 *
2031 * \since This function is available since SDL 3.0.0.
2032 *
2033 * \sa SDL_RenderFillRect
2034 */
2035extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2036
2037/**
2038 * Copy a portion of the texture to the current rendering target at subpixel
2039 * precision.
2040 *
2041 * \param renderer the renderer which should copy parts of a texture.
2042 * \param texture the source texture.
2043 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2044 * texture.
2045 * \param dstrect a pointer to the destination rectangle, or NULL for the
2046 * entire rendering target.
2047 * \returns true on success or false on failure; call SDL_GetError() for more
2048 * information.
2049 *
2050 * \threadsafety You may only call this function from the main thread.
2051 *
2052 * \since This function is available since SDL 3.0.0.
2053 *
2054 * \sa SDL_RenderTextureRotated
2055 * \sa SDL_RenderTextureTiled
2056 */
2057extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
2058
2059/**
2060 * Copy a portion of the source texture to the current rendering target, with
2061 * rotation and flipping, at subpixel precision.
2062 *
2063 * \param renderer the renderer which should copy parts of a texture.
2064 * \param texture the source texture.
2065 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2066 * texture.
2067 * \param dstrect a pointer to the destination rectangle, or NULL for the
2068 * entire rendering target.
2069 * \param angle an angle in degrees that indicates the rotation that will be
2070 * applied to dstrect, rotating it in a clockwise direction.
2071 * \param center a pointer to a point indicating the point around which
2072 * dstrect will be rotated (if NULL, rotation will be done
2073 * around dstrect.w/2, dstrect.h/2).
2074 * \param flip an SDL_FlipMode value stating which flipping actions should be
2075 * performed on the texture.
2076 * \returns true on success or false on failure; call SDL_GetError() for more
2077 * information.
2078 *
2079 * \threadsafety You may only call this function from the main thread.
2080 *
2081 * \since This function is available since SDL 3.0.0.
2082 *
2083 * \sa SDL_RenderTexture
2084 */
2085extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
2086 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
2087 double angle, const SDL_FPoint *center,
2088 SDL_FlipMode flip);
2089
2090/**
2091 * Tile a portion of the texture to the current rendering target at subpixel
2092 * precision.
2093 *
2094 * The pixels in `srcrect` will be repeated as many times as needed to
2095 * completely fill `dstrect`.
2096 *
2097 * \param renderer the renderer which should copy parts of a texture.
2098 * \param texture the source texture.
2099 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2100 * texture.
2101 * \param scale the scale used to transform srcrect into the destination
2102 * rectangle, e.g. a 32x32 texture with a scale of 2 would fill
2103 * 64x64 tiles.
2104 * \param dstrect a pointer to the destination rectangle, or NULL for the
2105 * entire rendering target.
2106 * \returns true on success or false on failure; call SDL_GetError() for more
2107 * information.
2108 *
2109 * \threadsafety You may only call this function from the main thread.
2110 *
2111 * \since This function is available since SDL 3.0.0.
2112 *
2113 * \sa SDL_RenderTexture
2114 */
2115extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect);
2116
2117/**
2118 * Perform a scaled copy using the 9-grid algorithm to the current rendering
2119 * target at subpixel precision.
2120 *
2121 * The pixels in the texture are split into a 3x3 grid, using the different
2122 * corner sizes for each corner, and the sides and center making up the
2123 * remaining pixels. The corners are then scaled using `scale` and fit into
2124 * the corners of the destination rectangle. The sides and center are then
2125 * stretched into place to cover the remaining destination rectangle.
2126 *
2127 * \param renderer the renderer which should copy parts of a texture.
2128 * \param texture the source texture.
2129 * \param srcrect the SDL_Rect structure representing the rectangle to be used
2130 * for the 9-grid, or NULL to use the entire texture.
2131 * \param left_width the width, in pixels, of the left corners in `srcrect`.
2132 * \param right_width the width, in pixels, of the right corners in `srcrect`.
2133 * \param top_height the height, in pixels, of the top corners in `srcrect`.
2134 * \param bottom_height the height, in pixels, of the bottom corners in
2135 * `srcrect`.
2136 * \param scale the scale used to transform the corner of `srcrect` into the
2137 * corner of `dstrect`, or 0.0f for an unscaled copy.
2138 * \param dstrect a pointer to the destination rectangle, or NULL for the
2139 * entire rendering target.
2140 * \returns true on success or false on failure; call SDL_GetError() for more
2141 * information.
2142 *
2143 * \threadsafety You may only call this function from the main thread.
2144 *
2145 * \since This function is available since SDL 3.0.0.
2146 *
2147 * \sa SDL_RenderTexture
2148 */
2149extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect);
2150
2151/**
2152 * Render a list of triangles, optionally using a texture and indices into the
2153 * vertex array Color and alpha modulation is done per vertex
2154 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2155 *
2156 * \param renderer the rendering context.
2157 * \param texture (optional) The SDL texture to use.
2158 * \param vertices vertices.
2159 * \param num_vertices number of vertices.
2160 * \param indices (optional) An array of integer indices into the 'vertices'
2161 * array, if NULL all vertices will be rendered in sequential
2162 * order.
2163 * \param num_indices number of indices.
2164 * \returns true on success or false on failure; call SDL_GetError() for more
2165 * information.
2166 *
2167 * \threadsafety You may only call this function from the main thread.
2168 *
2169 * \since This function is available since SDL 3.0.0.
2170 *
2171 * \sa SDL_RenderGeometryRaw
2172 */
2173extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
2174 SDL_Texture *texture,
2175 const SDL_Vertex *vertices, int num_vertices,
2176 const int *indices, int num_indices);
2177
2178/**
2179 * Render a list of triangles, optionally using a texture and indices into the
2180 * vertex arrays Color and alpha modulation is done per vertex
2181 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2182 *
2183 * \param renderer the rendering context.
2184 * \param texture (optional) The SDL texture to use.
2185 * \param xy vertex positions.
2186 * \param xy_stride byte size to move from one element to the next element.
2187 * \param color vertex colors (as SDL_FColor).
2188 * \param color_stride byte size to move from one element to the next element.
2189 * \param uv vertex normalized texture coordinates.
2190 * \param uv_stride byte size to move from one element to the next element.
2191 * \param num_vertices number of vertices.
2192 * \param indices (optional) An array of indices into the 'vertices' arrays,
2193 * if NULL all vertices will be rendered in sequential order.
2194 * \param num_indices number of indices.
2195 * \param size_indices index size: 1 (byte), 2 (short), 4 (int).
2196 * \returns true on success or false on failure; call SDL_GetError() for more
2197 * information.
2198 *
2199 * \threadsafety You may only call this function from the main thread.
2200 *
2201 * \since This function is available since SDL 3.0.0.
2202 *
2203 * \sa SDL_RenderGeometry
2204 */
2205extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
2206 SDL_Texture *texture,
2207 const float *xy, int xy_stride,
2208 const SDL_FColor *color, int color_stride,
2209 const float *uv, int uv_stride,
2210 int num_vertices,
2211 const void *indices, int num_indices, int size_indices);
2212
2213/**
2214 * Read pixels from the current rendering target.
2215 *
2216 * The returned surface should be freed with SDL_DestroySurface()
2217 *
2218 * **WARNING**: This is a very slow operation, and should not be used
2219 * frequently. If you're using this on the main rendering target, it should be
2220 * called after rendering and before SDL_RenderPresent().
2221 *
2222 * \param renderer the rendering context.
2223 * \param rect an SDL_Rect structure representing the area in pixels relative
2224 * to the to current viewport, or NULL for the entire viewport.
2225 * \returns a new SDL_Surface on success or NULL on failure; call
2226 * SDL_GetError() for more information.
2227 *
2228 * \threadsafety You may only call this function from the main thread.
2229 *
2230 * \since This function is available since SDL 3.0.0.
2231 */
2232extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect);
2233
2234/**
2235 * Update the screen with any rendering performed since the previous call.
2236 *
2237 * SDL's rendering functions operate on a backbuffer; that is, calling a
2238 * rendering function such as SDL_RenderLine() does not directly put a line on
2239 * the screen, but rather updates the backbuffer. As such, you compose your
2240 * entire scene and *present* the composed backbuffer to the screen as a
2241 * complete picture.
2242 *
2243 * Therefore, when using SDL's rendering API, one does all drawing intended
2244 * for the frame, and then calls this function once per frame to present the
2245 * final drawing to the user.
2246 *
2247 * The backbuffer should be considered invalidated after each present; do not
2248 * assume that previous contents will exist between frames. You are strongly
2249 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
2250 * starting each new frame's drawing, even if you plan to overwrite every
2251 * pixel.
2252 *
2253 * Please note, that in case of rendering to a texture - there is **no need**
2254 * to call `SDL_RenderPresent` after drawing needed objects to a texture, and
2255 * should not be done; you are only required to change back the rendering
2256 * target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as
2257 * textures by themselves do not have a concept of backbuffers. Calling
2258 * SDL_RenderPresent while rendering to a texture will still update the screen
2259 * with any current drawing that has been done _to the window itself_.
2260 *
2261 * \param renderer the rendering context.
2262 * \returns true on success or false on failure; call SDL_GetError() for more
2263 * information.
2264 *
2265 * \threadsafety You may only call this function from the main thread.
2266 *
2267 * \since This function is available since SDL 3.0.0.
2268 *
2269 * \sa SDL_CreateRenderer
2270 * \sa SDL_RenderClear
2271 * \sa SDL_RenderFillRect
2272 * \sa SDL_RenderFillRects
2273 * \sa SDL_RenderLine
2274 * \sa SDL_RenderLines
2275 * \sa SDL_RenderPoint
2276 * \sa SDL_RenderPoints
2277 * \sa SDL_RenderRect
2278 * \sa SDL_RenderRects
2279 * \sa SDL_SetRenderDrawBlendMode
2280 * \sa SDL_SetRenderDrawColor
2281 */
2282extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
2283
2284/**
2285 * Destroy the specified texture.
2286 *
2287 * Passing NULL or an otherwise invalid texture will set the SDL error message
2288 * to "Invalid texture".
2289 *
2290 * \param texture the texture to destroy.
2291 *
2292 * \threadsafety You may only call this function from the main thread.
2293 *
2294 * \since This function is available since SDL 3.0.0.
2295 *
2296 * \sa SDL_CreateTexture
2297 * \sa SDL_CreateTextureFromSurface
2298 */
2299extern SDL_DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
2300
2301/**
2302 * Destroy the rendering context for a window and free all associated
2303 * textures.
2304 *
2305 * This should be called before destroying the associated window.
2306 *
2307 * \param renderer the rendering context.
2308 *
2309 * \threadsafety You may only call this function from the main thread.
2310 *
2311 * \since This function is available since SDL 3.0.0.
2312 *
2313 * \sa SDL_CreateRenderer
2314 */
2315extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
2316
2317/**
2318 * Force the rendering context to flush any pending commands and state.
2319 *
2320 * You do not need to (and in fact, shouldn't) call this function unless you
2321 * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
2322 * addition to using an SDL_Renderer.
2323 *
2324 * This is for a very-specific case: if you are using SDL's render API, and
2325 * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
2326 * calls. If this applies, you should call this function between calls to
2327 * SDL's render API and the low-level API you're using in cooperation.
2328 *
2329 * In all other cases, you can ignore this function.
2330 *
2331 * This call makes SDL flush any pending rendering work it was queueing up to
2332 * do later in a single batch, and marks any internal cached state as invalid,
2333 * so it'll prepare all its state again later, from scratch.
2334 *
2335 * This means you do not need to save state in your rendering code to protect
2336 * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
2337 * OpenGL state that can confuse things; you should use your best judgment and
2338 * be prepared to make changes if specific state needs to be protected.
2339 *
2340 * \param renderer the rendering context.
2341 * \returns true on success or false on failure; call SDL_GetError() for more
2342 * information.
2343 *
2344 * \threadsafety You may only call this function from the main thread.
2345 *
2346 * \since This function is available since SDL 3.0.0.
2347 */
2348extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
2349
2350/**
2351 * Get the CAMetalLayer associated with the given Metal renderer.
2352 *
2353 * This function returns `void *`, so SDL doesn't have to include Metal's
2354 * headers, but it can be safely cast to a `CAMetalLayer *`.
2355 *
2356 * \param renderer the renderer to query.
2357 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
2358 * Metal renderer.
2359 *
2360 * \threadsafety You may only call this function from the main thread.
2361 *
2362 * \since This function is available since SDL 3.0.0.
2363 *
2364 * \sa SDL_GetRenderMetalCommandEncoder
2365 */
2366extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
2367
2368/**
2369 * Get the Metal command encoder for the current frame.
2370 *
2371 * This function returns `void *`, so SDL doesn't have to include Metal's
2372 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
2373 *
2374 * This will return NULL if Metal refuses to give SDL a drawable to render to,
2375 * which might happen if the window is hidden/minimized/offscreen. This
2376 * doesn't apply to command encoders for render targets, just the window's
2377 * backbuffer. Check your return values!
2378 *
2379 * \param renderer the renderer to query.
2380 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
2381 * renderer isn't a Metal renderer or there was an error.
2382 *
2383 * \threadsafety You may only call this function from the main thread.
2384 *
2385 * \since This function is available since SDL 3.0.0.
2386 *
2387 * \sa SDL_GetRenderMetalLayer
2388 */
2389extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
2390
2391
2392/**
2393 * Add a set of synchronization semaphores for the current frame.
2394 *
2395 * The Vulkan renderer will wait for `wait_semaphore` before submitting
2396 * rendering commands and signal `signal_semaphore` after rendering commands
2397 * are complete for this frame.
2398 *
2399 * This should be called each frame that you want semaphore synchronization.
2400 * The Vulkan renderer may have multiple frames in flight on the GPU, so you
2401 * should have multiple semaphores that are used for synchronization. Querying
2402 * SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER will give you the
2403 * maximum number of semaphores you'll need.
2404 *
2405 * \param renderer the rendering context.
2406 * \param wait_stage_mask the VkPipelineStageFlags for the wait.
2407 * \param wait_semaphore a VkSempahore to wait on before rendering the current
2408 * frame, or 0 if not needed.
2409 * \param signal_semaphore a VkSempahore that SDL will signal when rendering
2410 * for the current frame is complete, or 0 if not
2411 * needed.
2412 * \returns true on success or false on failure; call SDL_GetError() for more
2413 * information.
2414 *
2415 * \threadsafety It is **NOT** safe to call this function from two threads at
2416 * once.
2417 *
2418 * \since This function is available since SDL 3.0.0.
2419 */
2420extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);
2421
2422/**
2423 * Toggle VSync of the given renderer.
2424 *
2425 * When a renderer is created, vsync defaults to SDL_RENDERER_VSYNC_DISABLED.
2426 *
2427 * The `vsync` parameter can be 1 to synchronize present with every vertical
2428 * refresh, 2 to synchronize present with every second vertical refresh, etc.,
2429 * SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync),
2430 * or SDL_WINDOW_SURFACE_VSYNC_DISABLED to disable. Not every value is
2431 * supported by every driver, so you should check the return value to see
2432 * whether the requested setting is supported.
2433 *
2434 * \param renderer the renderer to toggle.
2435 * \param vsync the vertical refresh sync interval.
2436 * \returns true on success or false on failure; call SDL_GetError() for more
2437 * information.
2438 *
2439 * \threadsafety You may only call this function from the main thread.
2440 *
2441 * \since This function is available since SDL 3.0.0.
2442 *
2443 * \sa SDL_GetRenderVSync
2444 */
2445extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
2446
2447#define SDL_RENDERER_VSYNC_DISABLED 0
2448#define SDL_RENDERER_VSYNC_ADAPTIVE (-1)
2449
2450/**
2451 * Get VSync of the given renderer.
2452 *
2453 * \param renderer the renderer to toggle.
2454 * \param vsync an int filled with the current vertical refresh sync interval.
2455 * See SDL_SetRenderVSync() for the meaning of the value.
2456 * \returns true on success or false on failure; call SDL_GetError() for more
2457 * information.
2458 *
2459 * \threadsafety You may only call this function from the main thread.
2460 *
2461 * \since This function is available since SDL 3.0.0.
2462 *
2463 * \sa SDL_SetRenderVSync
2464 */
2465extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
2466
2467/* Ends C function definitions when using C++ */
2468#ifdef __cplusplus
2469}
2470#endif
2471#include <SDL3/SDL_close_code.h>
2472
2473#endif /* SDL_render_h_ */
Uint32 SDL_BlendMode
SDL_PixelFormat
Definition SDL_pixels.h:265
Uint32 SDL_PropertiesID
void SDL_DestroyTexture(SDL_Texture *texture)
bool SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
bool SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
bool SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
bool SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_RenderPresent(SDL_Renderer *renderer)
bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect)
bool SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
bool SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
bool SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
bool SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
SDL_Window * SDL_GetRenderWindow(SDL_Renderer *renderer)
bool SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
bool SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h)
bool SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect)
bool SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
bool SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a)
void SDL_UnlockTexture(SDL_Texture *texture)
bool SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
bool SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
SDL_Surface * SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetNumRenderDrivers(void)
bool SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
bool SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props)
bool SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
bool SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b)
bool SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
bool SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha)
bool SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, SDL_TextureAccess access, int w, int h)
bool SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
bool SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
bool SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
SDL_Renderer * SDL_GetRendererFromTexture(SDL_Texture *texture)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name)
SDL_TextureAccess
Definition SDL_render.h:94
@ SDL_TEXTUREACCESS_STATIC
Definition SDL_render.h:95
@ SDL_TEXTUREACCESS_STREAMING
Definition SDL_render.h:96
@ SDL_TEXTUREACCESS_TARGET
Definition SDL_render.h:97
bool SDL_FlushRenderer(SDL_Renderer *renderer)
bool SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
bool SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
bool SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
bool SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_RenderClear(SDL_Renderer *renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
bool SDL_RenderViewportSet(SDL_Renderer *renderer)
bool SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode)
bool SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_RendererLogicalPresentation
Definition SDL_render.h:106
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition SDL_render.h:109
@ SDL_LOGICAL_PRESENTATION_DISABLED
Definition SDL_render.h:107
@ SDL_LOGICAL_PRESENTATION_OVERSCAN
Definition SDL_render.h:110
@ SDL_LOGICAL_PRESENTATION_STRETCH
Definition SDL_render.h:108
@ SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
Definition SDL_render.h:111
bool SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
bool SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
const char * SDL_GetRenderDriver(int index)
void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer)
struct SDL_Renderer SDL_Renderer
Definition SDL_render.h:119
bool SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
bool SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect)
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
bool SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
bool SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
bool SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
bool SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
bool SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
bool SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha)
bool SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
bool SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
bool SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)
bool SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale)
bool SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
bool SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a)
bool SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale)
bool SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b)
bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, double angle, const SDL_FPoint *center, SDL_FlipMode flip)
const char * SDL_GetRendererName(SDL_Renderer *renderer)
bool SDL_RenderGeometryRaw(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
uint8_t Uint8
Definition SDL_stdinc.h:320
int64_t Sint64
Definition SDL_stdinc.h:367
uint32_t Uint32
Definition SDL_stdinc.h:356
SDL_ScaleMode
Definition SDL_surface.h:72
SDL_FlipMode
Definition SDL_surface.h:83
struct SDL_Window SDL_Window
Definition SDL_video.h:144
Uint64 SDL_WindowFlags
Definition SDL_video.h:158
SDL_PixelFormat format
Definition SDL_render.h:135
SDL_FPoint tex_coord
Definition SDL_render.h:85
SDL_FPoint position
Definition SDL_render.h:83
SDL_FColor color
Definition SDL_render.h:84