StyleBoxTexture

Inherits: StyleBox < Resource < RefCounted < Object

A texture-based nine-patch StyleBox.

Description

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.

Properties

AxisStretchMode

axis_stretch_horizontal

0

AxisStretchMode

axis_stretch_vertical

0

bool

draw_center

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)

Texture2D

texture

float

texture_margin_bottom

0.0

float

texture_margin_left

0.0

float

texture_margin_right

0.0

float

texture_margin_top

0.0

Methods

float

get_expand_margin ( Side margin ) const

float

get_texture_margin ( Side margin ) const

void

set_expand_margin ( Side margin, float size )

void

set_expand_margin_all ( float size )

void

set_texture_margin ( Side margin, float size )

void

set_texture_margin_all ( float size )


Enumerations

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.


Property Descriptions

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 ( bool value )

  • 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 ( Side margin, float size )