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.
Checking the stable version of the documentation...
StyleBoxTexture
继承: StyleBox < Resource < RefCounted < Object
基于纹理的九宫格 StyleBox。
描述
基于纹理的九宫格 StyleBox,类似于 NinePatchRect。这种样式盒对纹理执行 3×3 缩放,只有中心单元格会被完全拉伸。这样就能够为不同大小的样式盒设计带边框的样式。
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
get_expand_margin(margin: Side) const |
|
get_texture_margin(margin: Side) const |
|
void |
set_expand_margin(margin: Side, size: float) |
void |
set_expand_margin_all(size: float) |
void |
set_texture_margin(margin: Side, size: float) |
void |
set_texture_margin_all(size: float) |
枚举
enum AxisStretchMode: 🔗
AxisStretchMode AXIS_STRETCH_MODE_STRETCH = 0
拉伸样式盒的纹理。这会导致可见的失真,除非纹理大小与样式盒的大小完美匹配。
AxisStretchMode AXIS_STRETCH_MODE_TILE = 1
根据九宫格系统,重复样式盒的纹理,以匹配样式盒的大小。
AxisStretchMode AXIS_STRETCH_MODE_TILE_FIT = 2
根据九宫格系统,重复样式盒的纹理,以匹配样式盒的大小。与 AXIS_STRETCH_MODE_TILE 不同,可能会稍微拉伸纹理以使九宫格纹理平铺无缝。
属性说明
AxisStretchMode axis_stretch_horizontal = 0
🔗
void set_h_axis_stretch_mode(value: AxisStretchMode)
AxisStretchMode get_h_axis_stretch_mode()
控制如何水平拉伸或平铺样式盒的纹理。可能的取值见 AxisStretchMode。
AxisStretchMode axis_stretch_vertical = 0
🔗
void set_v_axis_stretch_mode(value: AxisStretchMode)
AxisStretchMode get_v_axis_stretch_mode()
控制如何垂直拉伸或平铺样式盒的纹理。可能的取值见 AxisStretchMode。
如果为 true
,将绘制九宫格纹理的中心图块。
float expand_margin_bottom = 0.0
🔗
绘制时扩展此样式盒的下边距,使其绘制得比请求的大。
float expand_margin_left = 0.0
🔗
绘制时扩展此样式盒的左边距,使其绘制得比请求的大。
float expand_margin_right = 0.0
🔗
绘制时扩展此样式盒的右边距,使其绘制得比请求的大。
float expand_margin_top = 0.0
🔗
绘制时扩展此样式盒的上边距,使其绘制得比请求的大。
Color modulate_color = Color(1, 1, 1, 1)
🔗
绘制此样式盒时用于调制纹理的颜色。
Rect2 region_rect = Rect2(0, 0, 0, 0)
🔗
texture 中要使用的区域。
等价于首先将 texture 包裹在具有相同区域的 AtlasTexture 中。
如果为空(Rect2(0, 0, 0, 0)
),则将使用整个 texture。
绘制此样式盒时所使用的纹理。
float texture_margin_bottom = 0.0
🔗
增加 3×3 StyleBox 的底边距。
更高的值意味着更多的源纹理被认为是 3×3 box的底边的一部分。
如果 StyleBox.content_margin_bottom 为负值,这个值也是作为后备值使用。
float texture_margin_left = 0.0
🔗
增加 3×3 StyleBox 的左边距。
较高的值意味着更多的源纹理被认为是 3×3 box左边框的一部分。
如果 StyleBox.content_margin_left 为负值,这个值也是作为后备值使用。
float texture_margin_right = 0.0
🔗
增加 3×3 StyleBox 的右边距。
较高的值意味着更多的源纹理被认为是 3×3 box右边框的一部分。
如果 StyleBox.content_margin_right 为负值,这个值也是作为后备值使用。
float texture_margin_top = 0.0
🔗
增加 3×3 StyleBox 的上边距。
较高的值意味着更多的源纹理被认为是 3×3 box上边框的一部分。
如果 StyleBox.content_margin_top 为负值,这个值也是作为后备值使用。
方法说明
float get_expand_margin(margin: Side) const 🔗
返回指定边 Side 的扩展边距大小。
float get_texture_margin(margin: Side) const 🔗
返回指定边 Side 的边距大小。
void set_expand_margin(margin: Side, size: float) 🔗
将指定边 Side 的扩展边距设置为 size
像素。
void set_expand_margin_all(size: float) 🔗
将所有边的扩展边距都设置为 size
像素。
void set_texture_margin(margin: Side, size: float) 🔗
将指定边 Side 的边距设置为 size
像素。
void set_texture_margin_all(size: float) 🔗
将所有边的边距都设置为 size
像素。