Table of Contents

Class Renderer<TDriver>

Namespace
Sdl3Sharp.Video.Rendering
Assembly
Sdl3Sharp.dll

Represents a rendering context (renderer)

public sealed class Renderer<TDriver> : Renderer, IDisposable where TDriver : notnull, IRenderingDriver

Type Parameters

TDriver

The 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

Texture<TDriver>

The current render target, or null if the default render target is active

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

format PixelFormat

The pixel format of the texture. Should be one of the supported texture formats returned by the SupportedTextureFormats property.

access TextureAccess

The intended access pattern of the texture. Should be one of the pre-defined TextureAccess values.

width int

The width of the texture in pixels

height int

The height of the texture in pixels

texture Texture<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

texture Texture<TDriver>

The resulting texture, if this method returns true; otherwise, null

colorSpace ColorSpace?

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 properties specify.

format PixelFormat?

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 properties specify.

access TextureAccess?

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 properties specify.

width int?

The width of the texture in pixels. Required if the provided properties don't specify a width.

height int?

The height of the texture in pixels. Required if the provided properties don't specify a height.

palette Palette

The palette to use when creating a texture with a palettized pixel format

sdrWhitePoint float?

The defining value for 100% diffuse white for HDR10 and floating point textures. Defaults to 100 for HDR10 textures and 1.0 for floating point textures, or whatever the provided properties specify.

hdrHeadroom float?

The maximum dynamic range for HDR10 and floating point textures in terms of the sdrWhitePoint

properties Properties

Additional 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

surface Surface

The Surface to copy and create the texture from

texture Texture<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

vertices ReadOnlySpan<Vertex>

The list of vertices to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

vertices ReadOnlySpan<Vertex>

The vertices to use

indices ReadOnlySpan<int>

The list of indices into the vertex list to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlyNativeMemory<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlyNativeMemory<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlyNativeMemory<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlyNativeMemory<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlyNativeMemory<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlyNativeMemory<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<short>

The list of short indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlyNativeMemory<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlyNativeMemory<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlyNativeMemory<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<int>

The list of int indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlyNativeMemory<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlyNativeMemory<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlyNativeMemory<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<sbyte>

The list of sbyte indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlySpan<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlySpan<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlySpan<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlySpan<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlySpan<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlySpan<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<short>

The list of short indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlySpan<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlySpan<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlySpan<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<int>

The list of int indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy ReadOnlySpan<float>

The list of vertex positions, first the X coordinate and then the Y coordinate for each vertex

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors ReadOnlySpan<Color<float>>

The list of vertex colors

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv ReadOnlySpan<float>

The list of normalized texture coordinates per vertex, first the horizontal coordinate (U) and then the vertical coordinate (V) for each vertex

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

indices ReadOnlySpan<sbyte>

The list of sbyte indices into the various vertex attribute lists to specify the triangles to draw

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy float*

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 verticesCount * xyStride bytes.

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors Color<float>*

A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least verticesCount * colorStride bytes.

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv float*

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 verticesCount * uvStride bytes.

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

verticesCount int

The number of vertices

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy float*

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 verticesCount * xyStride bytes.

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors Color<float>*

A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least verticesCount * colorStride bytes.

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv float*

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 verticesCount * uvStride bytes.

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

verticesCount int

The number of vertices

indices short*

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 indicesCount * sizeof(short) bytes.

indicesCount int

The number of short indices

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy float*

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 verticesCount * xyStride bytes.

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors Color<float>*

A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least verticesCount * colorStride bytes.

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv float*

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 verticesCount * uvStride bytes.

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

verticesCount int

The number of vertices

indices int*

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 indicesCount * sizeof(int) bytes.

indicesCount int

The number of int indices

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

xy float*

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 verticesCount * xyStride bytes.

xyStride int

The length, in bytes, to move from one element in the xy list to the next. Usually that's 2 * sizeof(float).

colors Color<float>*

A pointer to a contiguous array of vertex colors. Must be dereferenceable for at least verticesCount * colorStride bytes.

colorStride int

The length, in bytes, to move from one element in the colors list to the next. Usually that's sizeof(Color<float>).

uv float*

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 verticesCount * uvStride bytes.

uvStride int

The length, in bytes, to move from one element in the uv list to the next. Usually that's 2 * sizeof(float).

verticesCount int

The number of vertices

indices sbyte*

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 indicesCount * sizeof(sbyte) bytes.

indicesCount int

The number of sbyte indices

texture Texture<TDriver>

An optional texture to use when drawing the triangles

Returns

bool

true if 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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<TDriver>

The texture to copy

sourceRect Rect<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

texture Texture<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

texture Texture<TDriver>

The texture to copy

sourceRect Rect<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.

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

destinationRect Rect<float>

The area of the current target to copy the texture to, in a 9-grid manner

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy, in a 9-grid manner

leftWidth float

The width, in pixels, of the left corners in sourceRect

rightWidth float

The width, in pixels, of the right corners in sourceRect

topHeight float

The height, in pixels, of the top corners in sourceRect

bottomHeight float

The height, in pixels, of the bottom corners in sourceRect

scale float

The scale to use to transform the corners of sourceRect into the corners of destinationRect, or 0 for 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

destinationRect Rect<float>

The area of the current target to copy the texture to, in a 9-grid manner

texture Texture<TDriver>

The texture to copy

leftWidth float

The width, in pixels, of the left corners of the texture

rightWidth float

The width, in pixels, of the right corners of the texture

topHeight float

The height, in pixels, of the top corners of the texture

bottomHeight float

