GraphicsAPI reference
Class Sprite
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics
A region of a texture with a pivot (origin) in source pixels.
public sealed record Sprite : IEquatable<Sprite>Inheritance
Implements
Remarks
Sprites usually come from a SpriteAtlas, which owns their texture.
Constructors
Sprite(Texture, RectF, Vector2)
A region of a texture with a pivot (origin) in source pixels.
public Sprite(Texture Texture, RectF Source, Vector2 Origin)Parameters
Texture Texture
The texture that holds the pixels; owned by whoever created it (usually an atlas).
Source RectF
The sprite’s rectangle in the texture, in texture pixels.
Origin Vector2
The anchor in source pixels from the sprite’s top-left: the point placed at the drawing position, and the pivot for rotation and scale.
Remarks
Sprites usually come from a SpriteAtlas, which owns their texture.
Properties
Height
Height of the sprite in pixels.
public int Height { get; }Property Value
Origin
The anchor in source pixels from the sprite’s top-left: the point placed at the drawing position, and the pivot for rotation and scale.
public Vector2 Origin { get; init; }Property Value
Source
The sprite’s rectangle in the texture, in texture pixels.
public RectF Source { get; init; }Property Value
Texture
The texture that holds the pixels; owned by whoever created it (usually an atlas).
public Texture Texture { get; init; }Property Value
Width
Width of the sprite in pixels.
public int Width { get; }Property Value
Methods
<Clone>$()
public Sprite <Clone>$()Returns
Deconstruct(out Texture, out RectF, out Vector2)
public void Deconstruct(out Texture Texture, out RectF Source, out Vector2 Origin)Parameters
Texture Texture
Source RectF
Origin Vector2
Equals(object?)
public override bool Equals(object? obj)Parameters
obj object?
Returns
Equals(Sprite?)
public bool Equals(Sprite? other)Parameters
other Sprite?
Returns
GetHashCode()
public override int GetHashCode()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(Sprite?, Sprite?)
public static bool operator ==(Sprite? left, Sprite? right)Parameters
left Sprite?
right Sprite?
Returns
operator !=(Sprite?, Sprite?)
public static bool operator !=(Sprite? left, Sprite? right)Parameters
left Sprite?
right Sprite?