reckfellENGINE

StyleBoxTexture

Textured nine-patch style with independent padding and draw expansion.

On this page
class StyleBoxTextureReckfellSharpInherits StyleBox

Assign Texture, optionally RegionRect for a source subregion, and four TextureMargin values to split it into nine regions. Corners retain local dimensions; edges/center stretch or repeat according to AxisStretchHorizontal/Vertical. RegionRect uses source pixels; zero Rect2 uses the whole texture. Validate nonnegative border sums against the source region.

TextureMargin defines slicing. ContentMargin defines content padding: negative values use corresponding TextureMargin, explicit values override it. For example, texture border 4 and ContentMarginLeft = 10 retain slicing at 4 but pad content by 10. Resolved padding determines minimum even with Texture = null; full texture dimensions are not the style minimum.

ExpandMargin only expands drawing beyond the supplied rect. It does not enlarge ContentMargin, minimum size or hit area. DrawCenter = false suppresses the center without changing padding. ModulateColor multiplies image color/alpha without editing source pixels.

Texture reference replacement emits Changed, but the assigned texture’s internal Changed is not forwarded through StyleBoxTexture. If a dynamic resource’s size/region changes require consumer refresh, explicitly notify the style through EmitChanged. Ordinary Duplicate separates style values while retaining shared Texture.

Choose Tile or TileFit to repeat patterns; TileFit adjusts a whole repeat count. Verify filtering/atlas results on the target renderer.

StyleBox.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

StyleBoxTextureConstructor
# StyleBoxTexture
C#
public StyleBoxTexture();

Creates a style without Texture: slice/expand margins 0, DrawCenter = true, white ModulateColor, both axes Stretch. Inherits automatic ContentMargin = -1.

Properties14

AxisStretchHorizontalProperty
# AxisStretchHorizontal
C#
public StyleBoxTexture.AxisStretchMode AxisStretchHorizontal { get; set; }

Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.

AxisStretchVerticalProperty
# AxisStretchVertical
C#
public StyleBoxTexture.AxisStretchMode AxisStretchVertical { get; set; }

Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.

DrawCenterProperty
# DrawCenter
C#
public bool DrawCenter { get; set; }

Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.

ExpandMarginBottomProperty
# ExpandMarginBottom
C#
public float ExpandMarginBottom { get; set; }

Decorative Bottom drawing expansion, default 0. Does not change minimum or content padding.

ExpandMarginLeftProperty
# ExpandMarginLeft
C#
public float ExpandMarginLeft { get; set; }

Decorative Left drawing expansion, default 0. Does not change minimum or content padding.

ExpandMarginRightProperty
# ExpandMarginRight
C#
public float ExpandMarginRight { get; set; }

Decorative Right drawing expansion, default 0. Does not change minimum or content padding.

ExpandMarginTopProperty
# ExpandMarginTop
C#
public float ExpandMarginTop { get; set; }

Decorative Top drawing expansion, default 0. Does not change minimum or content padding.

ModulateColorProperty
# ModulateColor
C#
public Color ModulateColor { get; set; }

Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.

RegionRectProperty
# RegionRect
C#
public Rect2 RegionRect { get; set; }

Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.

TextureProperty
# Texture
C#
public Texture2D Texture { get; set; }

Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.

TextureMarginBottomProperty
# TextureMarginBottom
C#
public float TextureMarginBottom { get; set; }

Source-pixel Bottom slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.

TextureMarginLeftProperty
# TextureMarginLeft
C#
public float TextureMarginLeft { get; set; }

Source-pixel Left slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.

TextureMarginRightProperty
# TextureMarginRight
C#
public float TextureMarginRight { get; set; }

Source-pixel Right slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.

TextureMarginTopProperty
# TextureMarginTop
C#
public float TextureMarginTop { get; set; }

Source-pixel Top slice-border thickness, default 0. Also supplies automatic content padding, overridden by explicit ContentMargin.

Methods18

GetExpandMarginfloat
# GetExpandMargin
C#
public float GetExpandMargin(Side margin);

Returns decorative drawing expansion on a side rather than resolved content padding.

Parameters
NameTypeDefault
marginSide—
margin

Side.Left, Top, Right or Bottom.

Returns float

Side drawing expansion in pixels.

GetHAxisStretchModeStyleBoxTexture.AxisStretchMode
# GetHAxisStretchMode
C#
public StyleBoxTexture.AxisStretchMode GetHAxisStretchMode();

Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.

Returns StyleBoxTexture.AxisStretchMode

Selected horizontal AxisStretchMode.

GetModulateColor
# GetModulate
C#
public Color GetModulate();

Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.

Returns Color

Drawing color/alpha multiplier.

GetRegionRectRect2
# GetRegionRect
C#
public Rect2 GetRegionRect();

Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.

Returns Rect2

Stored source pixel-region Rect2.

