ImageTexture.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="ImageTexture" inherits="Texture" version="3.2">
  3. <brief_description>
  4. A [Texture] based on an [Image].
  5. </brief_description>
  6. <description>
  7. A [Texture] based on an [Image]. Can be created from an [Image] with [method create_from_image].
  8. [b]Note:[/b] The maximum image size is 16384×16384 pixels due to graphics hardware limitations. Larger images will fail to import.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="create">
  14. <return type="void">
  15. </return>
  16. <argument index="0" name="width" type="int">
  17. </argument>
  18. <argument index="1" name="height" type="int">
  19. </argument>
  20. <argument index="2" name="format" type="int" enum="Image.Format">
  21. </argument>
  22. <argument index="3" name="flags" type="int" default="7">
  23. </argument>
  24. <description>
  25. Create a new [ImageTexture] with [code]width[/code] and [code]height[/code].
  26. [code]format[/code] is a value from [enum Image.Format], [code]flags[/code] is any combination of [enum Texture.Flags].
  27. </description>
  28. </method>
  29. <method name="create_from_image">
  30. <return type="void">
  31. </return>
  32. <argument index="0" name="image" type="Image">
  33. </argument>
  34. <argument index="1" name="flags" type="int" default="7">
  35. </argument>
  36. <description>
  37. Create a new [ImageTexture] from an [Image] with [code]flags[/code] from [enum Texture.Flags]. An sRGB to linear color space conversion can take place, according to [enum Image.Format].
  38. </description>
  39. </method>
  40. <method name="get_format" qualifiers="const">
  41. <return type="int" enum="Image.Format">
  42. </return>
  43. <description>
  44. Returns the format of the [ImageTexture], one of [enum Image.Format].
  45. </description>
  46. </method>
  47. <method name="load">
  48. <return type="int" enum="Error">
  49. </return>
  50. <argument index="0" name="path" type="String">
  51. </argument>
  52. <description>
  53. Load an [ImageTexture] from a file path.
  54. </description>
  55. </method>
  56. <method name="set_data">
  57. <return type="void">
  58. </return>
  59. <argument index="0" name="image" type="Image">
  60. </argument>
  61. <description>
  62. Sets the [Image] of this [ImageTexture].
  63. </description>
  64. </method>
  65. <method name="set_size_override">
  66. <return type="void">
  67. </return>
  68. <argument index="0" name="size" type="Vector2">
  69. </argument>
  70. <description>
  71. Resizes the [ImageTexture] to the specified dimensions.
  72. </description>
  73. </method>
  74. </methods>
  75. <members>
  76. <member name="flags" type="int" setter="set_flags" getter="get_flags" override="true" default="7" />
  77. <member name="lossy_quality" type="float" setter="set_lossy_storage_quality" getter="get_lossy_storage_quality" default="0.7">
  78. The storage quality for [constant STORAGE_COMPRESS_LOSSY].
  79. </member>
  80. <member name="storage" type="int" setter="set_storage" getter="get_storage" enum="ImageTexture.Storage" default="0">
  81. The storage type (raw, lossy, or compressed).
  82. </member>
  83. </members>
  84. <constants>
  85. <constant name="STORAGE_RAW" value="0" enum="Storage">
  86. [Image] data is stored raw and unaltered.
  87. </constant>
  88. <constant name="STORAGE_COMPRESS_LOSSY" value="1" enum="Storage">
  89. [Image] data is compressed with a lossy algorithm. You can set the storage quality with [member lossy_quality].
  90. </constant>
  91. <constant name="STORAGE_COMPRESS_LOSSLESS" value="2" enum="Storage">
  92. [Image] data is compressed with a lossless algorithm.
  93. </constant>
  94. </constants>
  95. </class>