StyleBoxTexture

继承: StyleBox < Resource < RefCounted < Object

A texture-based nine-patch StyleBox.

描述

A texture-based nine-patch StyleBox, in a way similar to NinePatchRect. This stylebox performs a 3×3 scaling of a texture, where only the center cell is fully stretched. This makes it possible to design bordered styles regardless of the stylebox's size.

属性

方法

floatget_expand_margin ( margin: Side ) const1
floatget_texture_margin ( margin: Side ) const1
voidset_expand_margin ( margin: Side, size: float )
voidset_expand_margin_all ( size: float )
voidset_texture_margin ( margin: Side, size: float )
voidset_texture_margin_all ( size: float )

枚举

enum AxisStretchMode:

AxisStretchMode AXIS_STRETCH_MODE_STRETCH = 0

Stretch the stylebox's texture. This results in visible distortion unless the texture size matches the stylebox's size perfectly.

AxisStretchMode AXIS_STRETCH_MODE_TILE = 1

Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system.

AxisStretchMode AXIS_STRETCH_MODE_TILE_FIT = 2

Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. Unlike AXIS_STRETCH_MODE_TILE, the texture may be slightly stretched to make the nine-patch texture tile seamlessly.


属性说明

AxisStretchMode axis_stretch_horizontal = 0

Controls how the stylebox's texture will be stretched or tiled horizontally. See AxisStretchMode for possible values.


AxisStretchMode axis_stretch_vertical = 0

Controls how the stylebox's texture will be stretched or tiled vertically. See AxisStretchMode for possible values.


bool draw_center = true

  • void set_draw_center ( value: bool )
  • bool is_draw_center_enabled ( )

If true, the nine-patch texture's center tile will be drawn.


float expand_margin_bottom = 0.0

  • void set_expand_margin ( margin: Side, size: float )
  • float get_expand_margin ( margin: Side ) const1

Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested.


float expand_margin_left = 0.0

  • void set_expand_margin ( margin: Side, size: float )
  • float get_expand_margin ( margin: Side ) const1

Expands the left margin of this style box when drawing, causing it to be drawn larger than requested.


float expand_margin_right = 0.0

  • void set_expand_margin ( margin: Side, size: float )
  • float get_expand_margin ( margin: Side ) const1

Expands the right margin of this style box when drawing, causing it to be drawn larger than requested.


float expand_margin_top = 0.0

  • void set_expand_margin ( margin: Side, size: float )
  • float get_expand_margin ( margin: Side ) const1

Expands the top margin of this style box when drawing, causing it to be drawn larger than requested.


Color modulate_color = Color(1, 1, 1, 1)

  • void set_modulate ( value: Color )
  • Color get_modulate ( )

Modulates the color of the texture when this style box is drawn.


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

  • void set_region_rect ( value: Rect2 )
  • Rect2 get_region_rect ( )

Species a sub-region of the texture to use.

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 will be used.


Texture2D texture

The texture to use when drawing this style box.


float texture_margin_bottom = 0.0

  • void set_texture_margin ( margin: Side, size: float )
  • float get_texture_margin ( margin: Side ) const1

Increases the bottom margin of the 3×3 texture box.

A higher value means more of the source texture is considered to be part of the bottom border of the 3×3 box.

This is also the value used as fallback for StyleBox.content_margin_bottom if it is negative.


float texture_margin_left = 0.0

  • void set_texture_margin ( margin: Side, size: float )
  • float get_texture_margin ( margin: Side ) const1

Increases the left margin of the 3×3 texture box.

A higher value means more of the source texture is considered to be part of the left border of the 3×3 box.

This is also the value used as fallback for StyleBox.content_margin_left if it is negative.


float texture_margin_right = 0.0

  • void set_texture_margin ( margin: Side, size: float )
  • float get_texture_margin ( margin: Side ) const1

Increases the right margin of the 3×3 texture box.

A higher value means more of the source texture is considered to be part of the right border of the 3×3 box.

This is also the value used as fallback for StyleBox.content_margin_right if it is negative.


float texture_margin_top = 0.0

  • void set_texture_margin ( margin: Side, size: float )
  • float get_texture_margin ( margin: Side ) const1

Increases the top margin of the 3×3 texture box.

A higher value means more of the source texture is considered to be part of the top border of the 3×3 box.

This is also the value used as fallback for StyleBox.content_margin_top if it is negative.


方法说明

float get_expand_margin ( margin: Side ) const1

Returns the expand margin size of the specified Side.


float get_texture_margin ( margin: Side ) const1

Returns the margin size of the specified Side.


void set_expand_margin ( margin: Side, size: float )

Sets the expand margin to size pixels for the specified Side.


void set_expand_margin_all ( size: float )

Sets the expand margin to size pixels for all sides.


void set_texture_margin ( margin: Side, size: float )

Sets the margin to size pixels for the specified Side.


void set_texture_margin_all ( size: float )

Sets the margin to size pixels for all sides.

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。