class_gradienttexture2d.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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. A 2D texture that creates a pattern with colors obtained from a :ref:`Gradient<class_Gradient>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A 2D texture that obtains colors from a :ref:`Gradient<class_Gradient>` to fill the texture data. This texture is able to transform a color transition into different patterns such as a linear or a radial gradient. 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 by default, but the gradient fill can be repeated to cover the entire texture.
  15. The gradient is sampled individually for each pixel so it does not necessarily represent an exact copy of the gradient (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>`.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  22. | :ref:`Fill<enum_GradientTexture2D_Fill>` | :ref:`fill<class_GradientTexture2D_property_fill>` | ``0`` |
  23. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  24. | :ref:`Vector2<class_Vector2>` | :ref:`fill_from<class_GradientTexture2D_property_fill_from>` | ``Vector2(0, 0)`` |
  25. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`fill_to<class_GradientTexture2D_property_fill_to>` | ``Vector2(1, 0)`` |
  27. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  28. | :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_GradientTexture2D_property_gradient>` | |
  29. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`height<class_GradientTexture2D_property_height>` | ``64`` |
  31. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  32. | :ref:`Repeat<enum_GradientTexture2D_Repeat>` | :ref:`repeat<class_GradientTexture2D_property_repeat>` | ``0`` |
  33. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  35. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`use_hdr<class_GradientTexture2D_property_use_hdr>` | ``false`` |
  37. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`width<class_GradientTexture2D_property_width>` | ``64`` |
  39. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  40. .. rst-class:: classref-section-separator
  41. ----
  42. .. rst-class:: classref-descriptions-group
  43. Enumerations
  44. ------------
  45. .. _enum_GradientTexture2D_Fill:
  46. .. rst-class:: classref-enumeration
  47. enum **Fill**: :ref:`🔗<enum_GradientTexture2D_Fill>`
  48. .. _class_GradientTexture2D_constant_FILL_LINEAR:
  49. .. rst-class:: classref-enumeration-constant
  50. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_LINEAR** = ``0``
  51. The colors are linearly interpolated in a straight line.
  52. .. _class_GradientTexture2D_constant_FILL_RADIAL:
  53. .. rst-class:: classref-enumeration-constant
  54. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_RADIAL** = ``1``
  55. The colors are linearly interpolated in a circular pattern.
  56. .. _class_GradientTexture2D_constant_FILL_SQUARE:
  57. .. rst-class:: classref-enumeration-constant
  58. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_SQUARE** = ``2``
  59. The colors are linearly interpolated in a square pattern.
  60. .. rst-class:: classref-item-separator
  61. ----
  62. .. _enum_GradientTexture2D_Repeat:
  63. .. rst-class:: classref-enumeration
  64. enum **Repeat**: :ref:`🔗<enum_GradientTexture2D_Repeat>`
  65. .. _class_GradientTexture2D_constant_REPEAT_NONE:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_NONE** = ``0``
  68. 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.
  69. .. _class_GradientTexture2D_constant_REPEAT:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT** = ``1``
  72. 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.
  73. .. _class_GradientTexture2D_constant_REPEAT_MIRROR:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_MIRROR** = ``2``
  76. 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.
  77. .. rst-class:: classref-section-separator
  78. ----
  79. .. rst-class:: classref-descriptions-group
  80. Property Descriptions
  81. ---------------------
  82. .. _class_GradientTexture2D_property_fill:
  83. .. rst-class:: classref-property
  84. :ref:`Fill<enum_GradientTexture2D_Fill>` **fill** = ``0`` :ref:`🔗<class_GradientTexture2D_property_fill>`
  85. .. rst-class:: classref-property-setget
  86. - |void| **set_fill**\ (\ value\: :ref:`Fill<enum_GradientTexture2D_Fill>`\ )
  87. - :ref:`Fill<enum_GradientTexture2D_Fill>` **get_fill**\ (\ )
  88. The gradient's fill type.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_GradientTexture2D_property_fill_from:
  92. .. rst-class:: classref-property
  93. :ref:`Vector2<class_Vector2>` **fill_from** = ``Vector2(0, 0)`` :ref:`🔗<class_GradientTexture2D_property_fill_from>`
  94. .. rst-class:: classref-property-setget
  95. - |void| **set_fill_from**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  96. - :ref:`Vector2<class_Vector2>` **get_fill_from**\ (\ )
  97. The initial offset used to fill the texture specified in UV coordinates.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_GradientTexture2D_property_fill_to:
  101. .. rst-class:: classref-property
  102. :ref:`Vector2<class_Vector2>` **fill_to** = ``Vector2(1, 0)`` :ref:`🔗<class_GradientTexture2D_property_fill_to>`
  103. .. rst-class:: classref-property-setget
  104. - |void| **set_fill_to**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  105. - :ref:`Vector2<class_Vector2>` **get_fill_to**\ (\ )
  106. The final offset used to fill the texture specified in UV coordinates.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_GradientTexture2D_property_gradient:
  110. .. rst-class:: classref-property
  111. :ref:`Gradient<class_Gradient>` **gradient** :ref:`🔗<class_GradientTexture2D_property_gradient>`
  112. .. rst-class:: classref-property-setget
  113. - |void| **set_gradient**\ (\ value\: :ref:`Gradient<class_Gradient>`\ )
  114. - :ref:`Gradient<class_Gradient>` **get_gradient**\ (\ )
  115. The :ref:`Gradient<class_Gradient>` used to fill the texture.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_GradientTexture2D_property_height:
  119. .. rst-class:: classref-property
  120. :ref:`int<class_int>` **height** = ``64`` :ref:`🔗<class_GradientTexture2D_property_height>`
  121. .. rst-class:: classref-property-setget
  122. - |void| **set_height**\ (\ value\: :ref:`int<class_int>`\ )
  123. - :ref:`int<class_int>` **get_height**\ (\ )
  124. The number of vertical color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's height.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_GradientTexture2D_property_repeat:
  128. .. rst-class:: classref-property
  129. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **repeat** = ``0`` :ref:`🔗<class_GradientTexture2D_property_repeat>`
  130. .. rst-class:: classref-property-setget
  131. - |void| **set_repeat**\ (\ value\: :ref:`Repeat<enum_GradientTexture2D_Repeat>`\ )
  132. - :ref:`Repeat<enum_GradientTexture2D_Repeat>` **get_repeat**\ (\ )
  133. The gradient's repeat type.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_GradientTexture2D_property_use_hdr:
  137. .. rst-class:: classref-property
  138. :ref:`bool<class_bool>` **use_hdr** = ``false`` :ref:`🔗<class_GradientTexture2D_property_use_hdr>`
  139. .. rst-class:: classref-property-setget
  140. - |void| **set_use_hdr**\ (\ value\: :ref:`bool<class_bool>`\ )
  141. - :ref:`bool<class_bool>` **is_using_hdr**\ (\ )
  142. 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).
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_GradientTexture2D_property_width:
  146. .. rst-class:: classref-property
  147. :ref:`int<class_int>` **width** = ``64`` :ref:`🔗<class_GradientTexture2D_property_width>`
  148. .. rst-class:: classref-property-setget
  149. - |void| **set_width**\ (\ value\: :ref:`int<class_int>`\ )
  150. - :ref:`int<class_int>` **get_width**\ (\ )
  151. The number of horizontal color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's width.
  152. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  153. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  154. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  155. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  156. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  157. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  158. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  159. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  160. .. |void| replace:: :abbr:`void (No return value.)`