class_texture.rst 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Texture:
  4. Texture
  5. =======
  6. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`RenderTargetTexture<class_rendertargettexture>`, :ref:`AtlasTexture<class_atlastexture>`, :ref:`ImageTexture<class_imagetexture>`, :ref:`LargeTexture<class_largetexture>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Texture for 2D and 3D.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`draw<class_Texture_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` pos, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const |
  16. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`draw_rect<class_Texture_draw_rect>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`bool<class_bool>` tile, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const |
  18. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`draw_rect_region<class_Texture_draw_rect_region>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`Rect2<class_rect2>` src_rect, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const |
  20. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_flags<class_Texture_get_flags>` **(** **)** const |
  22. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_height<class_Texture_get_height>` **(** **)** const |
  24. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`RID<class_rid>` | :ref:`get_rid<class_Texture_get_rid>` **(** **)** const |
  26. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Vector2<class_vector2>` | :ref:`get_size<class_Texture_get_size>` **(** **)** const |
  28. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_width<class_Texture_get_width>` **(** **)** const |
  30. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`has_alpha<class_Texture_has_alpha>` **(** **)** const |
  32. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_flags<class_Texture_set_flags>` **(** :ref:`int<class_int>` flags **)** |
  34. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. Numeric Constants
  36. -----------------
  37. - **FLAG_MIPMAPS** = **1** --- Generate mipmaps, to enable smooth zooming out of the texture.
  38. - **FLAG_REPEAT** = **2** --- Repeat (instead of clamp to edge).
  39. - **FLAG_FILTER** = **4** --- Turn on magnifying filter, to enable smooth zooming in of the texture.
  40. - **FLAG_VIDEO_SURFACE** = **4096** --- Texture is a video surface.
  41. - **FLAGS_DEFAULT** = **7** --- Default flags. Generate mipmaps, repeat, and filter are enabled.
  42. - **FLAG_ANISOTROPIC_FILTER** = **8**
  43. - **FLAG_CONVERT_TO_LINEAR** = **16**
  44. - **FLAG_MIRRORED_REPEAT** = **32**
  45. Description
  46. -----------
  47. A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D :ref:`Sprite<class_sprite>` or GUI :ref:`Control<class_control>`.
  48. Member Function Description
  49. ---------------------------
  50. .. _class_Texture_draw:
  51. - void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` pos, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const
  52. .. _class_Texture_draw_rect:
  53. - void **draw_rect** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`bool<class_bool>` tile, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const
  54. .. _class_Texture_draw_rect_region:
  55. - void **draw_rect_region** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`Rect2<class_rect2>` src_rect, :ref:`Color<class_color>` modulate=Color(1,1,1,1), :ref:`bool<class_bool>` transpose=false **)** const
  56. .. _class_Texture_get_flags:
  57. - :ref:`int<class_int>` **get_flags** **(** **)** const
  58. Return the current texture flags.
  59. .. _class_Texture_get_height:
  60. - :ref:`int<class_int>` **get_height** **(** **)** const
  61. Return the texture height.
  62. .. _class_Texture_get_rid:
  63. - :ref:`RID<class_rid>` **get_rid** **(** **)** const
  64. Return the texture RID as used in the :ref:`VisualServer<class_visualserver>`.
  65. .. _class_Texture_get_size:
  66. - :ref:`Vector2<class_vector2>` **get_size** **(** **)** const
  67. Return the texture size.
  68. .. _class_Texture_get_width:
  69. - :ref:`int<class_int>` **get_width** **(** **)** const
  70. Return the texture width.
  71. .. _class_Texture_has_alpha:
  72. - :ref:`bool<class_bool>` **has_alpha** **(** **)** const
  73. .. _class_Texture_set_flags:
  74. - void **set_flags** **(** :ref:`int<class_int>` flags **)**
  75. Change the texture flags.