NinePatchRect¶
Inherits: Control < CanvasItem < Node < Object
Un fotograma escalable basado en la textura que enmarca el centro y los lados de la textura, pero mantiene el tamaño original de las esquinas. Perfecto para paneles y cuadros de diálogo.
Descripción¶
También conocido como paneles de 9 cortes, el 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 nivelan los lados de la textura horizontal o verticalmente, el centro en ambos ejes, pero no se escalan o se nivelan las esquinas.
Propiedades¶
|
||
|
||
|
||
mouse_filter |
|
|
|
||
|
||
|
||
|
||
|
||
Métodos¶
get_patch_margin ( Margin margin ) const |
|
void |
set_patch_margin ( Margin margin, int value ) |
Señales¶
texture_changed ( )
Emitido cuando la textura del nodo cambia.
Enumeraciones¶
enum AxisStretchMode:
AXIS_STRETCH_MODE_STRETCH = 0 --- Stretches the center texture across the NinePatchRect. This may cause the texture to be distorted.
AXIS_STRETCH_MODE_TILE = 1 --- Repeats the center texture across the NinePatchRect. This won't cause any visible distortion. The texture must be seamless for this to work without displaying artifacts between edges.
Note: Only supported when using the GLES3 renderer. When using the GLES2 renderer, this will behave like AXIS_STRETCH_MODE_STRETCH.
AXIS_STRETCH_MODE_TILE_FIT = 2 --- Repeats the center texture across the NinePatchRect, but will also stretch the texture to make sure each tile is visible in full. This may cause the texture to be distorted, but less than AXIS_STRETCH_MODE_STRETCH. The texture must be seamless for this to work without displaying artifacts between edges.
Note: Only supported when using the GLES3 renderer. When using the GLES2 renderer, this will behave like AXIS_STRETCH_MODE_STRETCH.
Descripciones de Propiedades¶
AxisStretchMode axis_stretch_horizontal
Default |
|
Setter |
set_h_axis_stretch_mode(value) |
Getter |
get_h_axis_stretch_mode() |
The stretch mode to use for horizontal stretching/tiling. See AxisStretchMode for possible values.
AxisStretchMode axis_stretch_vertical
Default |
|
Setter |
set_v_axis_stretch_mode(value) |
Getter |
get_v_axis_stretch_mode() |
The stretch mode to use for vertical stretching/tiling. See AxisStretchMode for possible values.
bool draw_center
Default |
|
Setter |
set_draw_center(value) |
Getter |
is_draw_center_enabled() |
Si true
, dibuja el centro del panel. Si no, sólo dibuja los bordes de los 9 cortes.
int patch_margin_bottom
Default |
|
Setter |
set_patch_margin(value) |
Getter |
get_patch_margin() |
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
Default |
|
Setter |
set_patch_margin(value) |
Getter |
get_patch_margin() |
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
Default |
|
Setter |
set_patch_margin(value) |
Getter |
get_patch_margin() |
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
Default |
|
Setter |
set_patch_margin(value) |
Getter |
get_patch_margin() |
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
Default |
|
Setter |
set_region_rect(value) |
Getter |
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.
Texture texture
Setter |
set_texture(value) |
Getter |
get_texture() |
El recurso de textura del nodo.
Descripciones de Métodos¶
Devuelve el tamaño del margen identificado por la constante Margin dada.
Establece el tamaño del margen identificado por la constante Margin dada a value
en píxeles.