GetTextureTexture2D
# GetTexture
C#
public Texture2D GetTexture();

Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.

Returns Texture2D

Shared Texture2D, or null.

GetTextureMarginfloat
# GetTextureMargin
C#
public float GetTextureMargin(Side margin);

Returns texture-slice border thickness in pixels. Also supplies automatic content padding when corresponding ContentMargin is negative.

Parameters
NameTypeDefault
marginSide—
margin

Side.Left, Top, Right or Bottom.

Returns float

Slice-border thickness in pixels.

GetVAxisStretchModeStyleBoxTexture.AxisStretchMode
# GetVAxisStretchMode
C#
public StyleBoxTexture.AxisStretchMode GetVAxisStretchMode();

Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.

Returns StyleBoxTexture.AxisStretchMode

Selected vertical AxisStretchMode.

IsDrawCenterEnabledbool
# IsDrawCenterEnabled
C#
public bool IsDrawCenterEnabled();

Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.

Returns bool

true when the center is drawn.

SetDrawCentervoid
# SetDrawCenter
C#
public void SetDrawCenter(bool enable);

Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.

Parameters
NameTypeDefault
enablebool—
enable

Draw nine-patch center, default true. false retains padding/minimum; does not turn the Control into a container or transparent input mask.

SetExpandMarginvoid
# SetExpandMargin
C#
public void SetExpandMargin(Side margin, float size);

Sets decorative drawing overflow beyond rect and emits Changed. Does not enlarge ContentMargin, minimum or Control hit area.

Parameters
NameTypeDefault
marginSide—
sizefloat—
margin

Side.Left, Top, Right or Bottom.

size

Sets decorative drawing overflow beyond rect and emits Changed. Does not enlarge ContentMargin, minimum or Control hit area.

SetExpandMarginAllvoid
# SetExpandMarginAll
C#
public void SetExpandMarginAll(float size);

Sets the same drawing expansion on all sides and emits Changed once. Layout does not reserve that area.

Parameters
NameTypeDefault
sizefloat—
size

Sets the same drawing expansion on all sides and emits Changed once. Layout does not reserve that area.

SetHAxisStretchModevoid
# SetHAxisStretchMode
C#
public void SetHAxisStretchMode(StyleBoxTexture.AxisStretchMode mode);

Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.

Parameters
NameTypeDefault
modeStyleBoxTexture.AxisStretchMode—
mode

Horizontal Stretch, Tile or TileFit, default Stretch. TileFit adjusts a whole repeat count. Does not change ContentMargin.

SetModulatevoid
# SetModulate
C#
public void SetModulate(Color color);

Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.

Parameters
NameTypeDefault
colorColor—
color

Drawing color/alpha multiplier, default white. Does not edit Texture or change content padding.

SetRegionRectvoid
# SetRegionRect
C#
public void SetRegionRect(Rect2 region);

Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.

Parameters
NameTypeDefault
regionRect2—
region

Source pixel region rather than UVs; zero Rect2 means whole texture. Does not automatically change ContentMargin/TextureMargin.

SetTexturevoid
# SetTexture
C#
public void SetTexture(Texture2D texture);

Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.

Parameters
NameTypeDefault
textureTexture2D—
texture

Shared Texture2D, or null. Reference replacement emits Changed; inner resource Changed is not automatically forwarded. Minimum depends on margins rather than whole Texture size.

SetTextureMarginvoid
# SetTextureMargin
C#
public void SetTextureMargin(Side margin, float size);

Sets slice-border thickness and emits Changed. Use nonnegative values with opposite-border sums fitting the source region. Can change automatic minimum size.

Parameters
NameTypeDefault
marginSide—
sizefloat—
margin

Side.Left, Top, Right or Bottom.

size

Sets slice-border thickness and emits Changed. Use nonnegative values with opposite-border sums fitting the source region. Can change automatic minimum size.

SetTextureMarginAllvoid
# SetTextureMarginAll
C#
public void SetTextureMarginAll(float size);

Sets the same slice border on every side and emits Changed once. Does not overwrite explicit ContentMargin.

Parameters
NameTypeDefault
sizefloat—
size

Sets the same slice border on every side and emits Changed once. Does not overwrite explicit ContentMargin.

SetVAxisStretchModevoid
# SetVAxisStretchMode
C#
public void SetVAxisStretchMode(StyleBoxTexture.AxisStretchMode mode);

Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.

Parameters
NameTypeDefault
modeStyleBoxTexture.AxisStretchMode—
mode

Independent vertical Stretch/Tile/TileFit, default Stretch. Does not change minimum size or numeric slice margins.

StyleBoxTexture.AxisStretchMode

ValueDescription
Stretch = 0

Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly.

Tile = 1

Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system.

TileFit = 2

Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. Unlike StyleBoxTexture.AxisStretchMode.Tile, the texture may be slightly stretched to make the nine-patch texture tile seamlessly.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.