NinePatchRect

Hereda: Control < CanvasItem < Node < Object

Un control que muestra una textura manteniendo sus esquinas intactas, pero embaldosando sus bordes y su centro.

Descripción

También conocido como paneles de 9 cortes, NinePatchRect produce paneles limpios de cualquier tamaño basados en una pequeña textura. Para ello, divide la textura en una cuadrícula de 3×3. Cuando escalas el nodo, se embaldosan los bordes de la textura horizontal o verticalmente, se embaldosa el centro en ambos ejes y se dejan las esquinas sin cambios.

Propiedades

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

Métodos

int

get_patch_margin(margin: Side) const

void

set_patch_margin(margin: Side, value: int)


Señales

texture_changed() 🔗

Emitida cuando la textura del nodo cambia.


Enumeraciones

enum AxisStretchMode: 🔗

AxisStretchMode AXIS_STRETCH_MODE_STRETCH = 0

Estira la textura central a través del NinePatchRect. Esto puede causar que la textura se distorsione.

AxisStretchMode AXIS_STRETCH_MODE_TILE = 1

Repite la textura central a través del NinePatchRect. Esto no causará ninguna distorsión visible. La textura debe ser seamless para que esto funcione sin mostrar artefactos entre los bordes.

AxisStretchMode AXIS_STRETCH_MODE_TILE_FIT = 2

Repite la textura central a través del NinePatchRect, pero también estirará la textura para asegurarse de que cada tile sea visible por completo. Esto puede causar que la textura se distorsione, pero menos que AXIS_STRETCH_MODE_STRETCH. La textura debe ser seamless para que esto funcione sin mostrar artefactos entre los bordes.


Descripciones de Propiedades

AxisStretchMode axis_stretch_horizontal = 0 🔗

El modo de estiramiento a usar para el estiramiento/alineación horizontal.


AxisStretchMode axis_stretch_vertical = 0 🔗

El modo de estiramiento a usar para el estiramiento/alineación vertical.


bool draw_center = true 🔗

  • void set_draw_center(value: bool)

  • bool is_draw_center_enabled()

Si es true, dibuja el centro del panel. Si no, sólo dibuja los bordes de los 9 cortes.


int patch_margin_bottom = 0 🔗

  • void set_patch_margin(margin: Side, value: int)

  • int get_patch_margin(margin: Side) const

La altura de la fila inferior del 9-cortes. Un margen de 16 significa que las esquinas inferiores y el lado de los 9 cortes tendrán una altura de 16 píxeles. Puede establecer los 4 valores de margen individualmente para crear paneles con bordes no uniformes.


int patch_margin_left = 0 🔗

  • void set_patch_margin(margin: Side, value: int)

  • int get_patch_margin(margin: Side) const

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.


int patch_margin_right = 0 🔗

  • void set_patch_margin(margin: Side, value: int)

  • int get_patch_margin(margin: Side) const

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.


int patch_margin_top = 0 🔗

  • void set_patch_margin(margin: Side, value: int)

  • int get_patch_margin(margin: Side) const

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.


Rect2 region_rect = Rect2(0, 0, 0, 0) 🔗

  • void set_region_rect(value: Rect2)

  • Rect2 get_region_rect()

Región rectangular de la textura de la que tomar la muestra. Si trabajas con un atlas, usa esta propiedad para definir el área que el 9-cortes debe usar. Todas las demás propiedades son relativas a esta. Si el rectángulo está vacío, el NinePatchRect usará toda la textura.


Texture2D texture 🔗

El recurso de textura del nodo.


Descripciones de Métodos

int get_patch_margin(margin: Side) const 🔗

Devuelve el tamaño del margen en el Side especificado.


void set_patch_margin(margin: Side, value: int) 🔗

Establece el tamaño del margen en el Side especificado a value píxeles.