StyleBoxTexture

    Texture-based nine-patch .

    Texture-based nine-patch StyleBox, in a way similar to . 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

    float ( Margin margin ) const
    get_margin_size ( margin ) const
    voidset_expand_margin_all ( size )
    voidset_expand_margin_individual ( size_left, float size_top, size_right, float size_bottom )
    void ( Margin margin, size )
    voidset_margin_size ( margin, float size )

    Signals

    • texture_changed ( )

    Emitted when the stylebox’s texture is changed.

    enum 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.
    • AXIS_STRETCH_MODE_TILE = 1 —- Repeats the stylebox’s texture to match the stylebox’s size according to the nine-patch system.

    Property Descriptions

    • axis_stretch_horizontal
    Default0
    Setterset_h_axis_stretch_mode(value)
    Getterget_h_axis_stretch_mode()

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


    • axis_stretch_vertical
    Default0
    Setterset_v_axis_stretch_mode(value)
    Getterget_v_axis_stretch_mode()

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


    • draw_center
    Defaulttrue
    Setterset_draw_center(value)
    Getteris_draw_center_enabled()

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


    • float expand_margin_bottom

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


    • expand_margin_left
    Default0.0
    Setterset_expand_margin_size(value)
    Getterget_expand_margin_size()

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


    • float expand_margin_right
    Default0.0
    Setterset_expand_margin_size(value)
    Getterget_expand_margin_size()

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


    • expand_margin_top
    Default0.0
    Setterset_expand_margin_size(value)
    Getterget_expand_margin_size()

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


    Default0.0
    Setterset_margin_size(value)
    Getterget_margin_size()

    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 if it is negative.


    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 if it is negative.


    Default0.0
    Setterset_margin_size(value)
    Getterget_margin_size()

    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 if it is negative.


    Default
    Setterset_margin_size(value)
    Getterget_margin_size()

    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.


    • modulate_color
    DefaultColor( 1, 1, 1, 1 )
    Setterset_modulate(value)
    Getterget_modulate()

    Setterset_normal_map(value)
    Getterget_normal_map()

    The normal map to use when drawing this style box.

    Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. See for a comparison of normal map coordinates expected by popular engines.


    Species a sub-region of the texture to use.

    This is equivalent to first wrapping the texture in an with the same region.


    Setterset_texture(value)
    Getterget_texture()

    The texture to use when drawing this style box.

    • get_expand_margin_size ( Margin margin ) const

    Returns the size of the given margin‘s expand margin. See for possible values.


    • float get_margin_size ( margin ) const

    Returns the size of the given margin. See Margin for possible values.


    • void set_expand_margin_all ( size )

    Sets the expand margin to size pixels for all margins.


    • void set_expand_margin_individual ( float size_left, size_top, float size_right, size_bottom )

    Sets the expand margin for each margin to size_left, size_top, size_right, and size_bottom pixels.


    • void set_expand_margin_size ( Margin margin, size )

    Sets the expand margin to size pixels for the given margin. See Margin for possible values.


    • void set_margin_size ( margin, float size )

    Sets the margin to pixels for the given margin. See for possible values.