:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/StyleBoxTexture.xml. .. _class_StyleBoxTexture: StyleBoxTexture =============== **Inherits:** :ref:`StyleBox` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` Texture-based nine-patch :ref:`StyleBox`. Description ----------- Texture-based nine-patch :ref:`StyleBox`, in a way similar to :ref:`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 ---------- +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`AxisStretchMode` | :ref:`axis_stretch_horizontal` | ``0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`AxisStretchMode` | :ref:`axis_stretch_vertical` | ``0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`bool` | :ref:`draw_center` | ``true`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`expand_margin_bottom` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`expand_margin_left` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`expand_margin_right` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`expand_margin_top` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`margin_bottom` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`margin_left` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`margin_right` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`float` | :ref:`margin_top` | ``0.0`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`Color` | :ref:`modulate_color` | ``Color( 1, 1, 1, 1 )`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`Texture` | :ref:`normal_map` | | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`Rect2` | :ref:`region_rect` | ``Rect2( 0, 0, 0, 0 )`` | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ | :ref:`Texture` | :ref:`texture` | | +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+ Methods ------- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_expand_margin_size` **(** :ref:`Margin` margin **)** |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_margin_size` **(** :ref:`Margin` margin **)** |const| | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_expand_margin_all` **(** :ref:`float` size **)** | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_expand_margin_individual` **(** :ref:`float` size_left, :ref:`float` size_top, :ref:`float` size_right, :ref:`float` size_bottom **)** | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_expand_margin_size` **(** :ref:`Margin` margin, :ref:`float` size **)** | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_margin_size` **(** :ref:`Margin` margin, :ref:`float` size **)** | +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_StyleBoxTexture_signal_texture_changed: - **texture_changed** **(** **)** Emitted when the stylebox's texture is changed. Enumerations ------------ .. _enum_StyleBoxTexture_AxisStretchMode: .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_STRETCH: .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_TILE: .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_TILE_FIT: 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. - **AXIS_STRETCH_MODE_TILE_FIT** = **2** --- Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system. Unlike :ref:`AXIS_STRETCH_MODE_TILE`, the texture may be slightly stretched to make the nine-patch texture tile seamlessly. Property Descriptions --------------------- .. _class_StyleBoxTexture_property_axis_stretch_horizontal: - :ref:`AxisStretchMode` **axis_stretch_horizontal** +-----------+--------------------------------+ | *Default* | ``0`` | +-----------+--------------------------------+ | *Setter* | set_h_axis_stretch_mode(value) | +-----------+--------------------------------+ | *Getter* | get_h_axis_stretch_mode() | +-----------+--------------------------------+ Controls how the stylebox's texture will be stretched or tiled horizontally. See :ref:`AxisStretchMode` for possible values. ---- .. _class_StyleBoxTexture_property_axis_stretch_vertical: - :ref:`AxisStretchMode` **axis_stretch_vertical** +-----------+--------------------------------+ | *Default* | ``0`` | +-----------+--------------------------------+ | *Setter* | set_v_axis_stretch_mode(value) | +-----------+--------------------------------+ | *Getter* | get_v_axis_stretch_mode() | +-----------+--------------------------------+ Controls how the stylebox's texture will be stretched or tiled vertically. See :ref:`AxisStretchMode` for possible values. ---- .. _class_StyleBoxTexture_property_draw_center: - :ref:`bool` **draw_center** +-----------+--------------------------+ | *Default* | ``true`` | +-----------+--------------------------+ | *Setter* | set_draw_center(value) | +-----------+--------------------------+ | *Getter* | is_draw_center_enabled() | +-----------+--------------------------+ If ``true``, the nine-patch texture's center tile will be drawn. ---- .. _class_StyleBoxTexture_property_expand_margin_bottom: - :ref:`float` **expand_margin_bottom** +-----------+-------------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------------+ | *Setter* | set_expand_margin_size(value) | +-----------+-------------------------------+ | *Getter* | get_expand_margin_size() | +-----------+-------------------------------+ Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested. ---- .. _class_StyleBoxTexture_property_expand_margin_left: - :ref:`float` **expand_margin_left** +-----------+-------------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------------+ | *Setter* | set_expand_margin_size(value) | +-----------+-------------------------------+ | *Getter* | get_expand_margin_size() | +-----------+-------------------------------+ Expands the left margin of this style box when drawing, causing it to be drawn larger than requested. ---- .. _class_StyleBoxTexture_property_expand_margin_right: - :ref:`float` **expand_margin_right** +-----------+-------------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------------+ | *Setter* | set_expand_margin_size(value) | +-----------+-------------------------------+ | *Getter* | get_expand_margin_size() | +-----------+-------------------------------+ Expands the right margin of this style box when drawing, causing it to be drawn larger than requested. ---- .. _class_StyleBoxTexture_property_expand_margin_top: - :ref:`float` **expand_margin_top** +-----------+-------------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------------+ | *Setter* | set_expand_margin_size(value) | +-----------+-------------------------------+ | *Getter* | get_expand_margin_size() | +-----------+-------------------------------+ Expands the top margin of this style box when drawing, causing it to be drawn larger than requested. ---- .. _class_StyleBoxTexture_property_margin_bottom: - :ref:`float` **margin_bottom** +-----------+------------------------+ | *Default* | ``0.0`` | +-----------+------------------------+ | *Setter* | set_margin_size(value) | +-----------+------------------------+ | *Getter* | get_margin_size() | +-----------+------------------------+ 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 :ref:`StyleBox.content_margin_bottom` if it is negative. ---- .. _class_StyleBoxTexture_property_margin_left: - :ref:`float` **margin_left** +-----------+------------------------+ | *Default* | ``0.0`` | +-----------+------------------------+ | *Setter* | set_margin_size(value) | +-----------+------------------------+ | *Getter* | get_margin_size() | +-----------+------------------------+ 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 :ref:`StyleBox.content_margin_left` if it is negative. ---- .. _class_StyleBoxTexture_property_margin_right: - :ref:`float` **margin_right** +-----------+------------------------+ | *Default* | ``0.0`` | +-----------+------------------------+ | *Setter* | set_margin_size(value) | +-----------+------------------------+ | *Getter* | get_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 :ref:`StyleBox.content_margin_right` if it is negative. ---- .. _class_StyleBoxTexture_property_margin_top: - :ref:`float` **margin_top** +-----------+------------------------+ | *Default* | ``0.0`` | +-----------+------------------------+ | *Setter* | set_margin_size(value) | +-----------+------------------------+ | *Getter* | get_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 :ref:`StyleBox.content_margin_top` if it is negative. ---- .. _class_StyleBoxTexture_property_modulate_color: - :ref:`Color` **modulate_color** +-----------+-------------------------+ | *Default* | ``Color( 1, 1, 1, 1 )`` | +-----------+-------------------------+ | *Setter* | set_modulate(value) | +-----------+-------------------------+ | *Getter* | get_modulate() | +-----------+-------------------------+ Modulates the color of the texture when this style box is drawn. ---- .. _class_StyleBoxTexture_property_normal_map: - :ref:`Texture` **normal_map** +----------+-----------------------+ | *Setter* | set_normal_map(value) | +----------+-----------------------+ | *Getter* | get_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 `this page `__ for a comparison of normal map coordinates expected by popular engines. ---- .. _class_StyleBoxTexture_property_region_rect: - :ref:`Rect2` **region_rect** +-----------+-------------------------+ | *Default* | ``Rect2( 0, 0, 0, 0 )`` | +-----------+-------------------------+ | *Setter* | set_region_rect(value) | +-----------+-------------------------+ | *Getter* | get_region_rect() | +-----------+-------------------------+ Species a sub-region of the texture to use. This is equivalent to first wrapping the texture in an :ref:`AtlasTexture` with the same region. ---- .. _class_StyleBoxTexture_property_texture: - :ref:`Texture` **texture** +----------+--------------------+ | *Setter* | set_texture(value) | +----------+--------------------+ | *Getter* | get_texture() | +----------+--------------------+ The texture to use when drawing this style box. Method Descriptions ------------------- .. _class_StyleBoxTexture_method_get_expand_margin_size: - :ref:`float` **get_expand_margin_size** **(** :ref:`Margin` margin **)** |const| Returns the size of the given ``margin``'s expand margin. See :ref:`Margin` for possible values. ---- .. _class_StyleBoxTexture_method_get_margin_size: - :ref:`float` **get_margin_size** **(** :ref:`Margin` margin **)** |const| Returns the size of the given ``margin``. See :ref:`Margin` for possible values. ---- .. _class_StyleBoxTexture_method_set_expand_margin_all: - void **set_expand_margin_all** **(** :ref:`float` size **)** Sets the expand margin to ``size`` pixels for all margins. ---- .. _class_StyleBoxTexture_method_set_expand_margin_individual: - void **set_expand_margin_individual** **(** :ref:`float` size_left, :ref:`float` size_top, :ref:`float` size_right, :ref:`float` size_bottom **)** Sets the expand margin for each margin to ``size_left``, ``size_top``, ``size_right``, and ``size_bottom`` pixels. ---- .. _class_StyleBoxTexture_method_set_expand_margin_size: - void **set_expand_margin_size** **(** :ref:`Margin` margin, :ref:`float` size **)** Sets the expand margin to ``size`` pixels for the given ``margin``. See :ref:`Margin` for possible values. ---- .. _class_StyleBoxTexture_method_set_margin_size: - void **set_margin_size** **(** :ref:`Margin` margin, :ref:`float` size **)** Sets the margin to ``size`` pixels for the given ``margin``. See :ref:`Margin` for possible values. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`