Module render
Available on crate feature
dep_sdl3
only.Expand description
2D accelerated rendering
Official C documentation: https://wiki.libsdl.org/CategoryRender
§Introduction
This module contains functions for 2D accelerated rendering.
This API supports the following features:
- single pixel points
- single pixel lines
- filled rectangles
- texture images
- All of these may be drawn in opaque, blended, or additive modes.
The texture images can have an additional color tint or alpha modulation applied to them, and may also be stretched with linear interpolation, rotated or flipped/mirrored.
For advanced functionality like particle effects or actual 3D you should use SDL’s OpenGL/Direct3D support or one of the many available 3D engines.
This API is not designed to be used from multiple threads, see this bug for details.
None of the draw methods in Canvas
are expected to fail.
If they do, a panic is raised and the program is aborted.
Structs§
- Canvas
- Manages and owns a target (
Surface
orWindow
) and allows drawing in it. - Driver
Iterator - FPoint
- FRect
- Invalid
Texture Access - Renderer
Context - Manages what keeps a
SDL_Renderer
alive - Renderer
Info - A structure that contains information on the capabilities of a render driver or the current render context.
- Texture
- A texture for a rendering context.
- Texture
Creator - Creates Textures that cannot outlive the creator
- Texture
Query
Enums§
- Blend
Mode - Blend mode for
Canvas
,Texture
orSurface
. - Clipping
Rect - Scale
Mode - Target
Render Error - Possible errors returned by targeting a
Canvas
to render to aTexture
- Texture
Access - Texture
Value Error - Update
Texture Error - Update
TextureYUV Error
Traits§
- Render
Target - Represents structs which can be the target of a
SDL_Renderer
(or Canvas).
Functions§
- create_
renderer - Create a new renderer for a window.
- drivers
- Gets an iterator of all render drivers compiled into the SDL2 library.
Type Aliases§
- Surface
Canvas - Alias for a
Canvas
that was created out of aSurface
- Window
Canvas