Struct SpriteDrawOptions
Immutable description of a sprite draw request.
public readonly record struct SpriteDrawOptions : IEquatable<SpriteDrawOptions>
- Implements
- Inherited Members
Constructors
SpriteDrawOptions(ITexture, Rectangle, Rectangle?, Color, RenderFlip, float, Vector2, Vector2, Material, int)
Creates a sprite draw. A sourceRectangle that is null or zero-sized draws the whole texture, or the region of the parent when texture is a SubTexture.
public SpriteDrawOptions(ITexture texture, Rectangle destinationRectangle, Rectangle? sourceRectangle = null, Color color = default, RenderFlip flip = RenderFlip.None, float rotation = 0, Vector2 origin = default, Vector2 scale = default, Material material = default, int zIndex = 0)
Parameters
textureITexturedestinationRectangleRectanglesourceRectangleRectangle?colorColorflipRenderFliprotationfloatoriginVector2scaleVector2materialMaterialzIndexint
Exceptions
- ArgumentNullException
textureis null.
Properties
Color
The colour the texture is tinted with. White, which applies no tint, when not given.
public Color Color { get; }
Property Value
DestinationRectangle
Where the sprite is drawn, and at what size, in the coordinates the projection maps.
public Rectangle DestinationRectangle { get; }
Property Value
Flip
Whether the sprite is mirrored horizontally, vertically, or both.
public RenderFlip Flip { get; }
Property Value
Material
The material the sprite is drawn with. Unlit when not given.
public Material Material { get; }
Property Value
Origin
The point the sprite is rotated and scaled about.
public Vector2 Origin { get; }
Property Value
Rotation
The rotation of the sprite about Origin, in degrees.
public float Rotation { get; }
Property Value
Scale
The scale the sprite is drawn at. (1, 1), which leaves it unscaled, when not given.
public Vector2 Scale { get; }
Property Value
SourceRectangle
The part of Texture to draw, in pixels. The whole texture when the source was null or zero-sized.
public Rectangle SourceRectangle { get; }
Property Value
Texture
The texture to draw from. A SubTexture with no source rectangle draws its region of its parent.
public ITexture Texture { get; }
Property Value
ZIndex
The order the sprite is drawn in: lower values first, when the batch sorts by it. See SetExternalOrdering(bool).
public int ZIndex { get; }