Class NinePatchRect
A control that displays a texture by keeping its corners intact, but tiling its edges and center.
- Inheritance
-
NinePatchRect
Remarks
Also known as 9-slice panels, NinePatchRect produces clean panels of any size based on a small texture. To do so, it splits the texture in a 3×3 grid. When you scale the node, it tiles the texture's edges horizontally or vertically, tiles the center on both axes, and leaves the corners unchanged.
Properties
axis_stretch_horizontal
The stretch mode to use for horizontal stretching/tiling. See AxisStretchMode for possible values.
var axis_stretch_horizontal : int = 0
Property Value
Remarks
axis_stretch_vertical
The stretch mode to use for vertical stretching/tiling. See AxisStretchMode for possible values.
var axis_stretch_vertical : int = 0
Property Value
Remarks
draw_center
If true
, draw the panel's center. Else, only draw the 9-slice's borders.
var draw_center : bool = true
Property Value
Remarks
patch_margin_bottom
The height of the 9-slice's bottom row. A margin of 16 means the 9-slice's bottom corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
var patch_margin_bottom : int = 0
Property Value
Remarks
patch_margin_left
The width of the 9-slice's left column. A margin of 16 means the 9-slice's left corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
var patch_margin_left : int = 0
Property Value
Remarks
patch_margin_right
The width of the 9-slice's right column. A margin of 16 means the 9-slice's right corners and side will have a width of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
var patch_margin_right : int = 0
Property Value
Remarks
patch_margin_top
The height of the 9-slice's top row. A margin of 16 means the 9-slice's top corners and side will have a height of 16 pixels. You can set all 4 margin values individually to create panels with non-uniform borders.
var patch_margin_top : int = 0
Property Value
Remarks
region_rect
Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture.
var region_rect : Rect2 = Rect2(0, 0, 0, 0)
Property Value
Remarks
texture
The node's texture resource.
var texture : Texture2D
Property Value
Remarks
Methods
get_patch_margin(int)
Qualifiers: const
Returns the size of the margin on the specified Side.
int get_patch_margin(int margin)
Parameters
margin
int
set_patch_margin(int, int)
Sets the size of the margin on the specified Side to value
pixels.
void set_patch_margin(int margin, int value)
Parameters
Events
texture_changed
Emitted when the node's texture changes.
signal texture_changed