Skip to content

GraphicsAPI reference

Struct NineSlice

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

An image that stretches to any size without distorting its frame: the part of Source within Left, Top, Right and Bottom pixels of its sides is the border, drawn at its size at the corners and stretched along the edges; the rest is the centre, stretched to fill. Draw one with DrawNineSlice, or set it as a Image.

C#
public readonly struct NineSlice : IEquatable<NineSlice>

Implements

IEquatable<NineSlice>

Constructors

NineSlice(Texture, RectF, float, float, float, float)

An image that stretches to any size without distorting its frame: the part of Source within Left, Top, Right and Bottom pixels of its sides is the border, drawn at its size at the corners and stretched along the edges; the rest is the centre, stretched to fill. Draw one with DrawNineSlice, or set it as a Image.

C#
public NineSlice(Texture Texture, RectF Source, float Left, float Top, float Right, float Bottom)

Parameters

Texture Texture

The texture that holds the image.

Source RectF

The image’s rectangle in the texture, in pixels.

Left float

Width of the left border, in source pixels.

Top float

Height of the top border, in source pixels.

Right float

Width of the right border, in source pixels.

Bottom float

Height of the bottom border, in source pixels.

NineSlice(Texture, RectF, float)

An image with a border of border pixels on every side.

C#
public NineSlice(Texture texture, RectF source, float border)

Parameters

texture Texture

source RectF

border float

Properties

Bottom

Height of the bottom border, in source pixels.

C#
public float Bottom { get; init; }

Property Value

float

Left

Width of the left border, in source pixels.

C#
public float Left { get; init; }

Property Value

float

Right

Width of the right border, in source pixels.

C#
public float Right { get; init; }

Property Value

float

Scale

How many destination units one source pixel of the border takes (1 by default); 2 draws the frame twice as thick.

C#
public float Scale { get; init; }

Property Value

float

Source

The image’s rectangle in the texture, in pixels.

C#
public RectF Source { get; init; }

Property Value

RectF

Texture

The texture that holds the image.

C#
public Texture Texture { get; init; }

Property Value

Texture

Top

Height of the top border, in source pixels.

C#
public float Top { get; init; }

Property Value

float

Methods

Deconstruct(out Texture, out RectF, out float, out float, out float, out float)

C#
public void Deconstruct(out Texture Texture, out RectF Source, out float Left, out float Top, out float Right, out float Bottom)

Parameters

Texture Texture

Source RectF

Left float

Top float

Right float

Bottom float

Equals(object)

C#
public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(NineSlice)

C#
public bool Equals(NineSlice other)

Parameters

other NineSlice

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(NineSlice, NineSlice)

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

Parameters

left NineSlice

right NineSlice

Returns

bool

operator !=(NineSlice, NineSlice)

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

Parameters

left NineSlice

right NineSlice

Returns

bool