:github_url: hide .. _class_DPITexture: DPITexture ========== **Experimental:** This class may be changed or removed in future versions. **Hereda:** :ref:`Texture2D` **<** :ref:`Texture` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` An automatically scalable :ref:`Texture2D` based on an SVG image. .. rst-class:: classref-introduction-group Descripción ---------------------- An automatically scalable :ref:`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` ("canvas_items" mode) and :ref:`Viewport.oversampling_override`. .. rst-class:: classref-reftable-group Propiedades ---------------------- .. table:: :widths: auto +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`base_scale` | ``1.0`` | +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`color_map` | ``{}`` | +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+ | :ref:`bool` | resource_local_to_scene | ``false`` (overrides :ref:`Resource`) | +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`saturation` | ``1.0`` | +-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Métodos -------------- .. table:: :widths: auto +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`DPITexture` | :ref:`create_from_string`\ (\ source\: :ref:`String`, scale\: :ref:`float` = 1.0, saturation\: :ref:`float` = 1.0, color_map\: :ref:`Dictionary` = {}\ ) |static| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_scaled_rid`\ (\ ) |const| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_source`\ (\ ) |const| | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_size_override`\ (\ size\: :ref:`Vector2i`\ ) | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_source`\ (\ source\: :ref:`String`\ ) | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descripciones de Propiedades -------------------------------------------------------- .. _class_DPITexture_property_base_scale: .. rst-class:: classref-property :ref:`float` **base_scale** = ``1.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_base_scale**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_base_scale**\ (\ ) Texture scale. ``1.0`` is the original SVG size. Higher values result in a larger image. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_property_color_map: .. rst-class:: classref-property :ref:`Dictionary` **color_map** = ``{}`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_color_map**\ (\ value\: :ref:`Dictionary`\ ) - :ref:`Dictionary` **get_color_map**\ (\ ) If set, remaps texture colors according to :ref:`Color`-:ref:`Color` map. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_property_saturation: .. rst-class:: classref-property :ref:`float` **saturation** = ``1.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_saturation**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_saturation**\ (\ ) Overrides texture saturation. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Descripciones de Métodos ------------------------------------------------ .. _class_DPITexture_method_create_from_string: .. rst-class:: classref-method :ref:`DPITexture` **create_from_string**\ (\ source\: :ref:`String`, scale\: :ref:`float` = 1.0, saturation\: :ref:`float` = 1.0, color_map\: :ref:`Dictionary` = {}\ ) |static| :ref:`🔗` Creates a new **DPITexture** and initializes it by allocating and setting the SVG data to ``source``. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_method_get_scaled_rid: .. rst-class:: classref-method :ref:`RID` **get_scaled_rid**\ (\ ) |const| :ref:`🔗` Returns the :ref:`RID` of the texture rasterized to match the oversampling of the currently drawn canvas item. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_method_get_source: .. rst-class:: classref-method :ref:`String` **get_source**\ (\ ) |const| :ref:`🔗` Returns this SVG texture's source code. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_method_set_size_override: .. rst-class:: classref-method |void| **set_size_override**\ (\ size\: :ref:`Vector2i`\ ) :ref:`🔗` Redimensiona la :ref:`ImageTexture` a las dimensiones especificadas. .. rst-class:: classref-item-separator ---- .. _class_DPITexture_method_set_source: .. rst-class:: classref-method |void| **set_source**\ (\ source\: :ref:`String`\ ) :ref:`🔗` Sets this SVG texture's source code. .. |virtual| replace:: :abbr:`virtual (Normalmente, este método debería ser sobreescrito por el usuario para que tenga algún efecto.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (Este método no tiene efectos secundarios. No modifica ninguna de las variables miembro de la instancia.)` .. |vararg| replace:: :abbr:`vararg (Este método permite agregar cualquier número de argumentos después de los descritos aquí.)` .. |constructor| replace:: :abbr:`constructor (Este método se utiliza para construir un tipo.)` .. |static| replace:: :abbr:`static (Este método no necesita una instancia para ser llamado, por lo que puede llamarse directamente utilizando el nombre de la clase.)` .. |operator| replace:: :abbr:`operator (Este método describe un operador válido para usar con este tipo como operando izquierdo.)` .. |bitfield| replace:: :abbr:`BitField (Este valor es un entero compuesto como una máscara de bits de las siguientes banderas.)` .. |void| replace:: :abbr:`void (Sin valor de retorno.)`