Files
godot-docs/classes/class_imagetexture.rst

109 lines
5.4 KiB
ReStructuredText

.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the ImageTexture.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_ImageTexture:
ImageTexture
============
**Inherits:** :ref:`Texture<class_texture>` **<** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
**Category:** Core
Brief Description
-----------------
A :ref:`Texture<class_texture>` based on an :ref:`Image<class_image>`.
Member Functions
----------------
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`create<class_ImageTexture_create>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`int<class_int>` format, :ref:`int<class_int>` flags=7 **)** |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`create_from_image<class_ImageTexture_create_from_image>` **(** :ref:`Image<class_image>` image, :ref:`int<class_int>` flags=7 **)** |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_format<class_ImageTexture_get_format>` **(** **)** const |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`load<class_ImageTexture_load>` **(** :ref:`String<class_string>` path **)** |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_data<class_ImageTexture_set_data>` **(** :ref:`Image<class_image>` image **)** |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_size_override<class_ImageTexture_set_size_override>` **(** :ref:`Vector2<class_vector2>` size **)** |
+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Member Variables
----------------
.. _class_ImageTexture_lossy_quality:
- :ref:`float<class_float>` **lossy_quality** - The storage quality for ``ImageTexture``.STORAGE_COMPRESS_LOSSY.
.. _class_ImageTexture_storage:
- :ref:`Storage<enum_imagetexture_storage>` **storage** - The storage type (raw, lossy, or compressed).
Enums
-----
.. _enum_ImageTexture_Storage:
enum **Storage**
- **STORAGE_RAW** = **0** --- :ref:`Image<class_image>` data is stored raw and unaltered.
- **STORAGE_COMPRESS_LOSSY** = **1** --- :ref:`Image<class_image>` data is compressed with a lossy algorithm. You can set the storage quality with :ref:`set_lossy_storage_quality<class_ImageTexture_set_lossy_storage_quality>`.
- **STORAGE_COMPRESS_LOSSLESS** = **2** --- :ref:`Image<class_image>` data is compressed with a lossless algorithm.
Description
-----------
A :ref:`Texture<class_texture>` based on an :ref:`Image<class_image>`. Can be created from an :ref:`Image<class_image>` with :ref:`create_from_image<class_ImageTexture_create_from_image>`.
Member Function Description
---------------------------
.. _class_ImageTexture_create:
- void **create** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`int<class_int>` format, :ref:`int<class_int>` flags=7 **)**
Create a new ``ImageTexture`` with "width" and "height".
"format" one of :ref:`Image<class_image>`.FORMAT\_\*.
"flags" one or more of :ref:`Texture<class_texture>`.FLAG\_\*.
.. _class_ImageTexture_create_from_image:
- void **create_from_image** **(** :ref:`Image<class_image>` image, :ref:`int<class_int>` flags=7 **)**
Create a new ``ImageTexture`` from an :ref:`Image<class_image>` with "flags" from :ref:`Texture<class_texture>`.FLAG\_\*.
.. _class_ImageTexture_get_format:
- :ref:`int<class_int>` **get_format** **(** **)** const
Return the format of the ``ImageTexture``, one of :ref:`Image<class_image>`.FORMAT\_\*.
.. _class_ImageTexture_load:
- void **load** **(** :ref:`String<class_string>` path **)**
Load an ``ImageTexture``.
.. _class_ImageTexture_set_data:
- void **set_data** **(** :ref:`Image<class_image>` image **)**
Set the :ref:`Image<class_image>` of this ``ImageTexture``.
.. _class_ImageTexture_set_size_override:
- void **set_size_override** **(** :ref:`Vector2<class_vector2>` size **)**
Resizes the ``ImageTexture`` to the specified dimensions.