Class Renderer<TDriver>
Represents a rendering context (renderer)
public sealed class Renderer<TDriver> : Renderer, IDisposable where TDriver : notnull, IRenderingDriver
Type Parameters
TDriverThe rendering driver type associated with this renderer
- Inheritance
-
Renderer<TDriver>
- Implements
- Inherited Members
Remarks
This is used to perform driver-specific 2D rendering operations, most commonly to a Window or an off-screen render target.
You can create new renderers for a Window using the TryCreateRenderer<TDriver>(out Renderer<TDriver>?) or TryCreateRenderer<TDriver>(out Renderer<TDriver>?, ColorSpace?, RendererVSync?, Properties?) instance methods on a Window instance.
Additionally, there are some driver-specific methods for creating renderers, such as TryCreateRenderer(out Renderer<Gpu>?, GpuDevice?), TryCreateRenderer(out Renderer<Gpu>?, ColorSpace?, RendererVSync?, GpuDevice?, bool?, bool?, bool?, Properties?), TryCreateRenderer(out Renderer<Vulkan>?, ColorSpace?, RendererVSync?, nint?, ulong?, nint?, nint?, uint?, uint?, Properties?), TryCreateRenderer(out Renderer<Software>?), TryCreateRenderer(out Renderer<Software>?, ColorSpace?, Properties?), and TryCreate(out Renderer<Gpu>, GpuDevice, Window).
If you create textures using an Renderer<TDriver>, please remember to dispose them before disposing the renderer. Do not dispose the associated Window before disposing the Renderer<TDriver> either! Using an Renderer<TDriver> after its associated Window has been disposed can cause undefined behavior, including crashes.
For the most part Renderer<TDriver>s are not thread-safe, and most of their properties and methods should only be accessed from the main thread!
Renderer<TDriver>s are concrete renderer types, associate with a specific rendering driver. They are used for driver-specific rendering operations with Texture<TDriver>s that were created by them.
If you want to use them in a more general way, you can use them as Renderer instances, which serve as abstractions to use them for common rendering operations with Texture instance that were created by them.
Properties
Target
Gets the current render target
public Texture<TDriver>? Target { get; set; }
Property Value
Remarks
If the value of this property is null, then the default render target is active.
The default render target is the Window associated with the renderer, the Surface associated with a software renderer, or the off-screen target associated with a GPU renderer.
You can reset the current render target to the default render target by either setting this property to null, or by using the ResetTarget() method.
Only textures created with this renderer can be used as render targets, and only if they were created with the Target access mode.
This property should only be accessed from the main thread.
Exceptions
- ObjectDisposedException
When setting this property, the specified texture was already disposed
- SdlException
When setting this property, the specified texture is not a valid render target (e.g. it wasn't created with the Target access mode, or it wasn't created with this renderer) (check TryGet(out string?) for more information)
- OR - When setting this property, SDL failed with an error (check TryGet(out string?) for more information). A common reason for this to happen is when the Window associated with this renderer was already disposed, but the renderer itself wasn't disposed yet.
Methods
TryCreateTexture(PixelFormat, TextureAccess, int, int, out Texture<TDriver>?)
Tries to create a new texture for the renderer
public bool TryCreateTexture(PixelFormat format, TextureAccess access, int width, int height, out Texture<TDriver>? texture)
Parameters
formatPixelFormatThe pixel format of the texture. Should be one of the supported texture formats returned by the SupportedTextureFormats property.
accessTextureAccessThe intended access pattern of the texture. Should be one of the pre-defined TextureAccess values.
widthintThe width of the texture in pixels
heightintThe height of the texture in pixels
textureTexture<TDriver>The resulting texture, if this method returns
true; otherwise,null
Returns
- bool
true, if the texture was created successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The contents of a newly created texture are undefined.
This method should only be called from the main thread.
TryCreateTexture(out Texture<TDriver>?, ColorSpace?, PixelFormat?, TextureAccess?, int?, int?, Palette?, float?, float?, Properties?)
Tries to create a new texture for the renderer
public bool TryCreateTexture(out Texture<TDriver>? texture, ColorSpace? colorSpace = null, PixelFormat? format = null, TextureAccess? access = null, int? width = null, int? height = null, Palette? palette = null, float? sdrWhitePoint = null, float? hdrHeadroom = null, Properties? properties = null)
Parameters
textureTexture<TDriver>The resulting texture, if this method returns
true; otherwise,nullcolorSpaceColorSpace?The color space of the texture. If not specified, defaults to SrgbLinear for floating point textures, Hdr10 for 10-bit textures, Srgb for other RGB textures, and Jpeg for YUV textures, or whatever the provided
propertiesspecify.formatPixelFormat?The pixel format of the texture. Should be one of the supported texture formats returned by the SupportedTextureFormats property. If not specified, defaults to the best RGBA format available for the renderer, or whatever the provided
propertiesspecify.accessTextureAccess?The intended access pattern of the texture. Should be one of the pre-defined TextureAccess values. If not specified, defaults to Static, or whatever the provided
propertiesspecify.widthint?The width of the texture in pixels. Required if the provided
propertiesdon't specify a width.heightint?The height of the texture in pixels. Required if the provided
propertiesdon't specify a height.palettePaletteThe palette to use when creating a texture with a palettized pixel format
sdrWhitePointfloat?The defining value for 100% diffuse white for HDR10 and floating point textures. Defaults to
100for HDR10 textures and1.0for floating point textures, or whatever the providedpropertiesspecify.hdrHeadroomfloat?The maximum dynamic range for HDR10 and floating point textures in terms of the
sdrWhitePointpropertiesPropertiesAdditional properties to use when creating the texture
Returns
- bool
true, if the texture was created successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The contents of a newly created texture are undefined.
This method should only be called from the main thread.
TryCreateTextureFromSurface(Surface, out Texture<TDriver>?)
Tries to create a texture from an exisiting Surface
public bool TryCreateTextureFromSurface(Surface surface, out Texture<TDriver>? texture)
Parameters
surfaceSurfaceThe Surface to copy and create the texture from
textureTexture<TDriver>The resulting texture, if this method returns
true; otherwise,null
Returns
- bool
true, if the texture was created successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The given surface's pixel data is copied into the texture and the surface is not modified in any way.
This means that the given surface can be safely disposed of after this method returns, without affecting the resulting texture.
The pixel format of the resulting texture my be different from the pixel format of the given surface.
The actual pixel format of the resulting texture can later be checked using the Format property.
The TextureAccess of the resulting texture will be Static.
This method should only be called from the main thread.
TryRenderGeometry(ReadOnlySpan<Vertex>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of vertices to the current target, optionally using a texture
public bool TryRenderGeometry(ReadOnlySpan<Vertex> vertices, Texture<TDriver>? texture = null)
Parameters
verticesReadOnlySpan<Vertex>The list of vertices to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometry(ReadOnlySpan<Vertex>, ReadOnlySpan<int>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of indices into a list of vertices to the current target, optionally using a texture
public bool TryRenderGeometry(ReadOnlySpan<Vertex> vertices, ReadOnlySpan<int> indices, Texture<TDriver>? texture = null)
Parameters
verticesReadOnlySpan<Vertex>The vertices to use
indicesReadOnlySpan<int>The list of indices into the vertex list to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the given vertices list.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlyNativeMemory<float>, int, ReadOnlyNativeMemory<Color<float>>, int, ReadOnlyNativeMemory<float>, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlyNativeMemory<float> xy, int xyStride, ReadOnlyNativeMemory<Color<float>> colors, int colorStride, ReadOnlyNativeMemory<float> uv, int uvStride, Texture<TDriver>? texture = null)
Parameters
xyReadOnlyNativeMemory<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlyNativeMemory<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlyNativeMemory<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlyNativeMemory<float>, int, ReadOnlyNativeMemory<Color<float>>, int, ReadOnlyNativeMemory<float>, int, ReadOnlySpan<short>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of short indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlyNativeMemory<float> xy, int xyStride, ReadOnlyNativeMemory<Color<float>> colors, int colorStride, ReadOnlyNativeMemory<float> uv, int uvStride, ReadOnlySpan<short> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlyNativeMemory<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlyNativeMemory<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlyNativeMemory<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<short>The list of short indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlyNativeMemory<float>, int, ReadOnlyNativeMemory<Color<float>>, int, ReadOnlyNativeMemory<float>, int, ReadOnlySpan<int>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of int indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlyNativeMemory<float> xy, int xyStride, ReadOnlyNativeMemory<Color<float>> colors, int colorStride, ReadOnlyNativeMemory<float> uv, int uvStride, ReadOnlySpan<int> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlyNativeMemory<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlyNativeMemory<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlyNativeMemory<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<int>The list of int indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlyNativeMemory<float>, int, ReadOnlyNativeMemory<Color<float>>, int, ReadOnlyNativeMemory<float>, int, ReadOnlySpan<sbyte>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of sbyte indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlyNativeMemory<float> xy, int xyStride, ReadOnlyNativeMemory<Color<float>> colors, int colorStride, ReadOnlyNativeMemory<float> uv, int uvStride, ReadOnlySpan<sbyte> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlyNativeMemory<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlyNativeMemory<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlyNativeMemory<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<sbyte>The list of sbyte indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlySpan<float>, int, ReadOnlySpan<Color<float>>, int, ReadOnlySpan<float>, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlySpan<float> xy, int xyStride, ReadOnlySpan<Color<float>> colors, int colorStride, ReadOnlySpan<float> uv, int uvStride, Texture<TDriver>? texture = null)
Parameters
xyReadOnlySpan<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlySpan<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlySpan<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlySpan<float>, int, ReadOnlySpan<Color<float>>, int, ReadOnlySpan<float>, int, ReadOnlySpan<short>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of short indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlySpan<float> xy, int xyStride, ReadOnlySpan<Color<float>> colors, int colorStride, ReadOnlySpan<float> uv, int uvStride, ReadOnlySpan<short> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlySpan<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlySpan<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlySpan<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<short>The list of short indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlySpan<float>, int, ReadOnlySpan<Color<float>>, int, ReadOnlySpan<float>, int, ReadOnlySpan<int>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of int indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlySpan<float> xy, int xyStride, ReadOnlySpan<Color<float>> colors, int colorStride, ReadOnlySpan<float> uv, int uvStride, ReadOnlySpan<int> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlySpan<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlySpan<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlySpan<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<int>The list of int indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(ReadOnlySpan<float>, int, ReadOnlySpan<Color<float>>, int, ReadOnlySpan<float>, int, ReadOnlySpan<sbyte>, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of sbyte indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(ReadOnlySpan<float> xy, int xyStride, ReadOnlySpan<Color<float>> colors, int colorStride, ReadOnlySpan<float> uv, int uvStride, ReadOnlySpan<sbyte> indices, Texture<TDriver>? texture = null)
Parameters
xyReadOnlySpan<float>The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex
xyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsReadOnlySpan<Color<float>>The list of vertex colors
colorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvReadOnlySpan<float>The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex
uvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).indicesReadOnlySpan<sbyte>The list of sbyte indices into the various vertex attribute lists to specify the triangles to draw
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The number of vertices specified by the various vertex attribute lists is determined by their byte lengths and strides, always selecting the smallest resulting vertex count among them.
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the calculated vertex count from the given vertex attribute lists.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(float*, int, Color<float>*, int, float*, int, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(float* xy, int xyStride, Color<float>* colors, int colorStride, float* uv, int uvStride, int verticesCount, Texture<TDriver>? texture = null)
Parameters
xyfloat*A pointer to a contiguous array of vertex positions, first the X coordinate and then the Y coordinate for each vertex. Must be dereferenceable for at least
bytes.verticesCount*xyStridexyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsColor<float>*A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least
bytes.verticesCount*colorStridecolorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvfloat*A pointer to a contiguous array of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex. Must be dereferenceable for at least
bytes.verticesCount*uvStrideuvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).verticesCountintThe number of vertices
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(float*, int, Color<float>*, int, float*, int, int, short*, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of short indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(float* xy, int xyStride, Color<float>* colors, int colorStride, float* uv, int uvStride, int verticesCount, short* indices, int indicesCount, Texture<TDriver>? texture = null)
Parameters
xyfloat*A pointer to a contiguous array of vertex positions, first the X coordinate and then the Y coordinate for each vertex. Must be dereferenceable for at least
bytes.verticesCount*xyStridexyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsColor<float>*A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least
bytes.verticesCount*colorStridecolorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvfloat*A pointer to a contiguous array of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex. Must be dereferenceable for at least
bytes.verticesCount*uvStrideuvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).verticesCountintThe number of vertices
indicesshort*A pointer to a contiguous array of short indices into the various vertex attribute lists to specify the triangles to draw. Must be dereferenceable for at least
bytes.indicesCount* sizeof(short)indicesCountintThe number of short indices
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the given verticesCount.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(float*, int, Color<float>*, int, float*, int, int, int*, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of int indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(float* xy, int xyStride, Color<float>* colors, int colorStride, float* uv, int uvStride, int verticesCount, int* indices, int indicesCount, Texture<TDriver>? texture = null)
Parameters
xyfloat*A pointer to a contiguous array of vertex positions, first the X coordinate and then the Y coordinate for each vertex. Must be dereferenceable for at least
bytes.verticesCount*xyStridexyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsColor<float>*A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least
bytes.verticesCount*colorStridecolorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvfloat*A pointer to a contiguous array of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex. Must be dereferenceable for at least
bytes.verticesCount*uvStrideuvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).verticesCountintThe number of vertices
indicesint*A pointer to a contiguous array of int indices into the various vertex attribute lists to specify the triangles to draw. Must be dereferenceable for at least
bytes.indicesCount* sizeof(int)indicesCountintThe number of int indices
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the given verticesCount.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderGeometryRaw(float*, int, Color<float>*, int, float*, int, int, sbyte*, int, Texture<TDriver>?)
Tries to draw a list of triangles specified by a list of sbyte indices into separate lists of vertex attributes to the current target, optionally using a texture
public bool TryRenderGeometryRaw(float* xy, int xyStride, Color<float>* colors, int colorStride, float* uv, int uvStride, int verticesCount, sbyte* indices, int indicesCount, Texture<TDriver>? texture = null)
Parameters
xyfloat*A pointer to a contiguous array of vertex positions, first the X coordinate and then the Y coordinate for each vertex. Must be dereferenceable for at least
bytes.verticesCount*xyStridexyStrideintThe length, in bytes, to move from one element in the
xylist to the next. Usually that's2 * sizeof(float).colorsColor<float>*A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least
bytes.verticesCount*colorStridecolorStrideintThe length, in bytes, to move from one element in the
colorslist to the next. Usually that'ssizeof(Color<float>).uvfloat*A pointer to a contiguous array of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex. Must be dereferenceable for at least
bytes.verticesCount*uvStrideuvStrideintThe length, in bytes, to move from one element in the
uvlist to the next. Usually that's2 * sizeof(float).verticesCountintThe number of vertices
indicessbyte*A pointer to a contiguous array of sbyte indices into the various vertex attribute lists to specify the triangles to draw. Must be dereferenceable for at least
bytes.indicesCount* sizeof(sbyte)indicesCountintThe number of sbyte indices
textureTexture<TDriver>An optional texture to use when drawing the triangles
Returns
- bool
trueif the geometry was drawn successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
There are no surface-level checks for the validity of the given indices, so you must make sure they are all within the bounds of the given verticesCount.
Only textures created with this renderer can be rendered with this method.
Color and alpha modulation is done per vertex, so ColorMod (or ColorModFloat) and AlphaMod (or AlphaModFloat) are ignored.
This method should only be called from the main thread.
TryRenderTexture(in Rect<float>, Texture<TDriver>)
Tries to copy the entirety of a texture to an area of the current target
public bool TryRenderTexture(in Rect<float> destinationRect, Texture<TDriver> texture)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture(in Rect<float>, Texture<TDriver>, in Rect<float>)
Tries to copy a portion of a texture to an area of the current target
public bool TryRenderTexture(in Rect<float> destinationRect, Texture<TDriver> texture, in Rect<float> sourceRect)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture(Texture<TDriver>)
Tries to copy the entirety of a texture to entirety of the current target
public bool TryRenderTexture(Texture<TDriver> texture)
Parameters
textureTexture<TDriver>The texture to copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture(Texture<TDriver>, in Rect<float>)
Tries to copy a portion of a texture to entirety of the current target
public bool TryRenderTexture(Texture<TDriver> texture, in Rect<float> sourceRect)
Parameters
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9Grid(in Rect<float>, Texture<TDriver>, in Rect<float>, float, float, float, float, float)
Tries to scalingly copy a portion of a texture to an area of the current target using the 9-grid algorithm
public bool TryRenderTexture9Grid(in Rect<float> destinationRect, Texture<TDriver> texture, in Rect<float> sourceRect, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to, in a 9-grid manner
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy, in a 9-grid manner
leftWidthfloatThe width, in pixels, of the left corners in
sourceRectrightWidthfloatThe width, in pixels, of the right corners in
sourceRecttopHeightfloatThe height, in pixels, of the top corners in
sourceRectbottomHeightfloatThe height, in pixels, of the bottom corners in
sourceRectscalefloatThe scale to use to transform the corners of
sourceRectinto the corners ofdestinationRect, or0for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the destinationRect.
The sides and center are then stretched into place to cover the remaining portion of the destinationRect.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9Grid(in Rect<float>, Texture<TDriver>, float, float, float, float, float)
Tries to scalingly copy the entirety of a texture to an area of the current target using the 9-grid algorithm
public bool TryRenderTexture9Grid(in Rect<float> destinationRect, Texture<TDriver> texture, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to, in a 9-grid manner
textureTexture<TDriver>The texture to copy
leftWidthfloatThe width, in pixels, of the left corners of the
texturerightWidthfloatThe width, in pixels, of the right corners of the
texturetopHeightfloatThe height, in pixels, of the top corners of the
texturebottomHeightfloatThe height, in pixels, of the bottom corners of the
texturescalefloatThe scale to use to transform the corners of the
textureinto the corners ofdestinationRect, or0for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the destinationRect.
The sides and center are then stretched into place to cover the remaining portion of the destinationRect.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9Grid(Texture<TDriver>, in Rect<float>, float, float, float, float, float)
Tries to scalingly copy a portion of a texture to the entirety of the current target using the 9-grid algorithm
public bool TryRenderTexture9Grid(Texture<TDriver> texture, in Rect<float> sourceRect, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale)
Parameters
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy, in a 9-grid manner
leftWidthfloatThe width, in pixels, of the left corners in
sourceRectrightWidthfloatThe width, in pixels, of the right corners in
sourceRecttopHeightfloatThe height, in pixels, of the top corners in
sourceRectbottomHeightfloatThe height, in pixels, of the bottom corners in
sourceRectscalefloatThe scale to use to transform the corners of
sourceRectinto the corners of the current target, or0for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the current target.
The sides and center are then stretched into place to cover the remaining portion of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9Grid(Texture<TDriver>, float, float, float, float, float)
Tries to scalingly copy a portion of a texture to the entirety of the current target using the 9-grid algorithm
public bool TryRenderTexture9Grid(Texture<TDriver> texture, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale)
Parameters
textureTexture<TDriver>The texture to copy
leftWidthfloatThe width, in pixels, of the left corners of the
texturerightWidthfloatThe width, in pixels, of the right corners of the
texturetopHeightfloatThe height, in pixels, of the top corners of the
texturebottomHeightfloatThe height, in pixels, of the bottom corners of the
texturescalefloatThe scale to use to transform the corners of the
textureinto the corners of the current target, or0for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the current target.
The sides and center are then stretched into place to cover the remaining portion of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9GridTiled(in Rect<float>, Texture<TDriver>, in Rect<float>, float, float, float, float, float, float)
Tries to scalingly copy a portion of a texture to an area of the current target using the 9-grid algorithm with tiling for the borders and the center
public bool TryRenderTexture9GridTiled(in Rect<float> destinationRect, Texture<TDriver> texture, in Rect<float> sourceRect, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale, float tileScale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to, in a 9-grid manner
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy, in a 9-grid manner
leftWidthfloatThe width, in pixels, of the left corners in
sourceRectrightWidthfloatThe width, in pixels, of the right corners in
sourceRecttopHeightfloatThe height, in pixels, of the top corners in
sourceRectbottomHeightfloatThe height, in pixels, of the bottom corners in
sourceRectscalefloatThe scale to use to transform the corners of
sourceRectinto the corners ofdestinationRect, or0for an unscaled copytileScalefloatThe scale to use to transform the borders and the center of
sourceRectinto the border and the center ofdestinationRect, or1for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the destinationRect.
The sides and center are then tiled into place to cover the remaining portion of the destinationRect.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9GridTiled(in Rect<float>, Texture<TDriver>, float, float, float, float, float, float)
Tries to scalingly copy the entirety of a texture to an area of the current target using the 9-grid algorithm with tiling for the borders and the center
public bool TryRenderTexture9GridTiled(in Rect<float> destinationRect, Texture<TDriver> texture, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale, float tileScale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to, in a 9-grid manner
textureTexture<TDriver>The texture to copy
leftWidthfloatThe width, in pixels, of the left corners of the
texturerightWidthfloatThe width, in pixels, of the right corners of the
texturetopHeightfloatThe height, in pixels, of the top corners of the
texturebottomHeightfloatThe height, in pixels, of the bottom corners of the
texturescalefloatThe scale to use to transform the corners of the
textureinto the corners ofdestinationRect, or0for an unscaled copytileScalefloatThe scale to use to transform the borders and the center of the
textureinto the border and the center ofdestinationRect, or1for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the destinationRect.
The sides and center are then tiled into place to cover the remaining portion of the destinationRect.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9GridTiled(Texture<TDriver>, in Rect<float>, float, float, float, float, float, float)
Tries to scalingly copy a portion of a texture to the entirety of the current target using the 9-grid algorithm with tiling for the borders and the center
public bool TryRenderTexture9GridTiled(Texture<TDriver> texture, in Rect<float> sourceRect, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale, float tileScale)
Parameters
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy, in a 9-grid manner
leftWidthfloatThe width, in pixels, of the left corners in
sourceRectrightWidthfloatThe width, in pixels, of the right corners in
sourceRecttopHeightfloatThe height, in pixels, of the top corners in
sourceRectbottomHeightfloatThe height, in pixels, of the bottom corners in
sourceRectscalefloatThe scale to use to transform the corners of
sourceRectinto the corners of the current target, or0for an unscaled copytileScalefloatThe scale to use to transform the borders and the center of
sourceRectinto the border and the center of the current target, or1for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the current target.
The sides and center are then tiled into place to cover the remaining portion of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTexture9GridTiled(Texture<TDriver>, float, float, float, float, float, float)
Tries to scalingly copy the entirety of a texture to the entirety of the current target using the 9-grid algorithm with tiling for the borders and the center
public bool TryRenderTexture9GridTiled(Texture<TDriver> texture, float leftWidth, float rightWidth, float topHeight, float bottomHeight, float scale, float tileScale)
Parameters
textureTexture<TDriver>The texture to copy
leftWidthfloatThe width, in pixels, of the left corners of the
texturerightWidthfloatThe width, in pixels, of the right corners of the
texturetopHeightfloatThe height, in pixels, of the top corners of the
texturebottomHeightfloatThe height, in pixels, of the bottom corners of the
texturescalefloatThe scale to use to transform the corners of the
textureinto the corners of the current target, or0for an unscaled copytileScalefloatThe scale to use to transform the borders and the center of the
textureinto the border and the center of the current target, or1for an unscaled copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The pixels in the texture are split into a 3⨯3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels.
The corners are then scaled using scale and fit into the corners of the current target.
The sides and center are then tiled into place to cover the remaining portion of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureAffine(in Point<float>?, in Point<float>?, in Point<float>?, Texture<TDriver>)
Tries to copy the entirety of a texture to the current target with a specified affine transformation
public bool TryRenderTextureAffine(in Point<float>? destinationOrigin, in Point<float>? destinationRight, in Point<float>? destinationDown, Texture<TDriver> texture)
Parameters
destinationOriginPoint<float>?A point specifying where the top-left corner of the
textureshould be mapped to on the current target, ornullto use the current target's origindestinationRightPoint<float>?A point specifying where the top-right corner of the
textureshould be mapped to on the current target, ornullto use the current target's top-right cornerdestinationDownPoint<float>?A point specifying where the bottom-left corner of the
textureshould be mapped to on the current target, ornullto use the current target's bottom-left cornertextureTexture<TDriver>The texture to copy
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureAffine(in Point<float>?, in Point<float>?, in Point<float>?, Texture<TDriver>, in Rect<float>)
Tries to copy a portion of a texture to the current target with a specified affine transformation
public bool TryRenderTextureAffine(in Point<float>? destinationOrigin, in Point<float>? destinationRight, in Point<float>? destinationDown, Texture<TDriver> texture, in Rect<float> sourceRect)
Parameters
destinationOriginPoint<float>?A point specifying where the top-left corner of
sourceRectshould be mapped to on the current target, ornullto use the current target's origindestinationRightPoint<float>?A point specifying where the top-right corner of
sourceRectshould be mapped to on the current target, ornullto use the current target's top-right cornerdestinationDownPoint<float>?A point specifying where the bottom-left corner of
sourceRectshould be mapped to on the current target, ornullto use the current target's bottom-left cornertextureTexture<TDriver>The texture to copy
sourceRectRect<float>
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureRotated(in Rect<float>, Texture<TDriver>, in Rect<float>, double, in Point<float>?, FlipMode)
Tries to copy a portion of a texture to an area of the current target with a specified rotation and flipping
public bool TryRenderTextureRotated(in Rect<float> destinationRect, Texture<TDriver> texture, in Rect<float> sourceRect, double angle, in Point<float>? centerPoint = null, FlipMode flip = FlipMode.None)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy
angledoubleThe angle, in degrees, to rotate the texture clockwise around the center point
centerPointPoint<float>?An optional point specifying the center of rotation, or
nullto rotate around the center ofdestinationRectflipFlipModeAn optional flipping direction to flip the texture in addition to rotating it
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
You can also use this method to just render a flipped texture by specifying the angle as 0 and leaving the centerPoint as unspecified.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureRotated(in Rect<float>, Texture<TDriver>, double, in Point<float>?, FlipMode)
Tries to copy the entirety of a texture to an area of the current target with a specified rotation and flipping
public bool TryRenderTextureRotated(in Rect<float> destinationRect, Texture<TDriver> texture, double angle, in Point<float>? centerPoint = null, FlipMode flip = FlipMode.None)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
angledoubleThe angle, in degrees, to rotate the texture clockwise around the center point
centerPointPoint<float>?An optional point specifying the center of rotation, or
nullto rotate around the center ofdestinationRectflipFlipModeAn optional flipping direction to flip the texture in addition to rotating it
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
You can also use this method to just render a flipped texture by specifying the angle as 0 and leaving the centerPoint as unspecified.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureRotated(Texture<TDriver>, in Rect<float>, double, in Point<float>?, FlipMode)
Tries to copy a portion of a texture to the entirety of the current target with a specified rotation and flipping
public bool TryRenderTextureRotated(Texture<TDriver> texture, in Rect<float> sourceRect, double angle, in Point<float>? centerPoint = null, FlipMode flip = FlipMode.None)
Parameters
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy
angledoubleThe angle, in degrees, to rotate the texture clockwise around the center point
centerPointPoint<float>?An optional point specifying the center of rotation, or
nullto rotate around the center of the current targetflipFlipModeAn optional flipping direction to flip the texture in addition to rotating it
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
You can also use this method to just render a flipped texture by specifying the angle as 0 and leaving the centerPoint as unspecified.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureRotated(Texture<TDriver>, double, in Point<float>?, FlipMode)
Tries to copy the entirety of a texture to the entirety of the current target with a specified rotation and flipping
public bool TryRenderTextureRotated(Texture<TDriver> texture, double angle, in Point<float>? centerPoint = null, FlipMode flip = FlipMode.None)
Parameters
textureTexture<TDriver>The texture to copy
angledoubleThe angle, in degrees, to rotate the texture clockwise around the center point
centerPointPoint<float>?An optional point specifying the center of rotation, or
nullto rotate around the center of the current targetflipFlipModeAn optional flipping direction to flip the texture in addition to rotating it
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
You can also use this method to just render a flipped texture by specifying the angle as 0 and leaving the centerPoint as unspecified.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureTiled(in Rect<float>, Texture<TDriver>, in Rect<float>, float)
Tries to tilingly copy a portion of a texture to an area of the current target with a specified scale
public bool TryRenderTextureTiled(in Rect<float> destinationRect, Texture<TDriver> texture, in Rect<float> sourceRect, float scale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy
scalefloatThe scale used to transform the
sourceRectinto thedestinationRect
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The scale is applied to the region of the texture specified by sourceRect, e.g. 32⨯32 region with a scale of 2 would become a 64⨯64 region.
That scaled region is then used and repeated as many times as needed to completely fill the region specified by destinationRect on the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureTiled(in Rect<float>, Texture<TDriver>, float)
Tries to tilingly copy the entirety of a texture to an area of the current target with a specified scale
public bool TryRenderTextureTiled(in Rect<float> destinationRect, Texture<TDriver> texture, float scale)
Parameters
destinationRectRect<float>The area of the current target to copy the texture to
textureTexture<TDriver>The texture to copy
scalefloatThe scale used to transform the
textureinto thedestinationRect
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The scale is applied to the entire texture, e.g. 32⨯32 texture with a scale of 2 would become a 64⨯64 region.
That scaled region is then used and repeated as many times as needed to completely fill the region specified by destinationRect on the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureTiled(Texture<TDriver>, in Rect<float>, float)
Tries to tilingly copy a portion of a texture to the entirety of the current target with a specified scale
public bool TryRenderTextureTiled(Texture<TDriver> texture, in Rect<float> sourceRect, float scale)
Parameters
textureTexture<TDriver>The texture to copy
sourceRectRect<float>The area of the texture to copy
scalefloatThe scale used to transform the
sourceRectinto the current target
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The scale is applied to the region of the texture specified by sourceRect, e.g. 32⨯32 region with a scale of 2 would become a 64⨯64 region.
That scaled region is then used and repeated as many times as needed to completely fill the entire area of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.
TryRenderTextureTiled(Texture<TDriver>, float)
Tries to tilingly copy the entirety of a texture to the entirety of the current target with a specified scale
public bool TryRenderTextureTiled(Texture<TDriver> texture, float scale)
Parameters
textureTexture<TDriver>The texture to copy
scalefloatThe scale used to transform the
textureinto the current target
Returns
- bool
true, if the texture was rendered successfully; otherwise,false(check TryGet(out string?) for more information)
Remarks
The scale is applied to the entire texture, e.g. 32⨯32 texture with a scale of 2 would become a 64⨯64 region.
That scaled region is then used and repeated as many times as needed to completely fill the entire area of the current target.
Only textures created with this renderer can be rendered with this method.
Rendering the texture works with sub-pixel precision.
This method should only be called from the main thread.