Files
godot-docs/classes/class_svgtexture.rst
2025-04-26 03:23:58 +00:00

177 lines
9.1 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/SVGTexture.xml.
.. _class_SVGTexture:
SVGTexture
==========
**Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
A scalable :ref:`Texture2D<class_Texture2D>` based on an SVG image.
.. rst-class:: classref-introduction-group
Description
-----------
A scalable :ref:`Texture2D<class_Texture2D>` based on an SVG image. **SVGTexture**\ s are automatically re-rasterized to match font oversampling.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`base_scale<class_SVGTexture_property_base_scale>` | ``1.0`` |
+-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`color_map<class_SVGTexture_property_color_map>` | ``{}`` |
+-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
+-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`saturation<class_SVGTexture_property_saturation>` | ``1.0`` |
+-------------------------------------+---------------------------------------------------------+----------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`SVGTexture<class_SVGTexture>` | :ref:`create_from_string<class_SVGTexture_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| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_source<class_SVGTexture_method_get_source>`\ (\ ) |const| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_size_override<class_SVGTexture_method_set_size_override>`\ (\ size\: :ref:`Vector2i<class_Vector2i>`\ ) |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_source<class_SVGTexture_method_set_source>`\ (\ source\: :ref:`String<class_String>`\ ) |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_SVGTexture_property_base_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **base_scale** = ``1.0`` :ref:`🔗<class_SVGTexture_property_base_scale>`
.. rst-class:: classref-property-setget
- |void| **set_base_scale**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_base_scale**\ (\ )
SVG texture scale. ``1.0`` is the original SVG size. Higher values result in a larger image.
.. rst-class:: classref-item-separator
----
.. _class_SVGTexture_property_color_map:
.. rst-class:: classref-property
:ref:`Dictionary<class_Dictionary>` **color_map** = ``{}`` :ref:`🔗<class_SVGTexture_property_color_map>`
.. rst-class:: classref-property-setget
- |void| **set_color_map**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
- :ref:`Dictionary<class_Dictionary>` **get_color_map**\ (\ )
If set, remaps SVG texture colors according to :ref:`Color<class_Color>`-:ref:`Color<class_Color>` map.
.. rst-class:: classref-item-separator
----
.. _class_SVGTexture_property_saturation:
.. rst-class:: classref-property
:ref:`float<class_float>` **saturation** = ``1.0`` :ref:`🔗<class_SVGTexture_property_saturation>`
.. rst-class:: classref-property-setget
- |void| **set_saturation**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_saturation**\ (\ )
Overrides texture saturation.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_SVGTexture_method_create_from_string:
.. rst-class:: classref-method
:ref:`SVGTexture<class_SVGTexture>` **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_SVGTexture_method_create_from_string>`
Creates a new **SVGTexture** and initializes it by allocating and setting the SVG data from string.
.. rst-class:: classref-item-separator
----
.. _class_SVGTexture_method_get_source:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_source**\ (\ ) |const| :ref:`🔗<class_SVGTexture_method_get_source>`
Returns SVG source code.
.. rst-class:: classref-item-separator
----
.. _class_SVGTexture_method_set_size_override:
.. rst-class:: classref-method
|void| **set_size_override**\ (\ size\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`🔗<class_SVGTexture_method_set_size_override>`
Resizes the texture to the specified dimensions.
.. rst-class:: classref-item-separator
----
.. _class_SVGTexture_method_set_source:
.. rst-class:: classref-method
|void| **set_source**\ (\ source\: :ref:`String<class_String>`\ ) :ref:`🔗<class_SVGTexture_method_set_source>`
Sets SVG source code.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`