跳转至

NinePatchRect

继承

Control

简要描述

可扩展的基于纹理的框架,可平铺纹理的中心和侧面,但保留角的原始大小。

描述

NinePatchRect也称为9切片面板,它基于较小的纹理生成任何大小的干净面板。为此,它在3×3网格中分割纹理。当你缩放节点时,它会水平或垂直地平铺纹理的两边,中心在两个轴上,但它不会缩放或平铺角落。

成员

类型 属性名 默认值
int axis_stretch_horizontal 0
int axis_stretch_vertical 0
bool draw_center true
int mouse_filter 2
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 )
Texture texture

方法

返回值类型 方法名称
int get_patch_margin(margin: int) const
void set_patch_margin(margin: int, value: int)

信号

  • texture_changed

当节点的纹理改变时发出。


枚举

enum AxisStretchMode: - AXIS_STRETCH_MODE_STRETCH = 0

在撰写本文时不做任何事情。

  • AXIS_STRETCH_MODE_TILE = 1

在撰写本文时不做任何事情。

  • AXIS_STRETCH_MODE_TILE_FIT = 2

在撰写本文时不做任何事情。


常量

成员说明

  • int axis_stretch_horizontal
Default 0
setter set_h_axis_stretch_mode(value)
getter get_h_axis_stretch_mode
  • int axis_stretch_vertical
Default 0
setter set_v_axis_stretch_mode(value)
getter get_v_axis_stretch_mode
  • bool draw_center
Default true
setter set_draw_center(value)
getter is_draw_center_enabled
  • int mouse_filter
Default 2
setter set_mouse_filter(value)
getter get_mouse_filter
  • int patch_margin_bottom
Default 0
setter set_patch_margin(value)
getter get_patch_margin
  • int patch_margin_left
Default 0
setter set_patch_margin(value)
getter get_patch_margin
  • int patch_margin_right
Default 0
setter set_patch_margin(value)
getter get_patch_margin
  • int patch_margin_top
Default 0
setter set_patch_margin(value)
getter get_patch_margin
  • Rect2 region_rect
Default Rect2( 0, 0, 0, 0 )
setter set_region_rect(value)
getter get_region_rect
  • Texture texture
setter set_texture(value)
getter get_texture

方法说明

  • get_patch_margin get_patch_margin(margin: int) const

返回由给定的Margin常数标识的边距大小。


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

将给定的Margin常量标识的边距大小设置为value以像素为单位。