class_texture.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Texture.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Texture:
  5. Texture
  6. =======
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`CurveTexture<class_curvetexture>`, :ref:`AtlasTexture<class_atlastexture>`, :ref:`GradientTexture<class_gradienttexture>`, :ref:`ViewportTexture<class_viewporttexture>`, :ref:`StreamTexture<class_streamtexture>`, :ref:`ImageTexture<class_imagetexture>`, :ref:`LargeTexture<class_largetexture>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Texture for 2D and 3D.
  13. Member Functions
  14. ----------------
  15. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`draw<class_Texture_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` position, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const |
  17. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | 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, :ref:`Texture<class_texture>` normal_map=null **)** const |
  19. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | 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, :ref:`Texture<class_texture>` normal_map=null, :ref:`bool<class_bool>` clip_uv=true **)** const |
  21. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Image<class_image>` | :ref:`get_data<class_Texture_get_data>` **(** **)** const |
  23. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_flags<class_Texture_get_flags>` **(** **)** const |
  25. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_height<class_Texture_get_height>` **(** **)** const |
  27. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Vector2<class_vector2>` | :ref:`get_size<class_Texture_get_size>` **(** **)** const |
  29. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_width<class_Texture_get_width>` **(** **)** const |
  31. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`has_alpha<class_Texture_has_alpha>` **(** **)** const |
  33. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_flags<class_Texture_set_flags>` **(** :ref:`int<class_int>` flags **)** |
  35. +--------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. Numeric Constants
  37. -----------------
  38. - **FLAG_MIPMAPS** = **1** --- Generate mipmaps, to enable smooth zooming out of the texture.
  39. - **FLAG_REPEAT** = **2** --- Repeat (instead of clamp to edge).
  40. - **FLAG_FILTER** = **4** --- Turn on magnifying filter, to enable smooth zooming in of the texture.
  41. - **FLAG_VIDEO_SURFACE** = **4096** --- Texture is a video surface.
  42. - **FLAGS_DEFAULT** = **7** --- Default flags. Generate mipmaps, repeat, and filter are enabled.
  43. - **FLAG_ANISOTROPIC_FILTER** = **8**
  44. - **FLAG_CONVERT_TO_LINEAR** = **16**
  45. - **FLAG_MIRRORED_REPEAT** = **32**
  46. Description
  47. -----------
  48. 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>`.
  49. Member Function Description
  50. ---------------------------
  51. .. _class_Texture_draw:
  52. - void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` position, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const
  53. .. _class_Texture_draw_rect:
  54. - 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, :ref:`Texture<class_texture>` normal_map=null **)** const
  55. .. _class_Texture_draw_rect_region:
  56. - 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, :ref:`Texture<class_texture>` normal_map=null, :ref:`bool<class_bool>` clip_uv=true **)** const
  57. .. _class_Texture_get_data:
  58. - :ref:`Image<class_image>` **get_data** **(** **)** const
  59. .. _class_Texture_get_flags:
  60. - :ref:`int<class_int>` **get_flags** **(** **)** const
  61. Return the current texture flags.
  62. .. _class_Texture_get_height:
  63. - :ref:`int<class_int>` **get_height** **(** **)** const
  64. Return the texture height.
  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.