Table of Contents

Interface ISpriteBatch

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Windows.dll

Represents a single group of sprites with their associated drawing properties.
ID2D1SpriteBatch

public interface ISpriteBatch : IDirect2DResource, IObjectRef, IIsDisposed, IDisposable, IFactoryProperty, IInternalImpl
Inherited Members
Extension Methods

Remarks

Sprites are a way for apps to draw a large number of images very efficiently. They are commonly used to render characters and backgrounds in 2D games, or to render particle systems such as smoke and flames. If your app has performance demands and needs to draw hundreds or thousands of images every frame, then consider taking advantage of sprite batches and the fine-grained control they offer, instead of the general-purpose DrawImage method.

Properties

SpriteCount

Gets the number of sprites in this sprite batch.

Methods

AddSprites(int, ReadOnlySpan<RectFloat>, ReadOnlySpan<RectInt32>, ReadOnlySpan<ColorRgba128Float>, ReadOnlySpan<Matrix3x2Float>)

Adds the given sprites to the end of this sprite batch. You may use a 1-length span for any of the properties to use the same value for each sprite. You may use a 0-length span (using the C# default keyword, or ReadOnlySpan<T>.Empty) for sourceRectangles, colors, or transforms in order to use the default policy associated with that property. This can reduce memory usage and increase performance.

Clear()

Removes all sprites from this sprite batch.

GetSprites(int, Span<RectFloat>, Span<RectInt32>, Span<ColorRgba128Float>, Span<Matrix3x2Float>)

Retrieves the specified subset of sprites from this sprite batch. For the best performance, use an empty Span (using the C# default keyword, or Span<T>.Empty) for properties that you do not need to retrieve.

SetSprites(int, int, ReadOnlySpan<RectFloat>, ReadOnlySpan<RectInt32>, ReadOnlySpan<ColorRgba128Float>, ReadOnlySpan<Matrix3x2Float>)

Updates the properties of the specified sprites in the sprite batch. Providing an empty span for any property will leave that property unmodified for the sprites. Providing a 1-length span for any property will use the same value for all of the sprites.