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 * \file SDL_render.h
24 *
25 * Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 * * single pixel points
29 * * single pixel lines
30 * * filled rectangles
31 * * texture images
32 *
33 * The primitives may be drawn in opaque, blended, or additive modes.
34 *
35 * The texture images may be drawn in opaque, blended, or additive modes.
36 * They can have an additional color tint or alpha modulation applied to
37 * them, and may also be stretched with linear interpolation.
38 *
39 * This API is designed to accelerate simple 2D operations. You may
40 * want more functionality such as polygons and particle effects and
41 * in that case you should use SDL's OpenGL/Direct3D support or one
42 * of the many good 3D engines.
43 *
44 * These functions must be called from the main thread.
45 * See this bug for details: https://github.com/libsdl-org/SDL/issues/986
46 */
47
48#ifndef SDL_render_h_
49#define SDL_render_h_
50
51#include <SDL3/SDL_stdinc.h>
52#include <SDL3/SDL_events.h>
53#include <SDL3/SDL_properties.h>
54#include <SDL3/SDL_rect.h>
55#include <SDL3/SDL_video.h>
56
57#include <SDL3/SDL_begin_code.h>
58/* Set up for C function definitions, even when using C++ */
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63/**
64 * Flags used when creating a rendering context
65 */
66typedef enum
67{
68 SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
69 SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
70 acceleration */
71 SDL_RENDERER_PRESENTVSYNC = 0x00000004 /**< Present is synchronized
72 with the refresh rate */
74
75/**
76 * Information on the capabilities of a render driver or context.
77 */
78typedef struct SDL_RendererInfo
79{
80 const char *name; /**< The name of the renderer */
81 Uint32 flags; /**< Supported ::SDL_RendererFlags */
82 Uint32 num_texture_formats; /**< The number of available texture formats */
83 Uint32 texture_formats[16]; /**< The available texture formats */
84 int max_texture_width; /**< The maximum texture width */
85 int max_texture_height; /**< The maximum texture height */
87
88/**
89 * Vertex structure
90 */
91typedef struct SDL_Vertex
92{
93 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
94 SDL_FColor color; /**< Vertex color */
95 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
97
98/**
99 * The access pattern allowed for a texture.
100 */
101typedef enum
102{
103 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
104 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
105 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
107
108/**
109 * How the logical size is mapped to the output
110 */
111typedef enum
112{
113 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
114 SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
115 SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with black bars */
116 SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
117 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE /**< The rendered content is scaled up by integer multiples to fit the output resolution */
119
120/**
121 * A structure representing rendering state
122 */
123struct SDL_Renderer;
125
126/**
127 * An efficient driver-specific representation of pixel data
128 */
129struct SDL_Texture;
131
132/* Function prototypes */
133
134/**
135 * Get the number of 2D rendering drivers available for the current display.
136 *
137 * A render driver is a set of code that handles rendering and texture
138 * management on a particular display. Normally there is only one, but some
139 * drivers may have several available with different capabilities.
140 *
141 * There may be none if SDL was compiled without render support.
142 *
143 * \returns a number >= 0 on success or a negative error code on failure; call
144 * SDL_GetError() for more information.
145 *
146 * \since This function is available since SDL 3.0.0.
147 *
148 * \sa SDL_CreateRenderer
149 * \sa SDL_GetRenderDriver
150 */
151extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
152
153/**
154 * Use this function to get the name of a built in 2D rendering driver.
155 *
156 * The list of rendering drivers is given in the order that they are normally
157 * initialized by default; the drivers that seem more reasonable to choose
158 * first (as far as the SDL developers believe) are earlier in the list.
159 *
160 * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
161 * "direct3d12" or "metal". These never have Unicode characters, and are not
162 * meant to be proper names.
163 *
164 * The returned value points to a static, read-only string; do not modify or
165 * free it!
166 *
167 * \param index the index of the rendering driver; the value ranges from 0 to
168 * SDL_GetNumRenderDrivers() - 1
169 * \returns the name of the rendering driver at the requested index, or NULL
170 * if an invalid index was specified.
171 *
172 * \since This function is available since SDL 3.0.0.
173 *
174 * \sa SDL_GetNumRenderDrivers
175 */
176extern DECLSPEC const char *SDLCALL SDL_GetRenderDriver(int index);
177
178/**
179 * Create a window and default renderer.
180 *
181 * \param width the width of the window
182 * \param height the height of the window
183 * \param window_flags the flags used to create the window (see
184 * SDL_CreateWindow())
185 * \param window a pointer filled with the window, or NULL on error
186 * \param renderer a pointer filled with the renderer, or NULL on error
187 * \returns 0 on success or a negative error code on failure; call
188 * SDL_GetError() for more information.
189 *
190 * \since This function is available since SDL 3.0.0.
191 *
192 * \sa SDL_CreateRenderer
193 * \sa SDL_CreateWindow
194 */
195extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer);
196
197/**
198 * Create a 2D rendering context for a window.
199 *
200 * If you want a specific renderer, you can specify its name here. A list of
201 * available renderers can be obtained by calling SDL_GetRenderDriver multiple
202 * times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you don't
203 * need a specific renderer, specify NULL and SDL will attempt to choose the
204 * best option for you, based on what is available on the user's system.
205 *
206 * If you pass SDL_RENDERER_SOFTWARE in the flags, you will get a software
207 * renderer, otherwise you will get a hardware accelerated renderer if
208 * available.
209 *
210 * By default the rendering size matches the window size in pixels, but you
211 * can call SDL_SetRenderLogicalPresentation() to change the content size and
212 * scaling options.
213 *
214 * \param window the window where rendering is displayed
215 * \param name the name of the rendering driver to initialize, or NULL to
216 * initialize the first one supporting the requested flags
217 * \param flags 0, or one or more SDL_RendererFlags OR'd together
218 * \returns a valid rendering context or NULL if there was an error; call
219 * SDL_GetError() for more information.
220 *
221 * \since This function is available since SDL 3.0.0.
222 *
223 * \sa SDL_CreateRendererWithProperties
224 * \sa SDL_CreateSoftwareRenderer
225 * \sa SDL_DestroyRenderer
226 * \sa SDL_GetNumRenderDrivers
227 * \sa SDL_GetRenderDriver
228 * \sa SDL_GetRendererInfo
229 */
230extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags);
231
232/**
233 * Create a 2D rendering context for a window, with the specified properties.
234 *
235 * These are the supported properties:
236 *
237 * - `SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`: the window where rendering is
238 * displayed
239 * - `SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`: the surface where rendering
240 * is displayed, if you want a software renderer without a window
241 * - `SDL_PROP_RENDERER_CREATE_NAME_STRING`: the name of the rendering driver
242 * to use, if a specific one is desired
243 * - `SDL_PROP_RENDERER_CREATE_INPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace
244 * value describing the colorspace for input colors, defaults to
245 * SDL_COLORSPACE_SRGB
246 * - `SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace
247 * value describing the colorspace for output to the display, defaults to
248 * SDL_COLORSPACE_SRGB
249 * - `SDL_PROP_RENDERER_CREATE_COLORSPACE_CONVERSION_BOOLEAN`: true if you
250 * want conversion between the input colorspace and the output colorspace,
251 * defaults to SDL_TRUE
252 * - `SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN`: true if you want
253 * present synchronized with the refresh rate
254 *
255 * Note that enabling colorspace conversion between sRGB input and sRGB output
256 * implies that the rendering is done in a linear colorspace for more correct
257 * blending results. If colorspace conversion is disabled, then input colors
258 * are passed directly through to the output.
259 *
260 * \param props the properties to use
261 * \returns a valid rendering context or NULL if there was an error; call
262 * SDL_GetError() for more information.
263 *
264 * \since This function is available since SDL 3.0.0.
265 *
266 * \sa SDL_CreateRenderer
267 * \sa SDL_CreateSoftwareRenderer
268 * \sa SDL_DestroyRenderer
269 * \sa SDL_GetRendererInfo
270 */
272
273#define SDL_PROP_RENDERER_CREATE_WINDOW_POINTER "window"
274#define SDL_PROP_RENDERER_CREATE_SURFACE_POINTER "surface"
275#define SDL_PROP_RENDERER_CREATE_NAME_STRING "name"
276#define SDL_PROP_RENDERER_CREATE_INPUT_COLORSPACE_NUMBER "input_colorspace"
277#define SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER "output_colorspace"
278#define SDL_PROP_RENDERER_CREATE_COLORSPACE_CONVERSION_BOOLEAN "colorspace_conversion"
279#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_BOOLEAN "present_vsync"
280
281/**
282 * Create a 2D software rendering context for a surface.
283 *
284 * Two other API which can be used to create SDL_Renderer:
285 * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
286 * create a software renderer, but they are intended to be used with an
287 * SDL_Window as the final destination and not an SDL_Surface.
288 *
289 * \param surface the SDL_Surface structure representing the surface where
290 * rendering is done
291 * \returns a valid rendering context or NULL if there was an error; call
292 * SDL_GetError() for more information.
293 *
294 * \since This function is available since SDL 3.0.0.
295 *
296 * \sa SDL_CreateRenderer
297 * \sa SDL_CreateWindowRenderer
298 * \sa SDL_DestroyRenderer
299 */
300extern DECLSPEC SDL_Renderer *SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
301
302/**
303 * Get the renderer associated with a window.
304 *
305 * \param window the window to query
306 * \returns the rendering context on success or NULL on failure; call
307 * SDL_GetError() for more information.
308 *
309 * \since This function is available since SDL 3.0.0.
310 *
311 * \sa SDL_CreateRenderer
312 */
313extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetRenderer(SDL_Window *window);
314
315/**
316 * Get the window associated with a renderer.
317 *
318 * \param renderer the renderer to query
319 * \returns the window on success or NULL on failure; call SDL_GetError() for
320 * more information.
321 *
322 * \since This function is available since SDL 3.0.0.
323 */
324extern DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
325
326/**
327 * Get information about a rendering context.
328 *
329 * \param renderer the rendering context
330 * \param info an SDL_RendererInfo structure filled with information about the
331 * current renderer
332 * \returns 0 on success or a negative error code on failure; call
333 * SDL_GetError() for more information.
334 *
335 * \since This function is available since SDL 3.0.0.
336 *
337 * \sa SDL_CreateRenderer
338 */
339extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
340
341/**
342 * Get the properties associated with a renderer.
343 *
344 * The following read-only properties are provided by SDL:
345 *
346 * - `SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`: the IDirect3DDevice9 associated
347 * with the renderer
348 * - `SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`: the ID3D11Device associated
349 * with the renderer
350 * - `SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`: the ID3D12Device associated
351 * with the renderer
352 * - `SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`: the ID3D12CommandQueue
353 * associated with the renderer
354 *
355 * \param renderer the rendering context
356 * \returns a valid property ID on success or 0 on failure; call
357 * SDL_GetError() for more information.
358 *
359 * \since This function is available since SDL 3.0.0.
360 *
361 * \sa SDL_GetProperty
362 * \sa SDL_SetProperty
363 */
364extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer);
365
366#define SDL_PROP_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device"
367#define SDL_PROP_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device"
368#define SDL_PROP_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device"
369#define SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER "SDL.renderer.d3d12.command_queue"
370
371/**
372 * Get the output size in pixels of a rendering context.
373 *
374 * This returns the true output size in pixels, ignoring any render targets or
375 * logical size and presentation.
376 *
377 * \param renderer the rendering context
378 * \param w a pointer filled in with the width in pixels
379 * \param h a pointer filled in with the height in pixels
380 * \returns 0 on success or a negative error code on failure; call
381 * SDL_GetError() for more information.
382 *
383 * \since This function is available since SDL 3.0.0.
384 *
385 * \sa SDL_GetRenderer
386 */
387extern DECLSPEC int SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
388
389/**
390 * Get the current output size in pixels of a rendering context.
391 *
392 * If a rendering target is active, this will return the size of the rendering
393 * target in pixels, otherwise if a logical size is set, it will return the
394 * logical size, otherwise it will return the value of
395 * SDL_GetRenderOutputSize().
396 *
397 * \param renderer the rendering context
398 * \param w a pointer filled in with the current width
399 * \param h a pointer filled in with the current height
400 * \returns 0 on success or a negative error code on failure; call
401 * SDL_GetError() for more information.
402 *
403 * \since This function is available since SDL 3.0.0.
404 *
405 * \sa SDL_GetRenderOutputSize
406 * \sa SDL_GetRenderer
407 */
408extern DECLSPEC int SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
409
410/**
411 * Create a texture for a rendering context.
412 *
413 * You can set the texture scaling method by setting
414 * `SDL_HINT_RENDER_SCALE_QUALITY` before creating the texture.
415 *
416 * \param renderer the rendering context
417 * \param format one of the enumerated values in SDL_PixelFormatEnum
418 * \param access one of the enumerated values in SDL_TextureAccess
419 * \param w the width of the texture in pixels
420 * \param h the height of the texture in pixels
421 * \returns a pointer to the created texture or NULL if no rendering context
422 * was active, the format was unsupported, or the width or height
423 * were out of range; call SDL_GetError() for more information.
424 *
425 * \since This function is available since SDL 3.0.0.
426 *
427 * \sa SDL_CreateTextureFromSurface
428 * \sa SDL_CreateTextureWithProperties
429 * \sa SDL_DestroyTexture
430 * \sa SDL_QueryTexture
431 * \sa SDL_UpdateTexture
432 */
433extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h);
434
435/**
436 * Create a texture from an existing surface.
437 *
438 * The surface is not modified or freed by this function.
439 *
440 * The SDL_TextureAccess hint for the created texture is
441 * `SDL_TEXTUREACCESS_STATIC`.
442 *
443 * The pixel format of the created texture may be different from the pixel
444 * format of the surface. Use SDL_QueryTexture() to query the pixel format of
445 * the texture.
446 *
447 * \param renderer the rendering context
448 * \param surface the SDL_Surface structure containing pixel data used to fill
449 * the texture
450 * \returns the created texture or NULL on failure; call SDL_GetError() for
451 * more information.
452 *
453 * \since This function is available since SDL 3.0.0.
454 *
455 * \sa SDL_CreateTexture
456 * \sa SDL_CreateTextureWithProperties
457 * \sa SDL_DestroyTexture
458 * \sa SDL_QueryTexture
459 */
460extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface);
461
462/**
463 * Create a texture for a rendering context with the specified properties.
464 *
465 * These are the supported properties:
466 *
467 * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_ColorSpace value
468 * describing the texture colorspace, defaults to SDL_COLORSPACE_SCRGB for
469 * floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures,
470 * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_BT709_FULL
471 * for YUV textures.
472 * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in
473 * SDL_PixelFormatEnum, defaults to the best RGBA format for the renderer
474 * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in
475 * SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC
476 * - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in
477 * pixels, required
478 * - `SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`: the height of the texture in
479 * pixels, required
480 *
481 * With the direct3d11 renderer:
482 *
483 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D
484 * associated with the texture, if you want to wrap an existing texture.
485 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
486 * associated with the U plane of a YUV texture, if you want to wrap an
487 * existing texture.
488 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
489 * associated with the V plane of a YUV texture, if you want to wrap an
490 * existing texture.
491 *
492 * With the direct3d12 renderer:
493 *
494 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`: the ID3D12Resource
495 * associated with the texture, if you want to wrap an existing texture.
496 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource
497 * associated with the U plane of a YUV texture, if you want to wrap an
498 * existing texture.
499 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource
500 * associated with the V plane of a YUV texture, if you want to wrap an
501 * existing texture.
502 *
503 * With the opengl renderer:
504 *
505 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`: the GLuint texture
506 * associated with the texture, if you want to wrap an existing texture.
507 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
508 * associated with the UV plane of an NV12 texture, if you want to wrap an
509 * existing texture.
510 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture
511 * associated with the U plane of a YUV texture, if you want to wrap an
512 * existing texture.
513 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture
514 * associated with the V plane of a YUV texture, if you want to wrap an
515 * existing texture.
516 *
517 * With the opengles2 renderer:
518 *
519 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
520 * associated with the texture, if you want to wrap an existing texture.
521 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
522 * associated with the texture, if you want to wrap an existing texture.
523 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
524 * associated with the UV plane of an NV12 texture, if you want to wrap an
525 * existing texture.
526 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
527 * associated with the U plane of a YUV texture, if you want to wrap an
528 * existing texture.
529 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
530 * associated with the V plane of a YUV texture, if you want to wrap an
531 * existing texture.
532 *
533 * \param renderer the rendering context
534 * \param props the properties to use
535 * \returns a pointer to the created texture or NULL if no rendering context
536 * was active, the format was unsupported, or the width or height
537 * were out of range; call SDL_GetError() for more information.
538 *
539 * \since This function is available since SDL 3.0.0.
540 *
541 * \sa SDL_CreateTextureFromSurface
542 * \sa SDL_CreateTexture
543 * \sa SDL_DestroyTexture
544 * \sa SDL_QueryTexture
545 * \sa SDL_UpdateTexture
546 */
548
549#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER "colorspace"
550#define SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER "format"
551#define SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER "access"
552#define SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER "width"
553#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER "height"
554#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "d3d11.texture"
555#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER "d3d11.texture_u"
556#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER "d3d11.texture_v"
557#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "d3d12.texture"
558#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER "d3d12.texture_u"
559#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER "d3d12.texture_v"
560#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER "opengl.texture"
561#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER "opengl.texture_uv"
562#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER "opengl.texture_u"
563#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER "opengl.texture_v"
564#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "opengles2.texture"
565#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "opengles2.texture"
566#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER "opengles2.texture_uv"
567#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER "opengles2.texture_u"
568#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER "opengles2.texture_v"
569
570
571/**
572 * Get the properties associated with a texture.
573 *
574 * The following read-only properties are provided by SDL:
575 *
576 * - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_ColorSpace value describing
577 * the colorspace used by the texture
578 *
579 * With the direct3d11 renderer:
580 *
581 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D associated
582 * with the texture
583 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
584 * associated with the U plane of a YUV texture
585 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
586 * associated with the V plane of a YUV texture
587 *
588 * With the direct3d12 renderer:
589 *
590 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`: the ID3D12Resource associated
591 * with the texture
592 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource associated
593 * with the U plane of a YUV texture
594 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource associated
595 * with the V plane of a YUV texture
596 *
597 * With the opengl renderer:
598 *
599 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`: the GLuint texture associated
600 * with the texture
601 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
602 * associated with the UV plane of an NV12 texture
603 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture associated
604 * with the U plane of a YUV texture
605 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture associated
606 * with the V plane of a YUV texture
607 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET`: the GLenum for the texture
608 * target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc)
609 * - `SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`: the texture coordinate width of
610 * the texture (0.0 - 1.0)
611 * - `SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`: the texture coordinate height of
612 * the texture (0.0 - 1.0)
613 *
614 * With the opengles2 renderer:
615 *
616 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
617 * associated with the texture
618 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
619 * associated with the UV plane of an NV12 texture
620 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
621 * associated with the U plane of a YUV texture
622 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
623 * associated with the V plane of a YUV texture
624 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET`: the GLenum for the texture
625 * target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
626 *
627 * \param texture the texture to query
628 * \returns a valid property ID on success or 0 on failure; call
629 * SDL_GetError() for more information.
630 *
631 * \since This function is available since SDL 3.0.0.
632 *
633 * \sa SDL_GetProperty
634 * \sa SDL_SetProperty
635 */
636extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
637
638#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER "SDL.texture.colorspace"
639#define SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture"
640#define SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER "SDL.texture.d3d11.texture_u"
641#define SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER "SDL.texture.d3d11.texture_v"
642#define SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture"
643#define SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER "SDL.texture.d3d12.texture_u"
644#define SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER "SDL.texture.d3d12.texture_v"
645#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture"
646#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.opengl.texture_uv"
647#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.opengl.texture_u"
648#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.opengl.texture_v"
649#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET "SDL.texture.opengl.target"
650#define SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w"
651#define SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h"
652#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture"
653#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.opengles2.texture_uv"
654#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.opengles2.texture_u"
655#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
656#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET "SDL.texture.opengles2.target"
657
658/**
659 * Get the renderer that created an SDL_Texture.
660 *
661 * \param texture the texture to query
662 * \returns a pointer to the SDL_Renderer that created the texture, or NULL on
663 * failure; call SDL_GetError() for more information.
664 *
665 * \threadsafety It is safe to call this function from any thread.
666 *
667 * \since This function is available since SDL 3.0.0.
668 *
669 * \sa SDL_CreateTexture
670 * \sa SDL_CreateTextureFromSurface
671 * \sa SDL_CreateTextureWithProperties
672 */
673extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetRendererFromTexture(SDL_Texture *texture);
674
675/**
676 * Query the attributes of a texture.
677 *
678 * \param texture the texture to query
679 * \param format a pointer filled in with the raw format of the texture; the
680 * actual format may differ, but pixel transfers will use this
681 * format (one of the SDL_PixelFormatEnum values). This argument
682 * can be NULL if you don't need this information.
683 * \param access a pointer filled in with the actual access to the texture
684 * (one of the SDL_TextureAccess values). This argument can be
685 * NULL if you don't need this information.
686 * \param w a pointer filled in with the width of the texture in pixels. This
687 * argument can be NULL if you don't need this information.
688 * \param h a pointer filled in with the height of the texture in pixels. This
689 * argument can be NULL if you don't need this information.
690 * \returns 0 on success or a negative error code on failure; call
691 * SDL_GetError() for more information.
692 *
693 * \since This function is available since SDL 3.0.0.
694 *
695 * \sa SDL_CreateTexture
696 */
697extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h);
698
699/**
700 * Set an additional color value multiplied into render copy operations.
701 *
702 * When this texture is rendered, during the copy operation each source color
703 * channel is modulated by the appropriate color value according to the
704 * following formula:
705 *
706 * `srcC = srcC * (color / 255)`
707 *
708 * Color modulation is not always supported by the renderer; it will return -1
709 * if color modulation is not supported.
710 *
711 * \param texture the texture to update
712 * \param r the red color value multiplied into copy operations
713 * \param g the green color value multiplied into copy operations
714 * \param b the blue color value multiplied into copy operations
715 * \returns 0 on success or a negative error code on failure; call
716 * SDL_GetError() for more information.
717 *
718 * \since This function is available since SDL 3.0.0.
719 *
720 * \sa SDL_GetTextureColorMod
721 * \sa SDL_SetTextureAlphaMod
722 * \sa SDL_SetTextureColorModFloat
723 */
724extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
725
726
727/**
728 * Set an additional color value multiplied into render copy operations.
729 *
730 * When this texture is rendered, during the copy operation each source color
731 * channel is modulated by the appropriate color value according to the
732 * following formula:
733 *
734 * `srcC = srcC * color`
735 *
736 * Color modulation is not always supported by the renderer; it will return -1
737 * if color modulation is not supported.
738 *
739 * \param texture the texture to update
740 * \param r the red color value multiplied into copy operations
741 * \param g the green color value multiplied into copy operations
742 * \param b the blue color value multiplied into copy operations
743 * \returns 0 on success or a negative error code on failure; call
744 * SDL_GetError() for more information.
745 *
746 * \since This function is available since SDL 3.0.0.
747 *
748 * \sa SDL_GetTextureColorModFloat
749 * \sa SDL_SetTextureAlphaModFloat
750 * \sa SDL_SetTextureColorMod
751 */
752extern DECLSPEC int SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b);
753
754
755/**
756 * Get the additional color value multiplied into render copy operations.
757 *
758 * \param texture the texture to query
759 * \param r a pointer filled in with the current red color value
760 * \param g a pointer filled in with the current green color value
761 * \param b a pointer filled in with the current blue color value
762 * \returns 0 on success or a negative error code on failure; call
763 * SDL_GetError() for more information.
764 *
765 * \since This function is available since SDL 3.0.0.
766 *
767 * \sa SDL_GetTextureAlphaMod
768 * \sa SDL_GetTextureColorModFloat
769 * \sa SDL_SetTextureColorMod
770 */
771extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
772
773/**
774 * Get the additional color value multiplied into render copy operations.
775 *
776 * \param texture the texture to query
777 * \param r a pointer filled in with the current red color value
778 * \param g a pointer filled in with the current green color value
779 * \param b a pointer filled in with the current blue color value
780 * \returns 0 on success or a negative error code on failure; call
781 * SDL_GetError() for more information.
782 *
783 * \since This function is available since SDL 3.0.0.
784 *
785 * \sa SDL_GetTextureAlphaModFloat
786 * \sa SDL_GetTextureColorMod
787 * \sa SDL_SetTextureColorModFloat
788 */
789extern DECLSPEC int SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b);
790
791/**
792 * Set an additional alpha value multiplied into render copy operations.
793 *
794 * When this texture is rendered, during the copy operation the source alpha
795 * value is modulated by this alpha value according to the following formula:
796 *
797 * `srcA = srcA * (alpha / 255)`
798 *
799 * Alpha modulation is not always supported by the renderer; it will return -1
800 * if alpha modulation is not supported.
801 *
802 * \param texture the texture to update
803 * \param alpha the source alpha value multiplied into copy operations
804 * \returns 0 on success or a negative error code on failure; call
805 * SDL_GetError() for more information.
806 *
807 * \since This function is available since SDL 3.0.0.
808 *
809 * \sa SDL_GetTextureAlphaMod
810 * \sa SDL_SetTextureAlphaModFloat
811 * \sa SDL_SetTextureColorMod
812 */
813extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
814
815/**
816 * Set an additional alpha value multiplied into render copy operations.
817 *
818 * When this texture is rendered, during the copy operation the source alpha
819 * value is modulated by this alpha value according to the following formula:
820 *
821 * `srcA = srcA * alpha`
822 *
823 * Alpha modulation is not always supported by the renderer; it will return -1
824 * if alpha modulation is not supported.
825 *
826 * \param texture the texture to update
827 * \param alpha the source alpha value multiplied into copy operations
828 * \returns 0 on success or a negative error code on failure; call
829 * SDL_GetError() for more information.
830 *
831 * \since This function is available since SDL 3.0.0.
832 *
833 * \sa SDL_GetTextureAlphaModFloat
834 * \sa SDL_SetTextureAlphaMod
835 * \sa SDL_SetTextureColorModFloat
836 */
837extern DECLSPEC int SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha);
838
839/**
840 * Get the additional alpha value multiplied into render copy operations.
841 *
842 * \param texture the texture to query
843 * \param alpha a pointer filled in with the current alpha value
844 * \returns 0 on success or a negative error code on failure; call
845 * SDL_GetError() for more information.
846 *
847 * \since This function is available since SDL 3.0.0.
848 *
849 * \sa SDL_GetTextureAlphaModFloat
850 * \sa SDL_GetTextureColorMod
851 * \sa SDL_SetTextureAlphaMod
852 */
853extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
854
855/**
856 * Get the additional alpha value multiplied into render copy operations.
857 *
858 * \param texture the texture to query
859 * \param alpha a pointer filled in with the current alpha value
860 * \returns 0 on success or a negative error code on failure; call
861 * SDL_GetError() for more information.
862 *
863 * \since This function is available since SDL 3.0.0.
864 *
865 * \sa SDL_GetTextureAlphaMod
866 * \sa SDL_GetTextureColorModFloat
867 * \sa SDL_SetTextureAlphaModFloat
868 */
869extern DECLSPEC int SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha);
870
871/**
872 * Set the blend mode for a texture, used by SDL_RenderTexture().
873 *
874 * If the blend mode is not supported, the closest supported mode is chosen
875 * and this function returns -1.
876 *
877 * \param texture the texture to update
878 * \param blendMode the SDL_BlendMode to use for texture blending
879 * \returns 0 on success or a negative error code on failure; call
880 * SDL_GetError() for more information.
881 *
882 * \since This function is available since SDL 3.0.0.
883 *
884 * \sa SDL_GetTextureBlendMode
885 * \sa SDL_RenderTexture
886 */
887extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
888
889/**
890 * Get the blend mode used for texture copy operations.
891 *
892 * \param texture the texture to query
893 * \param blendMode a pointer filled in with the current SDL_BlendMode
894 * \returns 0 on success or a negative error code on failure; call
895 * SDL_GetError() for more information.
896 *
897 * \since This function is available since SDL 3.0.0.
898 *
899 * \sa SDL_SetTextureBlendMode
900 */
901extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
902
903/**
904 * Set the scale mode used for texture scale operations.
905 *
906 * If the scale mode is not supported, the closest supported mode is chosen.
907 *
908 * \param texture The texture to update.
909 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
910 * \returns 0 on success or a negative error code on failure; call
911 * SDL_GetError() for more information.
912 *
913 * \since This function is available since SDL 3.0.0.
914 *
915 * \sa SDL_GetTextureScaleMode
916 */
917extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
918
919/**
920 * Get the scale mode used for texture scale operations.
921 *
922 * \param texture the texture to query.
923 * \param scaleMode a pointer filled in with the current scale mode.
924 * \returns 0 on success or a negative error code on failure; call
925 * SDL_GetError() for more information.
926 *
927 * \since This function is available since SDL 3.0.0.
928 *
929 * \sa SDL_SetTextureScaleMode
930 */
931extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
932
933/**
934 * Update the given texture rectangle with new pixel data.
935 *
936 * The pixel data must be in the pixel format of the texture. Use
937 * SDL_QueryTexture() to query the pixel format of the texture.
938 *
939 * This is a fairly slow function, intended for use with static textures that
940 * do not change often.
941 *
942 * If the texture is intended to be updated often, it is preferred to create
943 * the texture as streaming and use the locking functions referenced below.
944 * While this function will work with streaming textures, for optimization
945 * reasons you may not get the pixels back if you lock the texture afterward.
946 *
947 * \param texture the texture to update
948 * \param rect an SDL_Rect structure representing the area to update, or NULL
949 * to update the entire texture
950 * \param pixels the raw pixel data in the format of the texture
951 * \param pitch the number of bytes in a row of pixel data, including padding
952 * between lines
953 * \returns 0 on success or a negative error code on failure; call
954 * SDL_GetError() for more information.
955 *
956 * \since This function is available since SDL 3.0.0.
957 *
958 * \sa SDL_CreateTexture
959 * \sa SDL_LockTexture
960 * \sa SDL_UnlockTexture
961 */
962extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
963
964/**
965 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
966 * data.
967 *
968 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
969 * block of Y and U/V planes in the proper order, but this function is
970 * available if your pixel data is not contiguous.
971 *
972 * \param texture the texture to update
973 * \param rect a pointer to the rectangle of pixels to update, or NULL to
974 * update the entire texture
975 * \param Yplane the raw pixel data for the Y plane
976 * \param Ypitch the number of bytes between rows of pixel data for the Y
977 * plane
978 * \param Uplane the raw pixel data for the U plane
979 * \param Upitch the number of bytes between rows of pixel data for the U
980 * plane
981 * \param Vplane the raw pixel data for the V plane
982 * \param Vpitch the number of bytes between rows of pixel data for the V
983 * plane
984 * \returns 0 on success or a negative error code on failure; call
985 * SDL_GetError() for more information.
986 *
987 * \since This function is available since SDL 3.0.0.
988 *
989 * \sa SDL_UpdateTexture
990 */
991extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
992 const SDL_Rect *rect,
993 const Uint8 *Yplane, int Ypitch,
994 const Uint8 *Uplane, int Upitch,
995 const Uint8 *Vplane, int Vpitch);
996
997/**
998 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
999 *
1000 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1001 * block of NV12/21 planes in the proper order, but this function is available
1002 * if your pixel data is not contiguous.
1003 *
1004 * \param texture the texture to update
1005 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1006 * update the entire texture.
1007 * \param Yplane the raw pixel data for the Y plane.
1008 * \param Ypitch the number of bytes between rows of pixel data for the Y
1009 * plane.
1010 * \param UVplane the raw pixel data for the UV plane.
1011 * \param UVpitch the number of bytes between rows of pixel data for the UV
1012 * plane.
1013 * \returns 0 on success or a negative error code on failure; call
1014 * SDL_GetError() for more information.
1015 *
1016 * \since This function is available since SDL 3.0.0.
1017 */
1018extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
1019 const SDL_Rect *rect,
1020 const Uint8 *Yplane, int Ypitch,
1021 const Uint8 *UVplane, int UVpitch);
1022
1023/**
1024 * Lock a portion of the texture for **write-only** pixel access.
1025 *
1026 * As an optimization, the pixels made available for editing don't necessarily
1027 * contain the old texture data. This is a write-only operation, and if you
1028 * need to keep a copy of the texture data you should do that at the
1029 * application level.
1030 *
1031 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1032 * changes.
1033 *
1034 * \param texture the texture to lock for access, which was created with
1035 * `SDL_TEXTUREACCESS_STREAMING`
1036 * \param rect an SDL_Rect structure representing the area to lock for access;
1037 * NULL to lock the entire texture
1038 * \param pixels this is filled in with a pointer to the locked pixels,
1039 * appropriately offset by the locked area
1040 * \param pitch this is filled in with the pitch of the locked pixels; the
1041 * pitch is the length of one row in bytes
1042 * \returns 0 on success or a negative error code if the texture is not valid
1043 * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call
1044 * SDL_GetError() for more information.
1045 *
1046 * \since This function is available since SDL 3.0.0.
1047 *
1048 * \sa SDL_UnlockTexture
1049 */
1050extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture *texture,
1051 const SDL_Rect *rect,
1052 void **pixels, int *pitch);
1053
1054/**
1055 * Lock a portion of the texture for **write-only** pixel access, and expose
1056 * it as a SDL surface.
1057 *
1058 * Besides providing an SDL_Surface instead of raw pixel data, this function
1059 * operates like SDL_LockTexture.
1060 *
1061 * As an optimization, the pixels made available for editing don't necessarily
1062 * contain the old texture data. This is a write-only operation, and if you
1063 * need to keep a copy of the texture data you should do that at the
1064 * application level.
1065 *
1066 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1067 * changes.
1068 *
1069 * The returned surface is freed internally after calling SDL_UnlockTexture()
1070 * or SDL_DestroyTexture(). The caller should not free it.
1071 *
1072 * \param texture the texture to lock for access, which must be created with
1073 * `SDL_TEXTUREACCESS_STREAMING`
1074 * \param rect a pointer to the rectangle to lock for access. If the rect is
1075 * NULL, the entire texture will be locked
1076 * \param surface this is filled in with an SDL surface representing the
1077 * locked area
1078 * \returns 0 on success or a negative error code on failure; call
1079 * SDL_GetError() for more information.
1080 *
1081 * \since This function is available since SDL 3.0.0.
1082 *
1083 * \sa SDL_LockTexture
1084 * \sa SDL_UnlockTexture
1085 */
1086extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
1087 const SDL_Rect *rect,
1088 SDL_Surface **surface);
1089
1090/**
1091 * Unlock a texture, uploading the changes to video memory, if needed.
1092 *
1093 * **Warning**: Please note that SDL_LockTexture() is intended to be
1094 * write-only; it will not guarantee the previous contents of the texture will
1095 * be provided. You must fully initialize any area of a texture that you lock
1096 * before unlocking it, as the pixels might otherwise be uninitialized memory.
1097 *
1098 * Which is to say: locking and immediately unlocking a texture can result in
1099 * corrupted textures, depending on the renderer in use.
1100 *
1101 * \param texture a texture locked by SDL_LockTexture()
1102 *
1103 * \since This function is available since SDL 3.0.0.
1104 *
1105 * \sa SDL_LockTexture
1106 */
1107extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
1108
1109/**
1110 * Set a texture as the current rendering target.
1111 *
1112 * The default render target is the window for which the renderer was created.
1113 * To stop rendering to a texture and render to the window again, call this
1114 * function with a NULL `texture`.
1115 *
1116 * \param renderer the rendering context
1117 * \param texture the targeted texture, which must be created with the
1118 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
1119 * window instead of a texture.
1120 * \returns 0 on success or a negative error code on failure; call
1121 * SDL_GetError() for more information.
1122 *
1123 * \since This function is available since SDL 3.0.0.
1124 *
1125 * \sa SDL_GetRenderTarget
1126 */
1127extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
1128
1129/**
1130 * Get the current render target.
1131 *
1132 * The default render target is the window for which the renderer was created,
1133 * and is reported a NULL here.
1134 *
1135 * \param renderer the rendering context
1136 * \returns the current render target or NULL for the default render target.
1137 *
1138 * \since This function is available since SDL 3.0.0.
1139 *
1140 * \sa SDL_SetRenderTarget
1141 */
1142extern DECLSPEC SDL_Texture *SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer);
1143
1144/**
1145 * Set a device independent resolution and presentation mode for rendering.
1146 *
1147 * This function sets the width and height of the logical rendering output. A
1148 * render target is created at the specified size and used for rendering and
1149 * then copied to the output during presentation.
1150 *
1151 * You can disable logical coordinates by setting the mode to
1152 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
1153 * resolution of the output window.
1154 *
1155 * You can convert coordinates in an event into rendering coordinates using
1156 * SDL_ConvertEventToRenderCoordinates().
1157 *
1158 * \param renderer the rendering context
1159 * \param w the width of the logical resolution
1160 * \param h the height of the logical resolution
1161 * \param mode the presentation mode used
1162 * \param scale_mode the scale mode used
1163 * \returns 0 on success or a negative error code on failure; call
1164 * SDL_GetError() for more information.
1165 *
1166 * \since This function is available since SDL 3.0.0.
1167 *
1168 * \sa SDL_ConvertEventToRenderCoordinates
1169 * \sa SDL_GetRenderLogicalPresentation
1170 */
1171extern DECLSPEC int SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode);
1172
1173/**
1174 * Get device independent resolution and presentation mode for rendering.
1175 *
1176 * This function gets the width and height of the logical rendering output, or
1177 * the output size in pixels if a logical resolution is not enabled.
1178 *
1179 * \param renderer the rendering context
1180 * \param w an int to be filled with the width
1181 * \param h an int to be filled with the height
1182 * \param mode a pointer filled in with the presentation mode
1183 * \param scale_mode a pointer filled in with the scale mode
1184 * \returns 0 on success or a negative error code on failure; call
1185 * SDL_GetError() for more information.
1186 *
1187 * \since This function is available since SDL 3.0.0.
1188 *
1189 * \sa SDL_SetRenderLogicalPresentation
1190 */
1191extern DECLSPEC int SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode);
1192
1193/**
1194 * Get a point in render coordinates when given a point in window coordinates.
1195 *
1196 * \param renderer the rendering context
1197 * \param window_x the x coordinate in window coordinates
1198 * \param window_y the y coordinate in window coordinates
1199 * \param x a pointer filled with the x coordinate in render coordinates
1200 * \param y a pointer filled with the y coordinate in render coordinates
1201 * \returns 0 on success or a negative error code on failure; call
1202 * SDL_GetError() for more information.
1203 *
1204 * \since This function is available since SDL 3.0.0.
1205 *
1206 * \sa SDL_SetRenderLogicalPresentation
1207 * \sa SDL_SetRenderScale
1208 */
1209extern DECLSPEC int SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
1210
1211/**
1212 * Get a point in window coordinates when given a point in render coordinates.
1213 *
1214 * \param renderer the rendering context
1215 * \param x the x coordinate in render coordinates
1216 * \param y the y coordinate in render coordinates
1217 * \param window_x a pointer filled with the x coordinate in window
1218 * coordinates
1219 * \param window_y a pointer filled with the y coordinate in window
1220 * coordinates
1221 * \returns 0 on success or a negative error code on failure; call
1222 * SDL_GetError() for more information.
1223 *
1224 * \since This function is available since SDL 3.0.0.
1225 *
1226 * \sa SDL_SetRenderLogicalPresentation
1227 * \sa SDL_SetRenderScale
1228 */
1229extern DECLSPEC int SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
1230
1231/**
1232 * Convert the coordinates in an event to render coordinates.
1233 *
1234 * Touch coordinates are converted from normalized coordinates in the window
1235 * to non-normalized rendering coordinates.
1236 *
1237 * Once converted, the coordinates may be outside the rendering area.
1238 *
1239 * \param renderer the rendering context
1240 * \param event the event to modify
1241 * \returns 0 on success or a negative error code on failure; call
1242 * SDL_GetError() for more information.
1243 *
1244 * \since This function is available since SDL 3.0.0.
1245 *
1246 * \sa SDL_GetRenderCoordinatesFromWindowCoordinates
1247 */
1248extern DECLSPEC int SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
1249
1250/**
1251 * Set the drawing area for rendering on the current target.
1252 *
1253 * \param renderer the rendering context
1254 * \param rect the SDL_Rect structure representing the drawing area, or NULL
1255 * to set the viewport to the entire target
1256 * \returns 0 on success or a negative error code on failure; call
1257 * SDL_GetError() for more information.
1258 *
1259 * \since This function is available since SDL 3.0.0.
1260 *
1261 * \sa SDL_GetRenderViewport
1262 */
1263extern DECLSPEC int SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
1264
1265/**
1266 * Get the drawing area for the current target.
1267 *
1268 * \param renderer the rendering context
1269 * \param rect an SDL_Rect structure filled in with the current drawing area
1270 * \returns 0 on success or a negative error code on failure; call
1271 * SDL_GetError() for more information.
1272 *
1273 * \since This function is available since SDL 3.0.0.
1274 *
1275 * \sa SDL_SetRenderViewport
1276 */
1277extern DECLSPEC int SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
1278
1279/**
1280 * Set the clip rectangle for rendering on the specified target.
1281 *
1282 * \param renderer the rendering context
1283 * \param rect an SDL_Rect structure representing the clip area, relative to
1284 * the viewport, or NULL to disable clipping
1285 * \returns 0 on success or a negative error code on failure; call
1286 * SDL_GetError() for more information.
1287 *
1288 * \since This function is available since SDL 3.0.0.
1289 *
1290 * \sa SDL_GetRenderClipRect
1291 * \sa SDL_RenderClipEnabled
1292 */
1293extern DECLSPEC int SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
1294
1295/**
1296 * Get the clip rectangle for the current target.
1297 *
1298 * \param renderer the rendering context
1299 * \param rect an SDL_Rect structure filled in with the current clipping area
1300 * or an empty rectangle if clipping is disabled
1301 * \returns 0 on success or a negative error code on failure; call
1302 * SDL_GetError() for more information.
1303 *
1304 * \since This function is available since SDL 3.0.0.
1305 *
1306 * \sa SDL_RenderClipEnabled
1307 * \sa SDL_SetRenderClipRect
1308 */
1309extern DECLSPEC int SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1310
1311/**
1312 * Get whether clipping is enabled on the given renderer.
1313 *
1314 * \param renderer the rendering context
1315 * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call
1316 * SDL_GetError() for more information.
1317 *
1318 * \since This function is available since SDL 3.0.0.
1319 *
1320 * \sa SDL_GetRenderClipRect
1321 * \sa SDL_SetRenderClipRect
1322 */
1323extern DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1324
1325/**
1326 * Set the drawing scale for rendering on the current target.
1327 *
1328 * The drawing coordinates are scaled by the x/y scaling factors before they
1329 * are used by the renderer. This allows resolution independent drawing with a
1330 * single coordinate system.
1331 *
1332 * If this results in scaling or subpixel drawing by the rendering backend, it
1333 * will be handled using the appropriate quality hints. For best results use
1334 * integer scaling factors.
1335 *
1336 * \param renderer the rendering context
1337 * \param scaleX the horizontal scaling factor
1338 * \param scaleY the vertical scaling factor
1339 * \returns 0 on success or a negative error code on failure; call
1340 * SDL_GetError() for more information.
1341 *
1342 * \since This function is available since SDL 3.0.0.
1343 *
1344 * \sa SDL_GetRenderScale
1345 */
1346extern DECLSPEC int SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1347
1348/**
1349 * Get the drawing scale for the current target.
1350 *
1351 * \param renderer the rendering context
1352 * \param scaleX a pointer filled in with the horizontal scaling factor
1353 * \param scaleY a pointer filled in with the vertical scaling factor
1354 * \returns 0 on success or a negative error code on failure; call
1355 * SDL_GetError() for more information.
1356 *
1357 * \since This function is available since SDL 3.0.0.
1358 *
1359 * \sa SDL_SetRenderScale
1360 */
1361extern DECLSPEC int SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1362
1363/**
1364 * Set the colorspace used for drawing operations
1365 *
1366 * The default colorspace for drawing operations is SDL_COLORSPACE_SRGB, but
1367 * you can change it to other colorspaces such as SDL_COLORSPACE_SCRGB for HDR
1368 * rendering.
1369 *
1370 * This does not affect the colorspace of textures, which is specified via
1371 * properties when the texture is created and does not change.
1372 *
1373 * \param renderer the rendering context
1374 * \param colorspace an SDL_ColorSpace value describing the colorspace for
1375 * drawing operations
1376 * \returns 0 on success or a negative error code on failure; call
1377 * SDL_GetError() for more information.
1378 *
1379 * \since This function is available since SDL 3.0.0.
1380 *
1381 * \sa SDL_GetRenderDrawColorspace
1382 */
1383extern DECLSPEC int SDLCALL SDL_SetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace colorspace);
1384
1385/**
1386 * Get the colorspace used for drawing operations
1387 *
1388 * \param renderer the rendering context
1389 * \param colorspace a pointer filled in with an SDL_ColorSpace value
1390 * describing the colorspace for drawing operations
1391 * \returns 0 on success or a negative error code on failure; call
1392 * SDL_GetError() for more information.
1393 *
1394 * \since This function is available since SDL 3.0.0.
1395 *
1396 * \sa SDL_SetRenderDrawColorspace
1397 */
1398extern DECLSPEC int SDLCALL SDL_GetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace *colorspace);
1399
1400
1401/**
1402 * Set the color used for drawing operations.
1403 *
1404 * Set the color for drawing or filling rectangles, lines, and points, and for
1405 * SDL_RenderClear().
1406 *
1407 * \param renderer the rendering context
1408 * \param r the red value used to draw on the rendering target
1409 * \param g the green value used to draw on the rendering target
1410 * \param b the blue value used to draw on the rendering target
1411 * \param a the alpha value used to draw on the rendering target; usually
1412 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1413 * specify how the alpha channel is used
1414 * \returns 0 on success or a negative error code on failure; call
1415 * SDL_GetError() for more information.
1416 *
1417 * \since This function is available since SDL 3.0.0.
1418 *
1419 * \sa SDL_GetRenderDrawColor
1420 * \sa SDL_RenderClear
1421 * \sa SDL_RenderFillRect
1422 * \sa SDL_RenderFillRects
1423 * \sa SDL_RenderLine
1424 * \sa SDL_RenderLines
1425 * \sa SDL_RenderPoint
1426 * \sa SDL_RenderPoints
1427 * \sa SDL_RenderRect
1428 * \sa SDL_RenderRects
1429 * \sa SDL_SetRenderDrawColorFloat
1430 */
1431extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1432
1433/**
1434 * Set the color used for drawing operations (Rect, Line and Clear).
1435 *
1436 * Set the color for drawing or filling rectangles, lines, and points, and for
1437 * SDL_RenderClear().
1438 *
1439 * \param renderer the rendering context
1440 * \param r the red value used to draw on the rendering target
1441 * \param g the green value used to draw on the rendering target
1442 * \param b the blue value used to draw on the rendering target
1443 * \param a the alpha value used to draw on the rendering target. Use
1444 * SDL_SetRenderDrawBlendMode to specify how the alpha channel is
1445 * used
1446 * \returns 0 on success or a negative error code on failure; call
1447 * SDL_GetError() for more information.
1448 *
1449 * \since This function is available since SDL 3.0.0.
1450 *
1451 * \sa SDL_GetRenderDrawColorFloat
1452 * \sa SDL_RenderClear
1453 * \sa SDL_RenderFillRect
1454 * \sa SDL_RenderFillRects
1455 * \sa SDL_RenderLine
1456 * \sa SDL_RenderLines
1457 * \sa SDL_RenderPoint
1458 * \sa SDL_RenderPoints
1459 * \sa SDL_RenderRect
1460 * \sa SDL_RenderRects
1461 * \sa SDL_SetRenderDrawColor
1462 */
1463extern DECLSPEC int SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a);
1464
1465/**
1466 * Get the color used for drawing operations (Rect, Line and Clear).
1467 *
1468 * \param renderer the rendering context
1469 * \param r a pointer filled in with the red value used to draw on the
1470 * rendering target
1471 * \param g a pointer filled in with the green value used to draw on the
1472 * rendering target
1473 * \param b a pointer filled in with the blue value used to draw on the
1474 * rendering target
1475 * \param a a pointer filled in with the alpha value used to draw on the
1476 * rendering target; usually `SDL_ALPHA_OPAQUE` (255)
1477 * \returns 0 on success or a negative error code on failure; call
1478 * SDL_GetError() for more information.
1479 *
1480 * \since This function is available since SDL 3.0.0.
1481 *
1482 * \sa SDL_GetRenderDrawColorFloat
1483 * \sa SDL_SetRenderDrawColor
1484 */
1485extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1486
1487/**
1488 * Get the color used for drawing operations (Rect, Line and Clear).
1489 *
1490 * \param renderer the rendering context
1491 * \param r a pointer filled in with the red value used to draw on the
1492 * rendering target
1493 * \param g a pointer filled in with the green value used to draw on the
1494 * rendering target
1495 * \param b a pointer filled in with the blue value used to draw on the
1496 * rendering target
1497 * \param a a pointer filled in with the alpha value used to draw on the
1498 * rendering target
1499 * \returns 0 on success or a negative error code on failure; call
1500 * SDL_GetError() for more information.
1501 *
1502 * \since This function is available since SDL 3.0.0.
1503 *
1504 * \sa SDL_SetRenderDrawColorFloat
1505 * \sa SDL_GetRenderDrawColor
1506 */
1507extern DECLSPEC int SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a);
1508
1509/**
1510 * Set the blend mode used for drawing operations (Fill and Line).
1511 *
1512 * If the blend mode is not supported, the closest supported mode is chosen.
1513 *
1514 * \param renderer the rendering context
1515 * \param blendMode the SDL_BlendMode to use for blending
1516 * \returns 0 on success or a negative error code on failure; call
1517 * SDL_GetError() for more information.
1518 *
1519 * \since This function is available since SDL 3.0.0.
1520 *
1521 * \sa SDL_GetRenderDrawBlendMode
1522 * \sa SDL_RenderLine
1523 * \sa SDL_RenderLines
1524 * \sa SDL_RenderPoint
1525 * \sa SDL_RenderPoints
1526 * \sa SDL_RenderRect
1527 * \sa SDL_RenderRects
1528 * \sa SDL_RenderFillRect
1529 * \sa SDL_RenderFillRects
1530 */
1531extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1532
1533/**
1534 * Get the blend mode used for drawing operations.
1535 *
1536 * \param renderer the rendering context
1537 * \param blendMode a pointer filled in with the current SDL_BlendMode
1538 * \returns 0 on success or a negative error code on failure; call
1539 * SDL_GetError() for more information.
1540 *
1541 * \since This function is available since SDL 3.0.0.
1542 *
1543 * \sa SDL_SetRenderDrawBlendMode
1544 */
1545extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1546
1547/**
1548 * Clear the current rendering target with the drawing color.
1549 *
1550 * This function clears the entire rendering target, ignoring the viewport and
1551 * the clip rectangle.
1552 *
1553 * \param renderer the rendering context
1554 * \returns 0 on success or a negative error code on failure; call
1555 * SDL_GetError() for more information.
1556 *
1557 * \since This function is available since SDL 3.0.0.
1558 *
1559 * \sa SDL_SetRenderDrawColor
1560 */
1561extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
1562
1563/**
1564 * Draw a point on the current rendering target at subpixel precision.
1565 *
1566 * \param renderer The renderer which should draw a point.
1567 * \param x The x coordinate of the point.
1568 * \param y The y coordinate of the point.
1569 * \returns 0 on success, or -1 on error
1570 *
1571 * \since This function is available since SDL 3.0.0.
1572 */
1573extern DECLSPEC int SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
1574
1575/**
1576 * Draw multiple points on the current rendering target at subpixel precision.
1577 *
1578 * \param renderer The renderer which should draw multiple points.
1579 * \param points The points to draw
1580 * \param count The number of points to draw
1581 * \returns 0 on success or a negative error code on failure; call
1582 * SDL_GetError() for more information.
1583 *
1584 * \since This function is available since SDL 3.0.0.
1585 */
1586extern DECLSPEC int SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1587
1588/**
1589 * Draw a line on the current rendering target at subpixel precision.
1590 *
1591 * \param renderer The renderer which should draw a line.
1592 * \param x1 The x coordinate of the start point.
1593 * \param y1 The y coordinate of the start point.
1594 * \param x2 The x coordinate of the end point.
1595 * \param y2 The y coordinate of the end point.
1596 * \returns 0 on success, or -1 on error
1597 *
1598 * \since This function is available since SDL 3.0.0.
1599 */
1600extern DECLSPEC int SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
1601
1602/**
1603 * Draw a series of connected lines on the current rendering target at
1604 * subpixel precision.
1605 *
1606 * \param renderer The renderer which should draw multiple lines.
1607 * \param points The points along the lines
1608 * \param count The number of points, drawing count-1 lines
1609 * \returns 0 on success or a negative error code on failure; call
1610 * SDL_GetError() for more information.
1611 *
1612 * \since This function is available since SDL 3.0.0.
1613 */
1614extern DECLSPEC int SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
1615
1616/**
1617 * Draw a rectangle on the current rendering target at subpixel precision.
1618 *
1619 * \param renderer The renderer which should draw a rectangle.
1620 * \param rect A pointer to the destination rectangle, or NULL to outline the
1621 * entire rendering target.
1622 * \returns 0 on success, or -1 on error
1623 *
1624 * \since This function is available since SDL 3.0.0.
1625 */
1626extern DECLSPEC int SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1627
1628/**
1629 * Draw some number of rectangles on the current rendering target at subpixel
1630 * precision.
1631 *
1632 * \param renderer The renderer which should draw multiple rectangles.
1633 * \param rects A pointer to an array of destination rectangles.
1634 * \param count The number of rectangles.
1635 * \returns 0 on success or a negative error code on failure; call
1636 * SDL_GetError() for more information.
1637 *
1638 * \since This function is available since SDL 3.0.0.
1639 */
1640extern DECLSPEC int SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1641
1642/**
1643 * Fill a rectangle on the current rendering target with the drawing color at
1644 * subpixel precision.
1645 *
1646 * \param renderer The renderer which should fill a rectangle.
1647 * \param rect A pointer to the destination rectangle, or NULL for the entire
1648 * rendering target.
1649 * \returns 0 on success, or -1 on error
1650 *
1651 * \since This function is available since SDL 3.0.0.
1652 */
1653extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
1654
1655/**
1656 * Fill some number of rectangles on the current rendering target with the
1657 * drawing color at subpixel precision.
1658 *
1659 * \param renderer The renderer which should fill multiple rectangles.
1660 * \param rects A pointer to an array of destination rectangles.
1661 * \param count The number of rectangles.
1662 * \returns 0 on success or a negative error code on failure; call
1663 * SDL_GetError() for more information.
1664 *
1665 * \since This function is available since SDL 3.0.0.
1666 */
1667extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
1668
1669/**
1670 * Copy a portion of the texture to the current rendering target at subpixel
1671 * precision.
1672 *
1673 * \param renderer The renderer which should copy parts of a texture.
1674 * \param texture The source texture.
1675 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1676 * texture.
1677 * \param dstrect A pointer to the destination rectangle, or NULL for the
1678 * entire rendering target.
1679 * \returns 0 on success, or -1 on error
1680 *
1681 * \since This function is available since SDL 3.0.0.
1682 */
1683extern DECLSPEC int SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
1684
1685/**
1686 * Copy a portion of the source texture to the current rendering target, with
1687 * rotation and flipping, at subpixel precision.
1688 *
1689 * \param renderer The renderer which should copy parts of a texture.
1690 * \param texture The source texture.
1691 * \param srcrect A pointer to the source rectangle, or NULL for the entire
1692 * texture.
1693 * \param dstrect A pointer to the destination rectangle, or NULL for the
1694 * entire rendering target.
1695 * \param angle An angle in degrees that indicates the rotation that will be
1696 * applied to dstrect, rotating it in a clockwise direction
1697 * \param center A pointer to a point indicating the point around which
1698 * dstrect will be rotated (if NULL, rotation will be done
1699 * around dstrect.w/2, dstrect.h/2).
1700 * \param flip An SDL_FlipMode value stating which flipping actions should be
1701 * performed on the texture
1702 * \returns 0 on success or a negative error code on failure; call
1703 * SDL_GetError() for more information.
1704 *
1705 * \since This function is available since SDL 3.0.0.
1706 */
1707extern DECLSPEC int SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
1708 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
1709 const double angle, const SDL_FPoint *center,
1710 const SDL_FlipMode flip);
1711
1712/**
1713 * Render a list of triangles, optionally using a texture and indices into the
1714 * vertex array Color and alpha modulation is done per vertex
1715 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1716 *
1717 * \param renderer The rendering context.
1718 * \param texture (optional) The SDL texture to use.
1719 * \param vertices Vertices.
1720 * \param num_vertices Number of vertices.
1721 * \param indices (optional) An array of integer indices into the 'vertices'
1722 * array, if NULL all vertices will be rendered in sequential
1723 * order.
1724 * \param num_indices Number of indices.
1725 * \returns 0 on success, or -1 if the operation is not supported
1726 *
1727 * \since This function is available since SDL 3.0.0.
1728 *
1729 * \sa SDL_RenderGeometryRaw
1730 * \sa SDL_Vertex
1731 */
1732extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
1733 SDL_Texture *texture,
1734 const SDL_Vertex *vertices, int num_vertices,
1735 const int *indices, int num_indices);
1736
1737/**
1738 * Render a list of triangles, optionally using a texture and indices into the
1739 * vertex arrays Color and alpha modulation is done per vertex
1740 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
1741 *
1742 * \param renderer The rendering context.
1743 * \param texture (optional) The SDL texture to use.
1744 * \param xy Vertex positions
1745 * \param xy_stride Byte size to move from one element to the next element
1746 * \param color Vertex colors (as SDL_FColor)
1747 * \param color_stride Byte size to move from one element to the next element
1748 * \param uv Vertex normalized texture coordinates
1749 * \param uv_stride Byte size to move from one element to the next element
1750 * \param num_vertices Number of vertices.
1751 * \param indices (optional) An array of indices into the 'vertices' arrays,
1752 * if NULL all vertices will be rendered in sequential order.
1753 * \param num_indices Number of indices.
1754 * \param size_indices Index size: 1 (byte), 2 (short), 4 (int)
1755 * \returns 0 on success or a negative error code on failure; call
1756 * SDL_GetError() for more information.
1757 *
1758 * \since This function is available since SDL 3.0.0.
1759 *
1760 * \sa SDL_RenderGeometry
1761 * \sa SDL_Vertex
1762 */
1763extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
1764 SDL_Texture *texture,
1765 const float *xy, int xy_stride,
1766 const SDL_FColor *color, int color_stride,
1767 const float *uv, int uv_stride,
1768 int num_vertices,
1769 const void *indices, int num_indices, int size_indices);
1770
1771/**
1772 * Read pixels from the current rendering target to an array of pixels.
1773 *
1774 * **WARNING**: This is a very slow operation, and should not be used
1775 * frequently. If you're using this on the main rendering target, it should be
1776 * called after rendering and before SDL_RenderPresent().
1777 *
1778 * `pitch` specifies the number of bytes between rows in the destination
1779 * `pixels` data. This allows you to write to a subrectangle or have padded
1780 * rows in the destination. Generally, `pitch` should equal the number of
1781 * pixels per row in the `pixels` data times the number of bytes per pixel,
1782 * but it might contain additional padding (for example, 24bit RGB Windows
1783 * Bitmap data pads all rows to multiples of 4 bytes).
1784 *
1785 * \param renderer the rendering context
1786 * \param rect an SDL_Rect structure representing the area in pixels relative
1787 * to the to current viewport, or NULL for the entire viewport
1788 * \param format an SDL_PixelFormatEnum value of the desired format of the
1789 * pixel data, or 0 to use the format of the rendering target
1790 * \param pixels a pointer to the pixel data to copy into
1791 * \param pitch the pitch of the `pixels` parameter
1792 * \returns 0 on success or a negative error code on failure; call
1793 * SDL_GetError() for more information.
1794 *
1795 * \since This function is available since SDL 3.0.0.
1796 */
1797extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
1798 const SDL_Rect *rect,
1799 Uint32 format,
1800 void *pixels, int pitch);
1801
1802/**
1803 * Update the screen with any rendering performed since the previous call.
1804 *
1805 * SDL's rendering functions operate on a backbuffer; that is, calling a
1806 * rendering function such as SDL_RenderLine() does not directly put a line on
1807 * the screen, but rather updates the backbuffer. As such, you compose your
1808 * entire scene and *present* the composed backbuffer to the screen as a
1809 * complete picture.
1810 *
1811 * Therefore, when using SDL's rendering API, one does all drawing intended
1812 * for the frame, and then calls this function once per frame to present the
1813 * final drawing to the user.
1814 *
1815 * The backbuffer should be considered invalidated after each present; do not
1816 * assume that previous contents will exist between frames. You are strongly
1817 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
1818 * starting each new frame's drawing, even if you plan to overwrite every
1819 * pixel.
1820 *
1821 * \param renderer the rendering context
1822 * \returns 0 on success or a negative error code on failure; call
1823 * SDL_GetError() for more information.
1824 *
1825 * \threadsafety You may only call this function on the main thread.
1826 *
1827 * \since This function is available since SDL 3.0.0.
1828 *
1829 * \sa SDL_RenderClear
1830 * \sa SDL_RenderLine
1831 * \sa SDL_RenderLines
1832 * \sa SDL_RenderPoint
1833 * \sa SDL_RenderPoints
1834 * \sa SDL_RenderRect
1835 * \sa SDL_RenderRects
1836 * \sa SDL_RenderFillRect
1837 * \sa SDL_RenderFillRects
1838 * \sa SDL_SetRenderDrawBlendMode
1839 * \sa SDL_SetRenderDrawColor
1840 */
1841extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
1842
1843/**
1844 * Destroy the specified texture.
1845 *
1846 * Passing NULL or an otherwise invalid texture will set the SDL error message
1847 * to "Invalid texture".
1848 *
1849 * \param texture the texture to destroy
1850 *
1851 * \since This function is available since SDL 3.0.0.
1852 *
1853 * \sa SDL_CreateTexture
1854 * \sa SDL_CreateTextureFromSurface
1855 */
1856extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
1857
1858/**
1859 * Destroy the rendering context for a window and free associated textures.
1860 *
1861 * If `renderer` is NULL, this function will return immediately after setting
1862 * the SDL error message to "Invalid renderer". See SDL_GetError().
1863 *
1864 * \param renderer the rendering context
1865 *
1866 * \since This function is available since SDL 3.0.0.
1867 *
1868 * \sa SDL_CreateRenderer
1869 */
1870extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
1871
1872/**
1873 * Force the rendering context to flush any pending commands and state.
1874 *
1875 * You do not need to (and in fact, shouldn't) call this function unless you
1876 * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
1877 * addition to using an SDL_Renderer.
1878 *
1879 * This is for a very-specific case: if you are using SDL's render API, and
1880 * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
1881 * calls. If this applies, you should call this function between calls to
1882 * SDL's render API and the low-level API you're using in cooperation.
1883 *
1884 * In all other cases, you can ignore this function.
1885 *
1886 * This call makes SDL flush any pending rendering work it was queueing up to
1887 * do later in a single batch, and marks any internal cached state as invalid,
1888 * so it'll prepare all its state again later, from scratch.
1889 *
1890 * This means you do not need to save state in your rendering code to protect
1891 * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
1892 * OpenGL state that can confuse things; you should use your best judgement
1893 * and be prepared to make changes if specific state needs to be protected.
1894 *
1895 * \param renderer the rendering context
1896 * \returns 0 on success or a negative error code on failure; call
1897 * SDL_GetError() for more information.
1898 *
1899 * \since This function is available since SDL 3.0.0.
1900 */
1901extern DECLSPEC int SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
1902
1903/**
1904 * Get the CAMetalLayer associated with the given Metal renderer.
1905 *
1906 * This function returns `void *`, so SDL doesn't have to include Metal's
1907 * headers, but it can be safely cast to a `CAMetalLayer *`.
1908 *
1909 * \param renderer The renderer to query
1910 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
1911 * Metal renderer
1912 *
1913 * \since This function is available since SDL 3.0.0.
1914 *
1915 * \sa SDL_GetRenderMetalCommandEncoder
1916 */
1917extern DECLSPEC void *SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
1918
1919/**
1920 * Get the Metal command encoder for the current frame
1921 *
1922 * This function returns `void *`, so SDL doesn't have to include Metal's
1923 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
1924 *
1925 * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give
1926 * SDL a drawable to render to, which might happen if the window is
1927 * hidden/minimized/offscreen. This doesn't apply to command encoders for
1928 * render targets, just the window's backbuffer. Check your return values!
1929 *
1930 * \param renderer The renderer to query
1931 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
1932 * renderer isn't a Metal renderer or there was an error.
1933 *
1934 * \since This function is available since SDL 3.0.0.
1935 *
1936 * \sa SDL_GetRenderMetalLayer
1937 */
1938extern DECLSPEC void *SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
1939
1940/**
1941 * Toggle VSync of the given renderer.
1942 *
1943 * \param renderer The renderer to toggle
1944 * \param vsync 1 for on, 0 for off. All other values are reserved
1945 * \returns 0 on success or a negative error code on failure; call
1946 * SDL_GetError() for more information.
1947 *
1948 * \since This function is available since SDL 3.0.0.
1949 */
1950extern DECLSPEC int SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
1951
1952/**
1953 * Get VSync of the given renderer.
1954 *
1955 * \param renderer The renderer to toggle
1956 * \param vsync an int filled with 1 for on, 0 for off. All other values are
1957 * reserved
1958 * \returns 0 on success or a negative error code on failure; call
1959 * SDL_GetError() for more information.
1960 *
1961 * \since This function is available since SDL 3.0.0.
1962 */
1963extern DECLSPEC int SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
1964
1965/* Ends C function definitions when using C++ */
1966#ifdef __cplusplus
1967}
1968#endif
1969#include <SDL3/SDL_close_code.h>
1970
1971#endif /* SDL_render_h_ */
SDL_BlendMode
SDL_Colorspace
Definition SDL_pixels.h:559
Uint32 SDL_PropertiesID
int 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)
void SDL_DestroyTexture(SDL_Texture *texture)
int SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
int SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode)
int SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
struct SDL_Texture SDL_Texture
Definition SDL_render.h:130
int SDL_RenderClear(SDL_Renderer *renderer)
int SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
int SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_Window * SDL_GetRenderWindow(SDL_Renderer *renderer)
int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_FlipMode flip)
int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
int SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
int SDL_FlushRenderer(SDL_Renderer *renderer)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
void SDL_UnlockTexture(SDL_Texture *texture)
int SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b)
int SDL_GetNumRenderDrivers(void)
int SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_RendererFlags
Definition SDL_render.h:67
@ SDL_RENDERER_SOFTWARE
Definition SDL_render.h:68
@ SDL_RENDERER_ACCELERATED
Definition SDL_render.h:69
@ SDL_RENDERER_PRESENTVSYNC
Definition SDL_render.h:71
int SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a)
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props)
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
int SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
int SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
SDL_Renderer * SDL_GetRendererFromTexture(SDL_Texture *texture)
SDL_TextureAccess
Definition SDL_render.h:102
@ SDL_TEXTUREACCESS_STATIC
Definition SDL_render.h:103
@ SDL_TEXTUREACCESS_STREAMING
Definition SDL_render.h:104
@ SDL_TEXTUREACCESS_TARGET
Definition SDL_render.h:105
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
int SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
SDL_bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
int SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
int SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
SDL_RendererLogicalPresentation
Definition SDL_render.h:112
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition SDL_render.h:115
@ SDL_LOGICAL_PRESENTATION_DISABLED
Definition SDL_render.h:113
@ SDL_LOGICAL_PRESENTATION_OVERSCAN
Definition SDL_render.h:116
@ SDL_LOGICAL_PRESENTATION_STRETCH
Definition SDL_render.h:114
@ SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
Definition SDL_render.h:117
int SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a)
int SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha)
int SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
int SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
const char * SDL_GetRenderDriver(int index)
void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer)
int SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b)
int SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
struct SDL_Renderer SDL_Renderer
Definition SDL_render.h:124
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags)
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode)
int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
int SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha)
int SDL_SetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace colorspace)
int SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
int SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
int SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int SDL_GetRenderDrawColorspace(SDL_Renderer *renderer, SDL_Colorspace *colorspace)
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_RenderPresent(SDL_Renderer *renderer)
uint8_t Uint8
Definition SDL_stdinc.h:150
int SDL_bool
Definition SDL_stdinc.h:137
uint32_t Uint32
Definition SDL_stdinc.h:174
SDL_ScaleMode
Definition SDL_surface.h:72
SDL_FlipMode
Definition SDL_surface.h:82
struct SDL_Window SDL_Window
Definition SDL_video.h:137
const char * name
Definition SDL_render.h:80
Uint32 texture_formats[16]
Definition SDL_render.h:83
Uint32 num_texture_formats
Definition SDL_render.h:82
SDL_FPoint tex_coord
Definition SDL_render.h:95
SDL_FPoint position
Definition SDL_render.h:93
SDL_FColor color
Definition SDL_render.h:94