NineSliceBorder Struct
Definition
Namespace: Brine2D.Rendering
Defines the pixel insets for nine-slice \(9\-patch\) texture rendering. Each value is the number of pixels from that edge of the texture to the nearest cut line, measured in texels.
Implements System.IEquatable<NineSliceBorder>
Example
C#
// 8-pixel border on all sides
var border = new NineSliceBorder(8f);
// 12px horizontal borders, 6px vertical borders
var border = new NineSliceBorder(horizontal: 12f, vertical: 6f);
// Asymmetric borders
var border = new NineSliceBorder(left: 4f, top: 8f, right: 4f, bottom: 8f);
Remarks
A nine-slice texture is divided into 9 regions:
|
Corners are never scaled. Edges are scaled along one axis. The center is scaled along both.
| Constructors | |
|---|---|
| NineSliceBorder\(float\) | Creates a border with the same inset on all four sides. |
| NineSliceBorder\(float, float\) | Creates a border with symmetric horizontal and vertical insets. |
| NineSliceBorder\(float, float, float, float\) | Creates a border with independent insets for each side. |
| Properties | |
|---|---|
| Bottom | Pixels from the bottom edge of the texture to the bottom cut line. |
| Left | Pixels from the left edge of the texture to the left cut line. |
| Right | Pixels from the right edge of the texture to the right cut line. |
| Top | Pixels from the top edge of the texture to the top cut line. |