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()
Controls how the stylebox's texture will be stretched or tiled horizontally.
AxisStretchMode axis_stretch_vertical = 0 🔗
void set_v_axis_stretch_mode(value: AxisStretchMode)
AxisStretchMode get_v_axis_stretch_mode()
Controls how the stylebox's texture will be stretched or tiled vertically.
如果為 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) 🔗
The region to use from the texture.
This is equivalent to first wrapping the texture in an AtlasTexture with the same region.
If empty (Rect2(0, 0, 0, 0)), the whole texture is used.
繪製此樣式盒時所使用的紋理。
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 圖元。