class_dpitexture.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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/DPITexture.xml.
  6. .. _class_DPITexture:
  7. DPITexture
  8. ==========
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  11. An automatically scalable :ref:`Texture2D<class_Texture2D>` based on an SVG image.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. An automatically scalable :ref:`Texture2D<class_Texture2D>` based on an SVG image. **DPITexture**\ s are used to automatically re-rasterize icons and other texture based UI theme elements to match viewport scale and font oversampling. See also :ref:`ProjectSettings.display/window/stretch/mode<class_ProjectSettings_property_display/window/stretch/mode>` ("canvas_items" mode) and :ref:`Viewport.oversampling_override<class_Viewport_property_oversampling_override>`.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`base_scale<class_DPITexture_property_base_scale>` | ``1.0`` |
  23. +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
  24. | :ref:`Dictionary<class_Dictionary>` | :ref:`color_map<class_DPITexture_property_color_map>` | ``{}`` |
  25. +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  27. +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
  28. | :ref:`float<class_float>` | :ref:`saturation<class_DPITexture_property_saturation>` | ``1.0`` |
  29. +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
  30. .. rst-class:: classref-reftable-group
  31. Methods
  32. -------
  33. .. table::
  34. :widths: auto
  35. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`DPITexture<class_DPITexture>` | :ref:`create_from_string<class_DPITexture_method_create_from_string>`\ (\ source\: :ref:`String<class_String>`, scale\: :ref:`float<class_float>` = 1.0, saturation\: :ref:`float<class_float>` = 1.0, color_map\: :ref:`Dictionary<class_Dictionary>` = {}\ ) |static| |
  37. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`RID<class_RID>` | :ref:`get_scaled_rid<class_DPITexture_method_get_scaled_rid>`\ (\ ) |const| |
  39. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`String<class_String>` | :ref:`get_source<class_DPITexture_method_get_source>`\ (\ ) |const| |
  41. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`set_size_override<class_DPITexture_method_set_size_override>`\ (\ size\: :ref:`Vector2i<class_Vector2i>`\ ) |
  43. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`set_source<class_DPITexture_method_set_source>`\ (\ source\: :ref:`String<class_String>`\ ) |
  45. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Property Descriptions
  50. ---------------------
  51. .. _class_DPITexture_property_base_scale:
  52. .. rst-class:: classref-property
  53. :ref:`float<class_float>` **base_scale** = ``1.0`` :ref:`🔗<class_DPITexture_property_base_scale>`
  54. .. rst-class:: classref-property-setget
  55. - |void| **set_base_scale**\ (\ value\: :ref:`float<class_float>`\ )
  56. - :ref:`float<class_float>` **get_base_scale**\ (\ )
  57. Texture scale. ``1.0`` is the original SVG size. Higher values result in a larger image.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_DPITexture_property_color_map:
  61. .. rst-class:: classref-property
  62. :ref:`Dictionary<class_Dictionary>` **color_map** = ``{}`` :ref:`🔗<class_DPITexture_property_color_map>`
  63. .. rst-class:: classref-property-setget
  64. - |void| **set_color_map**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
  65. - :ref:`Dictionary<class_Dictionary>` **get_color_map**\ (\ )
  66. If set, remaps texture colors according to :ref:`Color<class_Color>`-:ref:`Color<class_Color>` map.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_DPITexture_property_saturation:
  70. .. rst-class:: classref-property
  71. :ref:`float<class_float>` **saturation** = ``1.0`` :ref:`🔗<class_DPITexture_property_saturation>`
  72. .. rst-class:: classref-property-setget
  73. - |void| **set_saturation**\ (\ value\: :ref:`float<class_float>`\ )
  74. - :ref:`float<class_float>` **get_saturation**\ (\ )
  75. Overrides texture saturation.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Method Descriptions
  80. -------------------
  81. .. _class_DPITexture_method_create_from_string:
  82. .. rst-class:: classref-method
  83. :ref:`DPITexture<class_DPITexture>` **create_from_string**\ (\ source\: :ref:`String<class_String>`, scale\: :ref:`float<class_float>` = 1.0, saturation\: :ref:`float<class_float>` = 1.0, color_map\: :ref:`Dictionary<class_Dictionary>` = {}\ ) |static| :ref:`🔗<class_DPITexture_method_create_from_string>`
  84. Creates a new **DPITexture** and initializes it by allocating and setting the SVG data from string.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_DPITexture_method_get_scaled_rid:
  88. .. rst-class:: classref-method
  89. :ref:`RID<class_RID>` **get_scaled_rid**\ (\ ) |const| :ref:`🔗<class_DPITexture_method_get_scaled_rid>`
  90. Returns the :ref:`RID<class_RID>` of the texture rasterized to match the oversampling of the currently drawn canvas item.
  91. .. rst-class:: classref-item-separator
  92. ----
  93. .. _class_DPITexture_method_get_source:
  94. .. rst-class:: classref-method
  95. :ref:`String<class_String>` **get_source**\ (\ ) |const| :ref:`🔗<class_DPITexture_method_get_source>`
  96. Returns SVG source code.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_DPITexture_method_set_size_override:
  100. .. rst-class:: classref-method
  101. |void| **set_size_override**\ (\ size\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_DPITexture_method_set_size_override>`
  102. Resizes the texture to the specified dimensions.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_DPITexture_method_set_source:
  106. .. rst-class:: classref-method
  107. |void| **set_source**\ (\ source\: :ref:`String<class_String>`\ ) :ref:`🔗<class_DPITexture_method_set_source>`
  108. Sets SVG source code.
  109. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  110. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  111. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  112. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  113. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  114. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  115. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  116. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  117. .. |void| replace:: :abbr:`void (No return value.)`