Skip to content

GraphicsAPI reference

Struct AtlasRegion

Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics

One named rectangle of an atlas image, as a packing tool described it.

C#
public readonly struct AtlasRegion : IEquatable<AtlasRegion>

Implements

IEquatable<AtlasRegion>

Constructors

AtlasRegion(string, RectF, Vector2, float?)

One named rectangle of an atlas image, as a packing tool described it.

C#
public AtlasRegion(string Name, RectF Source, Vector2 Origin, float? Duration)

Parameters

Name string

The frame’s name, without a file extension (“hero_run_0” for “hero_run_0.png”, “slime 0” for Aseprite’s “slime 0.aseprite”).

Source RectF

The rectangle in the atlas image, in pixels.

Origin Vector2

The anchor in the rectangle’s pixels (see Origin): the tool’s pivot when it wrote one, otherwise the Pivot of the untrimmed frame, so trimmed frames line up as their untrimmed originals.

Duration float?

How long the frame shows in an animation, in seconds, when the tool wrote it (Aseprite).

Properties

Duration

How long the frame shows in an animation, in seconds, when the tool wrote it (Aseprite).

C#
public float? Duration { get; init; }

Property Value

float?

Name

The frame’s name, without a file extension (“hero_run_0” for “hero_run_0.png”, “slime 0” for Aseprite’s “slime 0.aseprite”).

C#
public string Name { get; init; }

Property Value

string

Origin

The anchor in the rectangle’s pixels (see Origin): the tool’s pivot when it wrote one, otherwise the Pivot of the untrimmed frame, so trimmed frames line up as their untrimmed originals.

C#
public Vector2 Origin { get; init; }

Property Value

Vector2

Source

The rectangle in the atlas image, in pixels.

C#
public RectF Source { get; init; }

Property Value

RectF

Methods

Deconstruct(out string, out RectF, out Vector2, out float?)

C#
public void Deconstruct(out string Name, out RectF Source, out Vector2 Origin, out float? Duration)

Parameters

Name string

Source RectF

Origin Vector2

Duration float?

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(AtlasRegion)

C#
public bool Equals(AtlasRegion other)

Parameters

other AtlasRegion

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(AtlasRegion, AtlasRegion)

C#
public static bool operator ==(AtlasRegion left, AtlasRegion right)

Parameters

left AtlasRegion

right AtlasRegion

Returns

bool

operator !=(AtlasRegion, AtlasRegion)

C#
public static bool operator !=(AtlasRegion left, AtlasRegion right)

Parameters

left AtlasRegion

right AtlasRegion

Returns

bool