class_styleboxtexture.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the StyleBoxTexture.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_StyleBoxTexture:
  6. StyleBoxTexture
  7. ===============
  8. **Inherits:** :ref:`StyleBox<class_StyleBox>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Texture-based nine-patch :ref:`StyleBox<class_StyleBox>`.
  10. Description
  11. -----------
  12. Texture-based nine-patch :ref:`StyleBox<class_StyleBox>`, in a way similar to :ref:`NinePatchRect<class_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.
  13. Properties
  14. ----------
  15. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  16. | :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` | :ref:`axis_stretch_horizontal<class_StyleBoxTexture_property_axis_stretch_horizontal>` | ``0`` |
  17. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  18. | :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` | :ref:`axis_stretch_vertical<class_StyleBoxTexture_property_axis_stretch_vertical>` | ``0`` |
  19. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`draw_center<class_StyleBoxTexture_property_draw_center>` | ``true`` |
  21. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  22. | :ref:`float<class_float>` | :ref:`expand_margin_bottom<class_StyleBoxTexture_property_expand_margin_bottom>` | ``0.0`` |
  23. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  24. | :ref:`float<class_float>` | :ref:`expand_margin_left<class_StyleBoxTexture_property_expand_margin_left>` | ``0.0`` |
  25. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  26. | :ref:`float<class_float>` | :ref:`expand_margin_right<class_StyleBoxTexture_property_expand_margin_right>` | ``0.0`` |
  27. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  28. | :ref:`float<class_float>` | :ref:`expand_margin_top<class_StyleBoxTexture_property_expand_margin_top>` | ``0.0`` |
  29. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  30. | :ref:`float<class_float>` | :ref:`margin_bottom<class_StyleBoxTexture_property_margin_bottom>` | ``0.0`` |
  31. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  32. | :ref:`float<class_float>` | :ref:`margin_left<class_StyleBoxTexture_property_margin_left>` | ``0.0`` |
  33. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  34. | :ref:`float<class_float>` | :ref:`margin_right<class_StyleBoxTexture_property_margin_right>` | ``0.0`` |
  35. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  36. | :ref:`float<class_float>` | :ref:`margin_top<class_StyleBoxTexture_property_margin_top>` | ``0.0`` |
  37. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  38. | :ref:`Color<class_Color>` | :ref:`modulate_color<class_StyleBoxTexture_property_modulate_color>` | ``Color( 1, 1, 1, 1 )`` |
  39. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  40. | :ref:`Texture<class_Texture>` | :ref:`normal_map<class_StyleBoxTexture_property_normal_map>` | |
  41. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  42. | :ref:`Rect2<class_Rect2>` | :ref:`region_rect<class_StyleBoxTexture_property_region_rect>` | ``Rect2( 0, 0, 0, 0 )`` |
  43. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  44. | :ref:`Texture<class_Texture>` | :ref:`texture<class_StyleBoxTexture_property_texture>` | |
  45. +--------------------------------------------------------------+----------------------------------------------------------------------------------------+-------------------------+
  46. Methods
  47. -------
  48. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`float<class_float>` | :ref:`get_expand_margin_size<class_StyleBoxTexture_method_get_expand_margin_size>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
  50. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`float<class_float>` | :ref:`get_margin_size<class_StyleBoxTexture_method_get_margin_size>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const| |
  52. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`set_expand_margin_all<class_StyleBoxTexture_method_set_expand_margin_all>` **(** :ref:`float<class_float>` size **)** |
  54. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`set_expand_margin_individual<class_StyleBoxTexture_method_set_expand_margin_individual>` **(** :ref:`float<class_float>` size_left, :ref:`float<class_float>` size_top, :ref:`float<class_float>` size_right, :ref:`float<class_float>` size_bottom **)** |
  56. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`set_expand_margin_size<class_StyleBoxTexture_method_set_expand_margin_size>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` size **)** |
  58. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`set_margin_size<class_StyleBoxTexture_method_set_margin_size>` **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` size **)** |
  60. +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. Signals
  62. -------
  63. .. _class_StyleBoxTexture_signal_texture_changed:
  64. - **texture_changed** **(** **)**
  65. Emitted when the stylebox's texture is changed.
  66. Enumerations
  67. ------------
  68. .. _enum_StyleBoxTexture_AxisStretchMode:
  69. .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_STRETCH:
  70. .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_TILE:
  71. .. _class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_TILE_FIT:
  72. enum **AxisStretchMode**:
  73. - **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.
  74. - **AXIS_STRETCH_MODE_TILE** = **1** --- Repeats the stylebox's texture to match the stylebox's size according to the nine-patch system.
  75. - **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<class_StyleBoxTexture_constant_AXIS_STRETCH_MODE_TILE>`, the texture may be slightly stretched to make the nine-patch texture tile seamlessly.
  76. Property Descriptions
  77. ---------------------
  78. .. _class_StyleBoxTexture_property_axis_stretch_horizontal:
  79. - :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` **axis_stretch_horizontal**
  80. +-----------+--------------------------------+
  81. | *Default* | ``0`` |
  82. +-----------+--------------------------------+
  83. | *Setter* | set_h_axis_stretch_mode(value) |
  84. +-----------+--------------------------------+
  85. | *Getter* | get_h_axis_stretch_mode() |
  86. +-----------+--------------------------------+
  87. Controls how the stylebox's texture will be stretched or tiled horizontally. See :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` for possible values.
  88. ----
  89. .. _class_StyleBoxTexture_property_axis_stretch_vertical:
  90. - :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` **axis_stretch_vertical**
  91. +-----------+--------------------------------+
  92. | *Default* | ``0`` |
  93. +-----------+--------------------------------+
  94. | *Setter* | set_v_axis_stretch_mode(value) |
  95. +-----------+--------------------------------+
  96. | *Getter* | get_v_axis_stretch_mode() |
  97. +-----------+--------------------------------+
  98. Controls how the stylebox's texture will be stretched or tiled vertically. See :ref:`AxisStretchMode<enum_StyleBoxTexture_AxisStretchMode>` for possible values.
  99. ----
  100. .. _class_StyleBoxTexture_property_draw_center:
  101. - :ref:`bool<class_bool>` **draw_center**
  102. +-----------+--------------------------+
  103. | *Default* | ``true`` |
  104. +-----------+--------------------------+
  105. | *Setter* | set_draw_center(value) |
  106. +-----------+--------------------------+
  107. | *Getter* | is_draw_center_enabled() |
  108. +-----------+--------------------------+
  109. If ``true``, the nine-patch texture's center tile will be drawn.
  110. ----
  111. .. _class_StyleBoxTexture_property_expand_margin_bottom:
  112. - :ref:`float<class_float>` **expand_margin_bottom**
  113. +-----------+-------------------------------+
  114. | *Default* | ``0.0`` |
  115. +-----------+-------------------------------+
  116. | *Setter* | set_expand_margin_size(value) |
  117. +-----------+-------------------------------+
  118. | *Getter* | get_expand_margin_size() |
  119. +-----------+-------------------------------+
  120. Expands the bottom margin of this style box when drawing, causing it to be drawn larger than requested.
  121. ----
  122. .. _class_StyleBoxTexture_property_expand_margin_left:
  123. - :ref:`float<class_float>` **expand_margin_left**
  124. +-----------+-------------------------------+
  125. | *Default* | ``0.0`` |
  126. +-----------+-------------------------------+
  127. | *Setter* | set_expand_margin_size(value) |
  128. +-----------+-------------------------------+
  129. | *Getter* | get_expand_margin_size() |
  130. +-----------+-------------------------------+
  131. Expands the left margin of this style box when drawing, causing it to be drawn larger than requested.
  132. ----
  133. .. _class_StyleBoxTexture_property_expand_margin_right:
  134. - :ref:`float<class_float>` **expand_margin_right**
  135. +-----------+-------------------------------+
  136. | *Default* | ``0.0`` |
  137. +-----------+-------------------------------+
  138. | *Setter* | set_expand_margin_size(value) |
  139. +-----------+-------------------------------+
  140. | *Getter* | get_expand_margin_size() |
  141. +-----------+-------------------------------+
  142. Expands the right margin of this style box when drawing, causing it to be drawn larger than requested.
  143. ----
  144. .. _class_StyleBoxTexture_property_expand_margin_top:
  145. - :ref:`float<class_float>` **expand_margin_top**
  146. +-----------+-------------------------------+
  147. | *Default* | ``0.0`` |
  148. +-----------+-------------------------------+
  149. | *Setter* | set_expand_margin_size(value) |
  150. +-----------+-------------------------------+
  151. | *Getter* | get_expand_margin_size() |
  152. +-----------+-------------------------------+
  153. Expands the top margin of this style box when drawing, causing it to be drawn larger than requested.
  154. ----
  155. .. _class_StyleBoxTexture_property_margin_bottom:
  156. - :ref:`float<class_float>` **margin_bottom**
  157. +-----------+------------------------+
  158. | *Default* | ``0.0`` |
  159. +-----------+------------------------+
  160. | *Setter* | set_margin_size(value) |
  161. +-----------+------------------------+
  162. | *Getter* | get_margin_size() |
  163. +-----------+------------------------+
  164. Increases the bottom margin of the 3×3 texture box.
  165. A higher value means more of the source texture is considered to be part of the bottom border of the 3×3 box.
  166. This is also the value used as fallback for :ref:`StyleBox.content_margin_bottom<class_StyleBox_property_content_margin_bottom>` if it is negative.
  167. ----
  168. .. _class_StyleBoxTexture_property_margin_left:
  169. - :ref:`float<class_float>` **margin_left**
  170. +-----------+------------------------+
  171. | *Default* | ``0.0`` |
  172. +-----------+------------------------+
  173. | *Setter* | set_margin_size(value) |
  174. +-----------+------------------------+
  175. | *Getter* | get_margin_size() |
  176. +-----------+------------------------+
  177. Increases the left margin of the 3×3 texture box.
  178. A higher value means more of the source texture is considered to be part of the left border of the 3×3 box.
  179. This is also the value used as fallback for :ref:`StyleBox.content_margin_left<class_StyleBox_property_content_margin_left>` if it is negative.
  180. ----
  181. .. _class_StyleBoxTexture_property_margin_right:
  182. - :ref:`float<class_float>` **margin_right**
  183. +-----------+------------------------+
  184. | *Default* | ``0.0`` |
  185. +-----------+------------------------+
  186. | *Setter* | set_margin_size(value) |
  187. +-----------+------------------------+
  188. | *Getter* | get_margin_size() |
  189. +-----------+------------------------+
  190. Increases the right margin of the 3×3 texture box.
  191. A higher value means more of the source texture is considered to be part of the right border of the 3×3 box.
  192. This is also the value used as fallback for :ref:`StyleBox.content_margin_right<class_StyleBox_property_content_margin_right>` if it is negative.
  193. ----
  194. .. _class_StyleBoxTexture_property_margin_top:
  195. - :ref:`float<class_float>` **margin_top**
  196. +-----------+------------------------+
  197. | *Default* | ``0.0`` |
  198. +-----------+------------------------+
  199. | *Setter* | set_margin_size(value) |
  200. +-----------+------------------------+
  201. | *Getter* | get_margin_size() |
  202. +-----------+------------------------+
  203. Increases the top margin of the 3×3 texture box.
  204. A higher value means more of the source texture is considered to be part of the top border of the 3×3 box.
  205. This is also the value used as fallback for :ref:`StyleBox.content_margin_top<class_StyleBox_property_content_margin_top>` if it is negative.
  206. ----
  207. .. _class_StyleBoxTexture_property_modulate_color:
  208. - :ref:`Color<class_Color>` **modulate_color**
  209. +-----------+-------------------------+
  210. | *Default* | ``Color( 1, 1, 1, 1 )`` |
  211. +-----------+-------------------------+
  212. | *Setter* | set_modulate(value) |
  213. +-----------+-------------------------+
  214. | *Getter* | get_modulate() |
  215. +-----------+-------------------------+
  216. Modulates the color of the texture when this style box is drawn.
  217. ----
  218. .. _class_StyleBoxTexture_property_normal_map:
  219. - :ref:`Texture<class_Texture>` **normal_map**
  220. +----------+-----------------------+
  221. | *Setter* | set_normal_map(value) |
  222. +----------+-----------------------+
  223. | *Getter* | get_normal_map() |
  224. +----------+-----------------------+
  225. The normal map to use when drawing this style box.
  226. **Note:** Godot expects the normal map to use X+, Y-, and Z+ coordinates. See `this page <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates>`__ for a comparison of normal map coordinates expected by popular engines.
  227. ----
  228. .. _class_StyleBoxTexture_property_region_rect:
  229. - :ref:`Rect2<class_Rect2>` **region_rect**
  230. +-----------+-------------------------+
  231. | *Default* | ``Rect2( 0, 0, 0, 0 )`` |
  232. +-----------+-------------------------+
  233. | *Setter* | set_region_rect(value) |
  234. +-----------+-------------------------+
  235. | *Getter* | get_region_rect() |
  236. +-----------+-------------------------+
  237. Species a sub-region of the texture to use.
  238. This is equivalent to first wrapping the texture in an :ref:`AtlasTexture<class_AtlasTexture>` with the same region.
  239. ----
  240. .. _class_StyleBoxTexture_property_texture:
  241. - :ref:`Texture<class_Texture>` **texture**
  242. +----------+--------------------+
  243. | *Setter* | set_texture(value) |
  244. +----------+--------------------+
  245. | *Getter* | get_texture() |
  246. +----------+--------------------+
  247. The texture to use when drawing this style box.
  248. Method Descriptions
  249. -------------------
  250. .. _class_StyleBoxTexture_method_get_expand_margin_size:
  251. - :ref:`float<class_float>` **get_expand_margin_size** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  252. Returns the size of the given ``margin``'s expand margin. See :ref:`Margin<enum_@GlobalScope_Margin>` for possible values.
  253. ----
  254. .. _class_StyleBoxTexture_method_get_margin_size:
  255. - :ref:`float<class_float>` **get_margin_size** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin **)** |const|
  256. Returns the size of the given ``margin``. See :ref:`Margin<enum_@GlobalScope_Margin>` for possible values.
  257. ----
  258. .. _class_StyleBoxTexture_method_set_expand_margin_all:
  259. - void **set_expand_margin_all** **(** :ref:`float<class_float>` size **)**
  260. Sets the expand margin to ``size`` pixels for all margins.
  261. ----
  262. .. _class_StyleBoxTexture_method_set_expand_margin_individual:
  263. - void **set_expand_margin_individual** **(** :ref:`float<class_float>` size_left, :ref:`float<class_float>` size_top, :ref:`float<class_float>` size_right, :ref:`float<class_float>` size_bottom **)**
  264. Sets the expand margin for each margin to ``size_left``, ``size_top``, ``size_right``, and ``size_bottom`` pixels.
  265. ----
  266. .. _class_StyleBoxTexture_method_set_expand_margin_size:
  267. - void **set_expand_margin_size** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` size **)**
  268. Sets the expand margin to ``size`` pixels for the given ``margin``. See :ref:`Margin<enum_@GlobalScope_Margin>` for possible values.
  269. ----
  270. .. _class_StyleBoxTexture_method_set_margin_size:
  271. - void **set_margin_size** **(** :ref:`Margin<enum_@GlobalScope_Margin>` margin, :ref:`float<class_float>` size **)**
  272. Sets the margin to ``size`` pixels for the given ``margin``. See :ref:`Margin<enum_@GlobalScope_Margin>` for possible values.
  273. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  274. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  275. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`