class_imagetexture.rst 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ImageTexture.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ImageTexture:
  6. ImageTexture
  7. ============
  8. **Inherits:** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A :ref:`Texture<class_Texture>` based on an :ref:`Image<class_Image>`.
  13. Properties
  14. ----------
  15. +-------------------------------------------+-----------------------------------------------------------------+-----+
  16. | :ref:`float<class_float>` | :ref:`lossy_quality<class_ImageTexture_property_lossy_quality>` | 0.7 |
  17. +-------------------------------------------+-----------------------------------------------------------------+-----+
  18. | :ref:`Storage<enum_ImageTexture_Storage>` | :ref:`storage<class_ImageTexture_property_storage>` | 0 |
  19. +-------------------------------------------+-----------------------------------------------------------------+-----+
  20. Methods
  21. -------
  22. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`create<class_ImageTexture_method_create>` **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`Format<enum_Image_Format>` format, :ref:`int<class_int>` flags=7 **)** |
  24. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`create_from_image<class_ImageTexture_method_create_from_image>` **(** :ref:`Image<class_Image>` image, :ref:`int<class_int>` flags=7 **)** |
  26. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Format<enum_Image_Format>` | :ref:`get_format<class_ImageTexture_method_get_format>` **(** **)** const |
  28. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`load<class_ImageTexture_method_load>` **(** :ref:`String<class_String>` path **)** |
  30. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_data<class_ImageTexture_method_set_data>` **(** :ref:`Image<class_Image>` image **)** |
  32. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_size_override<class_ImageTexture_method_set_size_override>` **(** :ref:`Vector2<class_Vector2>` size **)** |
  34. +---------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. Enumerations
  36. ------------
  37. .. _enum_ImageTexture_Storage:
  38. .. _class_ImageTexture_constant_STORAGE_RAW:
  39. .. _class_ImageTexture_constant_STORAGE_COMPRESS_LOSSY:
  40. .. _class_ImageTexture_constant_STORAGE_COMPRESS_LOSSLESS:
  41. enum **Storage**:
  42. - **STORAGE_RAW** = **0** --- :ref:`Image<class_Image>` data is stored raw and unaltered.
  43. - **STORAGE_COMPRESS_LOSSY** = **1** --- :ref:`Image<class_Image>` data is compressed with a lossy algorithm. You can set the storage quality with :ref:`lossy_quality<class_ImageTexture_property_lossy_quality>`.
  44. - **STORAGE_COMPRESS_LOSSLESS** = **2** --- :ref:`Image<class_Image>` data is compressed with a lossless algorithm.
  45. Description
  46. -----------
  47. 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_method_create_from_image>`.
  48. Property Descriptions
  49. ---------------------
  50. .. _class_ImageTexture_property_lossy_quality:
  51. - :ref:`float<class_float>` **lossy_quality**
  52. +-----------+----------------------------------+
  53. | *Default* | 0.7 |
  54. +-----------+----------------------------------+
  55. | *Setter* | set_lossy_storage_quality(value) |
  56. +-----------+----------------------------------+
  57. | *Getter* | get_lossy_storage_quality() |
  58. +-----------+----------------------------------+
  59. The storage quality for :ref:`STORAGE_COMPRESS_LOSSY<class_ImageTexture_constant_STORAGE_COMPRESS_LOSSY>`.
  60. .. _class_ImageTexture_property_storage:
  61. - :ref:`Storage<enum_ImageTexture_Storage>` **storage**
  62. +-----------+--------------------+
  63. | *Default* | 0 |
  64. +-----------+--------------------+
  65. | *Setter* | set_storage(value) |
  66. +-----------+--------------------+
  67. | *Getter* | get_storage() |
  68. +-----------+--------------------+
  69. The storage type (raw, lossy, or compressed).
  70. Method Descriptions
  71. -------------------
  72. .. _class_ImageTexture_method_create:
  73. - void **create** **(** :ref:`int<class_int>` width, :ref:`int<class_int>` height, :ref:`Format<enum_Image_Format>` format, :ref:`int<class_int>` flags=7 **)**
  74. Create a new ``ImageTexture`` with ``width`` and ``height``.
  75. ``format`` is a value from :ref:`Format<enum_Image_Format>`, ``flags`` is any combination of :ref:`Flags<enum_Texture_Flags>`.
  76. .. _class_ImageTexture_method_create_from_image:
  77. - void **create_from_image** **(** :ref:`Image<class_Image>` image, :ref:`int<class_int>` flags=7 **)**
  78. Create a new ``ImageTexture`` from an :ref:`Image<class_Image>` with ``flags`` from :ref:`Flags<enum_Texture_Flags>`. An sRGB to linear color space conversion can take place, according to :ref:`Format<enum_Image_Format>`.
  79. .. _class_ImageTexture_method_get_format:
  80. - :ref:`Format<enum_Image_Format>` **get_format** **(** **)** const
  81. Returns the format of the ``ImageTexture``, one of :ref:`Format<enum_Image_Format>`.
  82. .. _class_ImageTexture_method_load:
  83. - :ref:`Error<enum_@GlobalScope_Error>` **load** **(** :ref:`String<class_String>` path **)**
  84. Load an ``ImageTexture`` from a file path.
  85. .. _class_ImageTexture_method_set_data:
  86. - void **set_data** **(** :ref:`Image<class_Image>` image **)**
  87. Sets the :ref:`Image<class_Image>` of this ``ImageTexture``.
  88. .. _class_ImageTexture_method_set_size_override:
  89. - void **set_size_override** **(** :ref:`Vector2<class_Vector2>` size **)**
  90. Resizes the ``ImageTexture`` to the specified dimensions.