The height, in pixels, of the bottom corners of the texture

scale float

The scale to use to transform the corners of the texture into the corners of destinationRect, or 0 for 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

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy, in a 9-grid manner

leftWidth float

The width, in pixels, of the left corners in sourceRect

rightWidth float

The width, in pixels, of the right corners in sourceRect

topHeight float

The height, in pixels, of the top corners in sourceRect

bottomHeight float

The height, in pixels, of the bottom corners in sourceRect

scale float

The scale to use to transform the corners of sourceRect into the corners of the current target, or 0 for 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

texture Texture<TDriver>

The texture to copy

leftWidth float

The width, in pixels, of the left corners of the texture

rightWidth float

The width, in pixels, of the right corners of the texture

topHeight float

The height, in pixels, of the top corners of the texture

bottomHeight float

The height, in pixels, of the bottom corners of the texture

scale float

The scale to use to transform the corners of the texture into the corners of the current target, or 0 for 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

destinationRect Rect<float>

The area of the current target to copy the texture to, in a 9-grid manner

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy, in a 9-grid manner

leftWidth float

The width, in pixels, of the left corners in sourceRect

rightWidth float

The width, in pixels, of the right corners in sourceRect

topHeight float

The height, in pixels, of the top corners in sourceRect

bottomHeight float

The height, in pixels, of the bottom corners in sourceRect

scale float

The scale to use to transform the corners of sourceRect into the corners of destinationRect, or 0 for an unscaled copy

tileScale float

The scale to use to transform the borders and the center of sourceRect into the border and the center of destinationRect, or 1 for 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

destinationRect Rect<float>

The area of the current target to copy the texture to, in a 9-grid manner

texture Texture<TDriver>

The texture to copy

leftWidth float

The width, in pixels, of the left corners of the texture

rightWidth float

The width, in pixels, of the right corners of the texture

topHeight float

The height, in pixels, of the top corners of the texture

bottomHeight float

The height, in pixels, of the bottom corners of the texture

scale float

The scale to use to transform the corners of the texture into the corners of destinationRect, or 0 for an unscaled copy

tileScale float

The scale to use to transform the borders and the center of the texture into the border and the center of destinationRect, or 1 for 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

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy, in a 9-grid manner

leftWidth float

The width, in pixels, of the left corners in sourceRect

rightWidth float

The width, in pixels, of the right corners in sourceRect

topHeight float

The height, in pixels, of the top corners in sourceRect

bottomHeight float

The height, in pixels, of the bottom corners in sourceRect

scale float

The scale to use to transform the corners of sourceRect into the corners of the current target, or 0 for an unscaled copy

tileScale float

The scale to use to transform the borders and the center of sourceRect into the border and the center of the current target, or 1 for 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

texture Texture<TDriver>

The texture to copy

leftWidth float

The width, in pixels, of the left corners of the texture

rightWidth float

The width, in pixels, of the right corners of the texture

topHeight float

The height, in pixels, of the top corners of the texture

bottomHeight float

The height, in pixels, of the bottom corners of the texture

scale float

The scale to use to transform the corners of the texture into the corners of the current target, or 0 for an unscaled copy

tileScale float

The scale to use to transform the borders and the center of the texture into the border and the center of the current target, or 1 for 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

destinationOrigin Point<float>?

A point specifying where the top-left corner of the texture should be mapped to on the current target, or null to use the current target's origin

destinationRight Point<float>?

A point specifying where the top-right corner of the texture should be mapped to on the current target, or null to use the current target's top-right corner

destinationDown Point<float>?

A point specifying where the bottom-left corner of the texture should be mapped to on the current target, or null to use the current target's bottom-left corner

texture Texture<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

destinationOrigin Point<float>?

A point specifying where the top-left corner of sourceRect should be mapped to on the current target, or null to use the current target's origin

destinationRight Point<float>?

A point specifying where the top-right corner of sourceRect should be mapped to on the current target, or null to use the current target's top-right corner

destinationDown Point<float>?

A point specifying where the bottom-left corner of sourceRect should be mapped to on the current target, or null to use the current target's bottom-left corner

texture Texture<TDriver>

The texture to copy

sourceRect Rect<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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy

angle double

The angle, in degrees, to rotate the texture clockwise around the center point

centerPoint Point<float>?

An optional point specifying the center of rotation, or null to rotate around the center of destinationRect

flip FlipMode

An 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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<TDriver>

The texture to copy

angle double

The angle, in degrees, to rotate the texture clockwise around the center point

centerPoint Point<float>?

An optional point specifying the center of rotation, or null to rotate around the center of destinationRect

flip FlipMode

An 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

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy

angle double

The angle, in degrees, to rotate the texture clockwise around the center point

centerPoint Point<float>?

An optional point specifying the center of rotation, or null to rotate around the center of the current target

flip FlipMode

An 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

texture Texture<TDriver>

The texture to copy

angle double

The angle, in degrees, to rotate the texture clockwise around the center point

centerPoint Point<float>?

An optional point specifying the center of rotation, or null to rotate around the center of the current target

flip FlipMode

An 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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy

scale float

The scale used to transform the sourceRect into the destinationRect

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

destinationRect Rect<float>

The area of the current target to copy the texture to

texture Texture<TDriver>

The texture to copy

scale float

The scale used to transform the texture into the destinationRect

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

texture Texture<TDriver>

The texture to copy

sourceRect Rect<float>

The area of the texture to copy

scale float

The scale used to transform the sourceRect into 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

texture Texture<TDriver>

The texture to copy

scale float

The scale used to transform the texture into 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.