2
0

Texture2D.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Texture2D" inherits="Texture" version="4.0">
  3. <brief_description>
  4. Texture for 2D and 3D.
  5. </brief_description>
  6. <description>
  7. A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite2D] or GUI [Control].
  8. Textures are often created by loading them from a file. See [method @GDScript.load].
  9. [Texture2D] is a base for other resources. It cannot be used directly.
  10. [b]Note:[/b] The maximum texture size is 16384×16384 pixels due to graphics hardware limitations. Larger textures may fail to import.
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <methods>
  15. <method name="draw" qualifiers="const">
  16. <return type="void" />
  17. <argument index="0" name="canvas_item" type="RID" />
  18. <argument index="1" name="position" type="Vector2" />
  19. <argument index="2" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
  20. <argument index="3" name="transpose" type="bool" default="false" />
  21. <description>
  22. Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code].
  23. </description>
  24. </method>
  25. <method name="draw_rect" qualifiers="const">
  26. <return type="void" />
  27. <argument index="0" name="canvas_item" type="RID" />
  28. <argument index="1" name="rect" type="Rect2" />
  29. <argument index="2" name="tile" type="bool" />
  30. <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
  31. <argument index="4" name="transpose" type="bool" default="false" />
  32. <description>
  33. Draws the texture using a [CanvasItem] with the [RenderingServer] API.
  34. </description>
  35. </method>
  36. <method name="draw_rect_region" qualifiers="const">
  37. <return type="void" />
  38. <argument index="0" name="canvas_item" type="RID" />
  39. <argument index="1" name="rect" type="Rect2" />
  40. <argument index="2" name="src_rect" type="Rect2" />
  41. <argument index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" />
  42. <argument index="4" name="transpose" type="bool" default="false" />
  43. <argument index="5" name="clip_uv" type="bool" default="true" />
  44. <description>
  45. Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
  46. </description>
  47. </method>
  48. <method name="get_height" qualifiers="const">
  49. <return type="int" />
  50. <description>
  51. Returns the texture height.
  52. </description>
  53. </method>
  54. <method name="get_image" qualifiers="const">
  55. <return type="Image" />
  56. <description>
  57. Returns an [Image] that is a copy of data from this [Texture2D]. [Image]s can be accessed and manipulated directly.
  58. </description>
  59. </method>
  60. <method name="get_size" qualifiers="const">
  61. <return type="Vector2" />
  62. <description>
  63. Returns the texture size.
  64. </description>
  65. </method>
  66. <method name="get_width" qualifiers="const">
  67. <return type="int" />
  68. <description>
  69. Returns the texture width.
  70. </description>
  71. </method>
  72. <method name="has_alpha" qualifiers="const">
  73. <return type="bool" />
  74. <description>
  75. Returns [code]true[/code] if this [Texture2D] has an alpha channel.
  76. </description>
  77. </method>
  78. </methods>
  79. </class>