class_imagetexture.rst 7.2 KB

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