Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

NinePatchRect

Inherits: Control < CanvasItem < Node < Object

A control that displays a texture by keeping its corners intact, but tiling its edges and center.

Description

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

AxisStretchMode

axis_stretch_horizontal

0

AxisStretchMode

axis_stretch_vertical

0

bool

draw_center

true

MouseFilter

mouse_filter

2 (overrides Control)

int

patch_margin_bottom

0

int

patch_margin_left

0

int

patch_margin_right

0

int

patch_margin_top

0

Rect2

region_rect

Rect2(0, 0, 0, 0)

Texture2D

texture

Methods

int

get_patch_margin ( Side margin ) const

void

set_patch_margin ( Side margin, int value )


Signals

texture_changed ( )

Emitted when the node's texture changes.


Enumerations

enum AxisStretchMode:

AxisStretchMode AXIS_STRETCH_MODE_STRETCH = 0

Stretches the center texture across the NinePatchRect. This may cause the texture to be distorted.

AxisStretchMode AXIS_STRETCH_MODE_TILE = 1</