class_gradienttexture2d.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.1/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.1/doc/classes/GradientTexture2D.xml.
  6. .. _class_GradientTexture2D:
  7. GradientTexture2D
  8. =================
  9. **Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Gradient-filled 2D texture.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The texture uses a :ref:`Gradient<class_Gradient>` to fill the texture data in 2D space. The gradient is filled according to the specified :ref:`fill<class_GradientTexture2D_property_fill>` and :ref:`repeat<class_GradientTexture2D_property_repeat>` types using colors obtained from the gradient. The texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see :ref:`width<class_GradientTexture2D_property_width>` and :ref:`height<class_GradientTexture2D_property_height>`). See also :ref:`GradientTexture1D<class_GradientTexture1D>`, :ref:`CurveTexture<class_CurveTexture>` and :ref:`CurveXYZTexture<class_CurveXYZTexture>`.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  21. | :ref:`Fill<enum_GradientTexture2D_Fill>` | :ref:`fill<class_GradientTexture2D_property_fill>` | ``0`` |
  22. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  23. | :ref:`Vector2<class_Vector2>` | :ref:`fill_from<class_GradientTexture2D_property_fill_from>` | ``Vector2(0, 0)`` |
  24. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`fill_to<class_GradientTexture2D_property_fill_to>` | ``Vector2(1, 0)`` |
  26. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  27. | :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_GradientTexture2D_property_gradient>` | |
  28. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`height<class_GradientTexture2D_property_height>` | ``64`` |
  30. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  31. | :ref:`Repeat<enum_GradientTexture2D_Repeat>` | :ref:`repeat<class_GradientTexture2D_property_repeat>` | ``0`` |
  32. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  34. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`use_hdr<class_GradientTexture2D_property_use_hdr>` | ``false`` |
  36. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`width<class_GradientTexture2D_property_width>` | ``64`` |
  38. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Enumerations
  43. ------------
  44. .. _enum_GradientTexture2D_Fill:
  45. .. rst-class:: classref-enumeration
  46. enum **Fill**:
  47. .. _class_GradientTexture2D_constant_FILL_LINEAR:
  48. .. rst-class:: classref-enumeration-constant
  49. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_LINEAR** = ``0``
  50. The colors are linearly interpolated in a straight line.
  51. .. _class_GradientTexture2D_constant_FILL_RADIAL:
  52. .. rst-class:: classref-enumeration-constant
  53. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_RADIAL** = ``1``
  54. The colors are linearly interpolated in a circular pattern.
  55. .. _class_GradientTexture2D_constant_FILL_SQUARE:
  56. .. rst-class:: classref-enumeration-constant
  57. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_SQUARE** = ``2``
  58. The colors are linearly interpolated in a square pattern.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _enum_GradientTexture2D_Repeat:
  62. .. rst-class:: classref-enumeration
  63. enum **Repeat**:
  64. .. _class_GradientTexture2D_constant_REPEAT_NONE:
  65. .. rst-class:: classref-enumeration-constant
  66. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_NONE** = ``0``
  67. The gradient fill is restricted to the range defined by :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets.
  68. .. _class_GradientTexture2D_constant_REPEAT:
  69. .. rst-class:: classref-enumeration-constant
  70. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT** = ``1``
  71. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets, repeating the same pattern in both directions.
  72. .. _class_GradientTexture2D_constant_REPEAT_MIRROR:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_MIRROR** = ``2``
  75. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets, mirroring the pattern in both directions.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_GradientTexture2D_property_fill:
  82. .. rst-class:: classref-property
  83. :ref:`Fill<enum_GradientTexture2D_Fill>` **fill** = ``0``
  84. .. rst-class:: classref-property-setget
  85. - void **set_fill** **(** :ref:`Fill<enum_GradientTexture2D_Fill>` value **)**
  86. - :ref:`Fill<enum_GradientTexture2D_Fill>` **get_fill** **(** **)**
  87. The gradient fill type, one of the :ref:`Fill<enum_GradientTexture2D_Fill>` values. The texture is filled by interpolating colors starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_GradientTexture2D_property_fill_from:
  91. .. rst-class:: classref-property
  92. :ref:`Vector2<class_Vector2>` **fill_from** = ``Vector2(0, 0)``
  93. .. rst-class:: classref-property-setget
  94. - void **set_fill_from** **(** :ref:`Vector2<class_Vector2>` value **)**
  95. - :ref:`Vector2<class_Vector2>` **get_fill_from** **(** **)**
  96. The initial offset used to fill the texture specified in UV coordinates.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_GradientTexture2D_property_fill_to:
  100. .. rst-class:: classref-property
  101. :ref:`Vector2<class_Vector2>` **fill_to** = ``Vector2(1, 0)``
  102. .. rst-class:: classref-property-setget
  103. - void **set_fill_to** **(** :ref:`Vector2<class_Vector2>` value **)**
  104. - :ref:`Vector2<class_Vector2>` **get_fill_to** **(** **)**
  105. The final offset used to fill the texture specified in UV coordinates.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_GradientTexture2D_property_gradient:
  109. .. rst-class:: classref-property
  110. :ref:`Gradient<class_Gradient>` **gradient**
  111. .. rst-class:: classref-property-setget
  112. - void **set_gradient** **(** :ref:`Gradient<class_Gradient>` value **)**
  113. - :ref:`Gradient<class_Gradient>` **get_gradient** **(** **)**
  114. The :ref:`Gradient<class_Gradient>` used to fill the texture.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_GradientTexture2D_property_height:
  118. .. rst-class:: classref-property
  119. :ref:`int<class_int>` **height** = ``64``
  120. .. rst-class:: classref-property-setget
  121. - void **set_height** **(** :ref:`int<class_int>` value **)**
  122. - :ref:`int<class_int>` **get_height** **(** **)**
  123. The number of vertical color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's height.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_GradientTexture2D_property_repeat:
  127. .. rst-class:: classref-property
  128. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **repeat** = ``0``
  129. .. rst-class:: classref-property-setget
  130. - void **set_repeat** **(** :ref:`Repeat<enum_GradientTexture2D_Repeat>` value **)**
  131. - :ref:`Repeat<enum_GradientTexture2D_Repeat>` **get_repeat** **(** **)**
  132. The gradient repeat type, one of the :ref:`Repeat<enum_GradientTexture2D_Repeat>` values. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets by default, but the gradient fill can be repeated to cover the entire texture.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_GradientTexture2D_property_use_hdr:
  136. .. rst-class:: classref-property
  137. :ref:`bool<class_bool>` **use_hdr** = ``false``
  138. .. rst-class:: classref-property-setget
  139. - void **set_use_hdr** **(** :ref:`bool<class_bool>` value **)**
  140. - :ref:`bool<class_bool>` **is_using_hdr** **(** **)**
  141. If ``true``, the generated texture will support high dynamic range (:ref:`Image.FORMAT_RGBAF<class_Image_constant_FORMAT_RGBAF>` format). This allows for glow effects to work if :ref:`Environment.glow_enabled<class_Environment_property_glow_enabled>` is ``true``. If ``false``, the generated texture will use low dynamic range; overbright colors will be clamped (:ref:`Image.FORMAT_RGBA8<class_Image_constant_FORMAT_RGBA8>` format).
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_GradientTexture2D_property_width:
  145. .. rst-class:: classref-property
  146. :ref:`int<class_int>` **width** = ``64``
  147. .. rst-class:: classref-property-setget
  148. - void **set_width** **(** :ref:`int<class_int>` value **)**
  149. - :ref:`int<class_int>` **get_width** **(** **)**
  150. The number of horizontal color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's width.
  151. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  152. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  153. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  154. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  155. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  156. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  157. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`