Class NinePatchRect

Namespace
Forma
Assembly
Forma.dll

Draws a texture as nine patches so configured borders remain stable while center and edge regions stretch or tile.

public class NinePatchRect : TextureRect, IAddChild<Control>, IAddChild, INotifyPropertyChanged
Inheritance
NinePatchRect
Implements
Derived
Inherited Members

Constructors

NinePatchRect()

public NinePatchRect()

Properties

DrawCenter

public bool DrawCenter { get; set; }

Property Value

bool

HorizontalAxisStretchMode

public NinePatchAxisStretchMode HorizontalAxisStretchMode { get; set; }

Property Value

NinePatchAxisStretchMode

PatchMargin

public Thickness PatchMargin { get; set; }

Property Value

Thickness

RegionRect

Optional source region. An empty region uses the entire texture.

public Rectangle RegionRect { get; set; }

Property Value

Rectangle

SamplingMode

public ImageSamplingMode SamplingMode { get; set; }

Property Value

ImageSamplingMode

VerticalAxisStretchMode

public NinePatchAxisStretchMode VerticalAxisStretchMode { get; set; }

Property Value

NinePatchAxisStretchMode

Methods

GetHAxisStretchMode()

public NinePatchAxisStretchMode GetHAxisStretchMode()

Returns

NinePatchAxisStretchMode

GetMinimumSize()

public override Vector2 GetMinimumSize()

Returns

Vector2

GetPatchMargin(Side)

public float GetPatchMargin(Side side)

Parameters

side Side

Returns

float

GetPatchMargins()

public Thickness GetPatchMargins()

Returns

Thickness

GetRegionRect()

public Rectangle GetRegionRect()

Returns

Rectangle

GetSourceRegion(Vector2)

Resolves the source region used by this nine-patch against a texture size.

public Rectangle GetSourceRegion(Vector2 textureSize)

Parameters

textureSize Vector2

Returns

Rectangle

GetVAxisStretchMode()

public NinePatchAxisStretchMode GetVAxisStretchMode()

Returns

NinePatchAxisStretchMode

IsDrawCenterEnabled()

public bool IsDrawCenterEnabled()

Returns

bool

OnTextureChanged()

Hook for a subclass-specific texture_changed signal (only NinePatchRect has one in Godot).

protected override void OnTextureChanged()

SetDrawCenter(bool)

public void SetDrawCenter(bool enabled)

Parameters

enabled bool

SetHAxisStretchMode(NinePatchAxisStretchMode)

public void SetHAxisStretchMode(NinePatchAxisStretchMode mode)

Parameters

mode NinePatchAxisStretchMode

SetPatchMargin(Side, float)

public void SetPatchMargin(Side side, float value)

Parameters

side Side
value float

SetPatchMargins(Thickness)

public void SetPatchMargins(Thickness margins)

Parameters

margins Thickness

SetRegionRect(Rectangle)

public void SetRegionRect(Rectangle rect)

Parameters

rect Rectangle

SetVAxisStretchMode(NinePatchAxisStretchMode)

public void SetVAxisStretchMode(NinePatchAxisStretchMode mode)

Parameters

mode NinePatchAxisStretchMode

Events

TextureChanged

Matches Godot's NinePatchRect-only texture_changed signal.

public event Action<NinePatchRect, Texture2D> TextureChanged

Event Type

Action<NinePatchRect, Texture2D>