class_canvasitem.rst 177 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CanvasItem.xml.
  6. .. _class_CanvasItem:
  7. CanvasItem
  8. ==========
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`Control<class_Control>`, :ref:`Node2D<class_Node2D>`
  11. Abstract base class for everything in 2D space.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Abstract base class for everything in 2D space. Canvas items are laid out in a tree; children inherit and extend their parent's transform. **CanvasItem** is extended by :ref:`Control<class_Control>` for GUI-related nodes, and by :ref:`Node2D<class_Node2D>` for 2D game objects.
  16. Any **CanvasItem** can draw. For this, :ref:`queue_redraw()<class_CanvasItem_method_queue_redraw>` is called by the engine, then :ref:`NOTIFICATION_DRAW<class_CanvasItem_constant_NOTIFICATION_DRAW>` will be received on idle time to request a redraw. Because of this, canvas items don't need to be redrawn on every frame, improving the performance significantly. Several functions for drawing on the **CanvasItem** are provided (see ``draw_*`` functions). However, they can only be used inside :ref:`_draw()<class_CanvasItem_private_method__draw>`, its corresponding :ref:`Object._notification()<class_Object_private_method__notification>` or methods connected to the :ref:`draw<class_CanvasItem_signal_draw>` signal.
  17. Canvas items are drawn in tree order on their canvas layer. By default, children are on top of their parents, so a root **CanvasItem** will be drawn behind everything. This behavior can be changed on a per-item basis.
  18. A **CanvasItem** can be hidden, which will also hide its children. By adjusting various other properties of a **CanvasItem**, you can also modulate its color (via :ref:`modulate<class_CanvasItem_property_modulate>` or :ref:`self_modulate<class_CanvasItem_property_self_modulate>`), change its Z-index, blend mode, and more.
  19. Note that properties like transform, modulation, and visibility are only propagated to *direct* **CanvasItem** child nodes. If there is a non-**CanvasItem** node in between, like :ref:`Node<class_Node>` or :ref:`AnimationPlayer<class_AnimationPlayer>`, the **CanvasItem** nodes below will have an independent position and :ref:`modulate<class_CanvasItem_property_modulate>` chain. See also :ref:`top_level<class_CanvasItem_property_top_level>`.
  20. .. rst-class:: classref-introduction-group
  21. Tutorials
  22. ---------
  23. - :doc:`Viewport and canvas transforms <../tutorials/2d/2d_transforms>`
  24. - :doc:`Custom drawing in 2D <../tutorials/2d/custom_drawing_in_2d>`
  25. - `Audio Spectrum Visualizer Demo <https://godotengine.org/asset-library/asset/2762>`__
  26. .. rst-class:: classref-reftable-group
  27. Properties
  28. ----------
  29. .. table::
  30. :widths: auto
  31. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  32. | :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` | :ref:`clip_children<class_CanvasItem_property_clip_children>` | ``0`` |
  33. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  34. | :ref:`int<class_int>` | :ref:`light_mask<class_CanvasItem_property_light_mask>` | ``1`` |
  35. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  36. | :ref:`Material<class_Material>` | :ref:`material<class_CanvasItem_property_material>` | |
  37. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  38. | :ref:`Color<class_Color>` | :ref:`modulate<class_CanvasItem_property_modulate>` | ``Color(1, 1, 1, 1)`` |
  39. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  40. | :ref:`Color<class_Color>` | :ref:`self_modulate<class_CanvasItem_property_self_modulate>` | ``Color(1, 1, 1, 1)`` |
  41. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  42. | :ref:`bool<class_bool>` | :ref:`show_behind_parent<class_CanvasItem_property_show_behind_parent>` | ``false`` |
  43. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  44. | :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` | :ref:`texture_filter<class_CanvasItem_property_texture_filter>` | ``0`` |
  45. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  46. | :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` | :ref:`texture_repeat<class_CanvasItem_property_texture_repeat>` | ``0`` |
  47. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  48. | :ref:`bool<class_bool>` | :ref:`top_level<class_CanvasItem_property_top_level>` | ``false`` |
  49. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  50. | :ref:`bool<class_bool>` | :ref:`use_parent_material<class_CanvasItem_property_use_parent_material>` | ``false`` |
  51. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  52. | :ref:`int<class_int>` | :ref:`visibility_layer<class_CanvasItem_property_visibility_layer>` | ``1`` |
  53. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  54. | :ref:`bool<class_bool>` | :ref:`visible<class_CanvasItem_property_visible>` | ``true`` |
  55. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  56. | :ref:`bool<class_bool>` | :ref:`y_sort_enabled<class_CanvasItem_property_y_sort_enabled>` | ``false`` |
  57. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  58. | :ref:`bool<class_bool>` | :ref:`z_as_relative<class_CanvasItem_property_z_as_relative>` | ``true`` |
  59. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  60. | :ref:`int<class_int>` | :ref:`z_index<class_CanvasItem_property_z_index>` | ``0`` |
  61. +-----------------------------------------------------------+---------------------------------------------------------------------------+-----------------------+
  62. .. rst-class:: classref-reftable-group
  63. Methods
  64. -------
  65. .. table::
  66. :widths: auto
  67. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | |void| | :ref:`_draw<class_CanvasItem_private_method__draw>`\ (\ ) |virtual| |
  69. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | |void| | :ref:`draw_animation_slice<class_CanvasItem_method_draw_animation_slice>`\ (\ animation_length\: :ref:`float<class_float>`, slice_begin\: :ref:`float<class_float>`, slice_end\: :ref:`float<class_float>`, offset\: :ref:`float<class_float>` = 0.0\ ) |
  71. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | |void| | :ref:`draw_arc<class_CanvasItem_method_draw_arc>`\ (\ center\: :ref:`Vector2<class_Vector2>`, radius\: :ref:`float<class_float>`, start_angle\: :ref:`float<class_float>`, end_angle\: :ref:`float<class_float>`, point_count\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  73. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | |void| | :ref:`draw_char<class_CanvasItem_method_draw_char>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`String<class_String>`, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  75. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | |void| | :ref:`draw_char_outline<class_CanvasItem_method_draw_char_outline>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`String<class_String>`, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  77. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | |void| | :ref:`draw_circle<class_CanvasItem_method_draw_circle>`\ (\ position\: :ref:`Vector2<class_Vector2>`, radius\: :ref:`float<class_float>`, color\: :ref:`Color<class_Color>`, filled\: :ref:`bool<class_bool>` = true, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  79. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | |void| | :ref:`draw_colored_polygon<class_CanvasItem_method_draw_colored_polygon>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>` = PackedVector2Array(), texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) |
  81. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | |void| | :ref:`draw_dashed_line<class_CanvasItem_method_draw_dashed_line>`\ (\ from\: :ref:`Vector2<class_Vector2>`, to\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, dash\: :ref:`float<class_float>` = 2.0, aligned\: :ref:`bool<class_bool>` = true, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  83. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | |void| | :ref:`draw_end_animation<class_CanvasItem_method_draw_end_animation>`\ (\ ) |
  85. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | |void| | :ref:`draw_lcd_texture_rect_region<class_CanvasItem_method_draw_lcd_texture_rect_region>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |
  87. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | |void| | :ref:`draw_line<class_CanvasItem_method_draw_line>`\ (\ from\: :ref:`Vector2<class_Vector2>`, to\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  89. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | |void| | :ref:`draw_mesh<class_CanvasItem_method_draw_mesh>`\ (\ mesh\: :ref:`Mesh<class_Mesh>`, texture\: :ref:`Texture2D<class_Texture2D>`, transform\: :ref:`Transform2D<class_Transform2D>` = Transform2D(1, 0, 0, 1, 0, 0), modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |
  91. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | |void| | :ref:`draw_msdf_texture_rect_region<class_CanvasItem_method_draw_msdf_texture_rect_region>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), outline\: :ref:`float<class_float>` = 0.0, pixel_range\: :ref:`float<class_float>` = 4.0, scale\: :ref:`float<class_float>` = 1.0\ ) |
  93. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | |void| | :ref:`draw_multiline<class_CanvasItem_method_draw_multiline>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  95. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | |void| | :ref:`draw_multiline_colors<class_CanvasItem_method_draw_multiline_colors>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  97. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | |void| | :ref:`draw_multiline_string<class_CanvasItem_method_draw_multiline_string>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
  99. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | |void| | :ref:`draw_multiline_string_outline<class_CanvasItem_method_draw_multiline_string_outline>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
  101. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | |void| | :ref:`draw_multimesh<class_CanvasItem_method_draw_multimesh>`\ (\ multimesh\: :ref:`MultiMesh<class_MultiMesh>`, texture\: :ref:`Texture2D<class_Texture2D>`\ ) |
  103. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | |void| | :ref:`draw_polygon<class_CanvasItem_method_draw_polygon>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>` = PackedVector2Array(), texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) |
  105. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | |void| | :ref:`draw_polyline<class_CanvasItem_method_draw_polyline>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  107. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | |void| | :ref:`draw_polyline_colors<class_CanvasItem_method_draw_polyline_colors>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  109. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | |void| | :ref:`draw_primitive<class_CanvasItem_method_draw_primitive>`\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>`, texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) |
  111. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | |void| | :ref:`draw_rect<class_CanvasItem_method_draw_rect>`\ (\ rect\: :ref:`Rect2<class_Rect2>`, color\: :ref:`Color<class_Color>`, filled\: :ref:`bool<class_bool>` = true, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) |
  113. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | |void| | :ref:`draw_set_transform<class_CanvasItem_method_draw_set_transform>`\ (\ position\: :ref:`Vector2<class_Vector2>`, rotation\: :ref:`float<class_float>` = 0.0, scale\: :ref:`Vector2<class_Vector2>` = Vector2(1, 1)\ ) |
  115. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | |void| | :ref:`draw_set_transform_matrix<class_CanvasItem_method_draw_set_transform_matrix>`\ (\ xform\: :ref:`Transform2D<class_Transform2D>`\ ) |
  117. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | |void| | :ref:`draw_string<class_CanvasItem_method_draw_string>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
  119. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | |void| | :ref:`draw_string_outline<class_CanvasItem_method_draw_string_outline>`\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| |
  121. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | |void| | :ref:`draw_style_box<class_CanvasItem_method_draw_style_box>`\ (\ style_box\: :ref:`StyleBox<class_StyleBox>`, rect\: :ref:`Rect2<class_Rect2>`\ ) |
  123. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | |void| | :ref:`draw_texture<class_CanvasItem_method_draw_texture>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, position\: :ref:`Vector2<class_Vector2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |
  125. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | |void| | :ref:`draw_texture_rect<class_CanvasItem_method_draw_texture_rect>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, tile\: :ref:`bool<class_bool>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), transpose\: :ref:`bool<class_bool>` = false\ ) |
  127. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | |void| | :ref:`draw_texture_rect_region<class_CanvasItem_method_draw_texture_rect_region>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), transpose\: :ref:`bool<class_bool>` = false, clip_uv\: :ref:`bool<class_bool>` = true\ ) |
  129. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | |void| | :ref:`force_update_transform<class_CanvasItem_method_force_update_transform>`\ (\ ) |
  131. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`RID<class_RID>` | :ref:`get_canvas<class_CanvasItem_method_get_canvas>`\ (\ ) |const| |
  133. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`RID<class_RID>` | :ref:`get_canvas_item<class_CanvasItem_method_get_canvas_item>`\ (\ ) |const| |
  135. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`CanvasLayer<class_CanvasLayer>` | :ref:`get_canvas_layer_node<class_CanvasItem_method_get_canvas_layer_node>`\ (\ ) |const| |
  137. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_canvas_transform<class_CanvasItem_method_get_canvas_transform>`\ (\ ) |const| |
  139. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`Vector2<class_Vector2>` | :ref:`get_global_mouse_position<class_CanvasItem_method_get_global_mouse_position>`\ (\ ) |const| |
  141. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_global_transform<class_CanvasItem_method_get_global_transform>`\ (\ ) |const| |
  143. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_global_transform_with_canvas<class_CanvasItem_method_get_global_transform_with_canvas>`\ (\ ) |const| |
  145. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`Variant<class_Variant>` | :ref:`get_instance_shader_parameter<class_CanvasItem_method_get_instance_shader_parameter>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
  147. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`Vector2<class_Vector2>` | :ref:`get_local_mouse_position<class_CanvasItem_method_get_local_mouse_position>`\ (\ ) |const| |
  149. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_screen_transform<class_CanvasItem_method_get_screen_transform>`\ (\ ) |const| |
  151. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_transform<class_CanvasItem_method_get_transform>`\ (\ ) |const| |
  153. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | :ref:`Rect2<class_Rect2>` | :ref:`get_viewport_rect<class_CanvasItem_method_get_viewport_rect>`\ (\ ) |const| |
  155. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_viewport_transform<class_CanvasItem_method_get_viewport_transform>`\ (\ ) |const| |
  157. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :ref:`bool<class_bool>` | :ref:`get_visibility_layer_bit<class_CanvasItem_method_get_visibility_layer_bit>`\ (\ layer\: :ref:`int<class_int>`\ ) |const| |
  159. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | :ref:`World2D<class_World2D>` | :ref:`get_world_2d<class_CanvasItem_method_get_world_2d>`\ (\ ) |const| |
  161. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | |void| | :ref:`hide<class_CanvasItem_method_hide>`\ (\ ) |
  163. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | :ref:`bool<class_bool>` | :ref:`is_local_transform_notification_enabled<class_CanvasItem_method_is_local_transform_notification_enabled>`\ (\ ) |const| |
  165. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | :ref:`bool<class_bool>` | :ref:`is_transform_notification_enabled<class_CanvasItem_method_is_transform_notification_enabled>`\ (\ ) |const| |
  167. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | :ref:`bool<class_bool>` | :ref:`is_visible_in_tree<class_CanvasItem_method_is_visible_in_tree>`\ (\ ) |const| |
  169. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | :ref:`Vector2<class_Vector2>` | :ref:`make_canvas_position_local<class_CanvasItem_method_make_canvas_position_local>`\ (\ viewport_point\: :ref:`Vector2<class_Vector2>`\ ) |const| |
  171. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | :ref:`InputEvent<class_InputEvent>` | :ref:`make_input_local<class_CanvasItem_method_make_input_local>`\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) |const| |
  173. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | |void| | :ref:`move_to_front<class_CanvasItem_method_move_to_front>`\ (\ ) |
  175. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | |void| | :ref:`queue_redraw<class_CanvasItem_method_queue_redraw>`\ (\ ) |
  177. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | |void| | :ref:`set_instance_shader_parameter<class_CanvasItem_method_set_instance_shader_parameter>`\ (\ name\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) |
  179. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | |void| | :ref:`set_notify_local_transform<class_CanvasItem_method_set_notify_local_transform>`\ (\ enable\: :ref:`bool<class_bool>`\ ) |
  181. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | |void| | :ref:`set_notify_transform<class_CanvasItem_method_set_notify_transform>`\ (\ enable\: :ref:`bool<class_bool>`\ ) |
  183. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | |void| | :ref:`set_visibility_layer_bit<class_CanvasItem_method_set_visibility_layer_bit>`\ (\ layer\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) |
  185. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | |void| | :ref:`show<class_CanvasItem_method_show>`\ (\ ) |
  187. +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. .. rst-class:: classref-section-separator
  189. ----
  190. .. rst-class:: classref-descriptions-group
  191. Signals
  192. -------
  193. .. _class_CanvasItem_signal_draw:
  194. .. rst-class:: classref-signal
  195. **draw**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_signal_draw>`
  196. Emitted when the **CanvasItem** must redraw, *after* the related :ref:`NOTIFICATION_DRAW<class_CanvasItem_constant_NOTIFICATION_DRAW>` notification, and *before* :ref:`_draw()<class_CanvasItem_private_method__draw>` is called.
  197. \ **Note:** Deferred connections do not allow drawing through the ``draw_*`` methods.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_CanvasItem_signal_hidden:
  201. .. rst-class:: classref-signal
  202. **hidden**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_signal_hidden>`
  203. Emitted when the **CanvasItem** is hidden, i.e. it's no longer visible in the tree (see :ref:`is_visible_in_tree()<class_CanvasItem_method_is_visible_in_tree>`).
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_CanvasItem_signal_item_rect_changed:
  207. .. rst-class:: classref-signal
  208. **item_rect_changed**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_signal_item_rect_changed>`
  209. Emitted when the **CanvasItem**'s boundaries (position or size) change, or when an action took place that may have affected these boundaries (e.g. changing :ref:`Sprite2D.texture<class_Sprite2D_property_texture>`).
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_CanvasItem_signal_visibility_changed:
  213. .. rst-class:: classref-signal
  214. **visibility_changed**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_signal_visibility_changed>`
  215. Emitted when the **CanvasItem**'s visibility changes, either because its own :ref:`visible<class_CanvasItem_property_visible>` property changed or because its visibility in the tree changed (see :ref:`is_visible_in_tree()<class_CanvasItem_method_is_visible_in_tree>`).
  216. .. rst-class:: classref-section-separator
  217. ----
  218. .. rst-class:: classref-descriptions-group
  219. Enumerations
  220. ------------
  221. .. _enum_CanvasItem_TextureFilter:
  222. .. rst-class:: classref-enumeration
  223. enum **TextureFilter**: :ref:`๐Ÿ”—<enum_CanvasItem_TextureFilter>`
  224. .. _class_CanvasItem_constant_TEXTURE_FILTER_PARENT_NODE:
  225. .. rst-class:: classref-enumeration-constant
  226. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_PARENT_NODE** = ``0``
  227. The **CanvasItem** will inherit the filter from its parent.
  228. .. _class_CanvasItem_constant_TEXTURE_FILTER_NEAREST:
  229. .. rst-class:: classref-enumeration-constant
  230. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_NEAREST** = ``1``
  231. The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled).
  232. .. _class_CanvasItem_constant_TEXTURE_FILTER_LINEAR:
  233. .. rst-class:: classref-enumeration-constant
  234. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_LINEAR** = ``2``
  235. The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled).
  236. .. _class_CanvasItem_constant_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
  237. .. rst-class:: classref-enumeration-constant
  238. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_NEAREST_WITH_MIPMAPS** = ``3``
  239. The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``). This makes the texture look pixelated from up close, and smooth from a distance.
  240. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to :ref:`Camera2D<class_Camera2D>` zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.
  241. .. _class_CanvasItem_constant_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
  242. .. rst-class:: classref-enumeration-constant
  243. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_LINEAR_WITH_MIPMAPS** = ``4``
  244. The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``). This makes the texture look smooth from up close, and smooth from a distance.
  245. Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to :ref:`Camera2D<class_Camera2D>` zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.
  246. .. _class_CanvasItem_constant_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC:
  247. .. rst-class:: classref-enumeration-constant
  248. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC** = ``5``
  249. The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``) based on the angle between the surface and the camera view. This makes the texture look pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting :ref:`ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level<class_ProjectSettings_property_rendering/textures/default_filters/anisotropic_filtering_level>`.
  250. \ **Note:** This texture filter is rarely useful in 2D projects. :ref:`TEXTURE_FILTER_NEAREST_WITH_MIPMAPS<class_CanvasItem_constant_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS>` is usually more appropriate in this case.
  251. .. _class_CanvasItem_constant_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC:
  252. .. rst-class:: classref-enumeration-constant
  253. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC** = ``6``
  254. The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses the nearest mipmap if :ref:`ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter<class_ProjectSettings_property_rendering/textures/default_filters/use_nearest_mipmap_filter>` is ``true``) based on the angle between the surface and the camera view. This makes the texture look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture quality on surfaces that are almost in line with the camera, but is slightly slower. The anisotropic filtering level can be changed by adjusting :ref:`ProjectSettings.rendering/textures/default_filters/anisotropic_filtering_level<class_ProjectSettings_property_rendering/textures/default_filters/anisotropic_filtering_level>`.
  255. \ **Note:** This texture filter is rarely useful in 2D projects. :ref:`TEXTURE_FILTER_LINEAR_WITH_MIPMAPS<class_CanvasItem_constant_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS>` is usually more appropriate in this case.
  256. .. _class_CanvasItem_constant_TEXTURE_FILTER_MAX:
  257. .. rst-class:: classref-enumeration-constant
  258. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **TEXTURE_FILTER_MAX** = ``7``
  259. Represents the size of the :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` enum.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _enum_CanvasItem_TextureRepeat:
  263. .. rst-class:: classref-enumeration
  264. enum **TextureRepeat**: :ref:`๐Ÿ”—<enum_CanvasItem_TextureRepeat>`
  265. .. _class_CanvasItem_constant_TEXTURE_REPEAT_PARENT_NODE:
  266. .. rst-class:: classref-enumeration-constant
  267. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **TEXTURE_REPEAT_PARENT_NODE** = ``0``
  268. The **CanvasItem** will inherit the filter from its parent.
  269. .. _class_CanvasItem_constant_TEXTURE_REPEAT_DISABLED:
  270. .. rst-class:: classref-enumeration-constant
  271. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **TEXTURE_REPEAT_DISABLED** = ``1``
  272. Texture will not repeat.
  273. .. _class_CanvasItem_constant_TEXTURE_REPEAT_ENABLED:
  274. .. rst-class:: classref-enumeration-constant
  275. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **TEXTURE_REPEAT_ENABLED** = ``2``
  276. Texture will repeat normally.
  277. .. _class_CanvasItem_constant_TEXTURE_REPEAT_MIRROR:
  278. .. rst-class:: classref-enumeration-constant
  279. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **TEXTURE_REPEAT_MIRROR** = ``3``
  280. Texture will repeat in a 2ร—2 tiled mode, where elements at even positions are mirrored.
  281. .. _class_CanvasItem_constant_TEXTURE_REPEAT_MAX:
  282. .. rst-class:: classref-enumeration-constant
  283. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **TEXTURE_REPEAT_MAX** = ``4``
  284. Represents the size of the :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` enum.
  285. .. rst-class:: classref-item-separator
  286. ----
  287. .. _enum_CanvasItem_ClipChildrenMode:
  288. .. rst-class:: classref-enumeration
  289. enum **ClipChildrenMode**: :ref:`๐Ÿ”—<enum_CanvasItem_ClipChildrenMode>`
  290. .. _class_CanvasItem_constant_CLIP_CHILDREN_DISABLED:
  291. .. rst-class:: classref-enumeration-constant
  292. :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **CLIP_CHILDREN_DISABLED** = ``0``
  293. Child draws over parent and is not clipped.
  294. .. _class_CanvasItem_constant_CLIP_CHILDREN_ONLY:
  295. .. rst-class:: classref-enumeration-constant
  296. :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **CLIP_CHILDREN_ONLY** = ``1``
  297. Parent is used for the purposes of clipping only. Child is clipped to the parent's visible area, parent is not drawn.
  298. .. _class_CanvasItem_constant_CLIP_CHILDREN_AND_DRAW:
  299. .. rst-class:: classref-enumeration-constant
  300. :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **CLIP_CHILDREN_AND_DRAW** = ``2``
  301. Parent is used for clipping child, but parent is also drawn underneath child as normal before clipping child to its visible area.
  302. .. _class_CanvasItem_constant_CLIP_CHILDREN_MAX:
  303. .. rst-class:: classref-enumeration-constant
  304. :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **CLIP_CHILDREN_MAX** = ``3``
  305. Represents the size of the :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` enum.
  306. .. rst-class:: classref-section-separator
  307. ----
  308. .. rst-class:: classref-descriptions-group
  309. Constants
  310. ---------
  311. .. _class_CanvasItem_constant_NOTIFICATION_TRANSFORM_CHANGED:
  312. .. rst-class:: classref-constant
  313. **NOTIFICATION_TRANSFORM_CHANGED** = ``2000`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_TRANSFORM_CHANGED>`
  314. The **CanvasItem**'s global transform has changed. This notification is only received if enabled by :ref:`set_notify_transform()<class_CanvasItem_method_set_notify_transform>`.
  315. .. _class_CanvasItem_constant_NOTIFICATION_LOCAL_TRANSFORM_CHANGED:
  316. .. rst-class:: classref-constant
  317. **NOTIFICATION_LOCAL_TRANSFORM_CHANGED** = ``35`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_LOCAL_TRANSFORM_CHANGED>`
  318. The **CanvasItem**'s local transform has changed. This notification is only received if enabled by :ref:`set_notify_local_transform()<class_CanvasItem_method_set_notify_local_transform>`.
  319. .. _class_CanvasItem_constant_NOTIFICATION_DRAW:
  320. .. rst-class:: classref-constant
  321. **NOTIFICATION_DRAW** = ``30`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_DRAW>`
  322. The **CanvasItem** is requested to draw (see :ref:`_draw()<class_CanvasItem_private_method__draw>`).
  323. .. _class_CanvasItem_constant_NOTIFICATION_VISIBILITY_CHANGED:
  324. .. rst-class:: classref-constant
  325. **NOTIFICATION_VISIBILITY_CHANGED** = ``31`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_VISIBILITY_CHANGED>`
  326. The **CanvasItem**'s visibility has changed.
  327. .. _class_CanvasItem_constant_NOTIFICATION_ENTER_CANVAS:
  328. .. rst-class:: classref-constant
  329. **NOTIFICATION_ENTER_CANVAS** = ``32`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_ENTER_CANVAS>`
  330. The **CanvasItem** has entered the canvas.
  331. .. _class_CanvasItem_constant_NOTIFICATION_EXIT_CANVAS:
  332. .. rst-class:: classref-constant
  333. **NOTIFICATION_EXIT_CANVAS** = ``33`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_EXIT_CANVAS>`
  334. The **CanvasItem** has exited the canvas.
  335. .. _class_CanvasItem_constant_NOTIFICATION_WORLD_2D_CHANGED:
  336. .. rst-class:: classref-constant
  337. **NOTIFICATION_WORLD_2D_CHANGED** = ``36`` :ref:`๐Ÿ”—<class_CanvasItem_constant_NOTIFICATION_WORLD_2D_CHANGED>`
  338. The **CanvasItem**'s active :ref:`World2D<class_World2D>` changed.
  339. .. rst-class:: classref-section-separator
  340. ----
  341. .. rst-class:: classref-descriptions-group
  342. Property Descriptions
  343. ---------------------
  344. .. _class_CanvasItem_property_clip_children:
  345. .. rst-class:: classref-property
  346. :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **clip_children** = ``0`` :ref:`๐Ÿ”—<class_CanvasItem_property_clip_children>`
  347. .. rst-class:: classref-property-setget
  348. - |void| **set_clip_children_mode**\ (\ value\: :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>`\ )
  349. - :ref:`ClipChildrenMode<enum_CanvasItem_ClipChildrenMode>` **get_clip_children_mode**\ (\ )
  350. Allows the current node to clip child nodes, essentially acting as a mask.
  351. \ **Note:** Clipping nodes cannot be nested or placed within :ref:`CanvasGroup<class_CanvasGroup>`\ s. If an ancestor of this node clips its children or is a :ref:`CanvasGroup<class_CanvasGroup>`, then this node's clip mode should be set to :ref:`CLIP_CHILDREN_DISABLED<class_CanvasItem_constant_CLIP_CHILDREN_DISABLED>` to avoid unexpected behavior.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_CanvasItem_property_light_mask:
  355. .. rst-class:: classref-property
  356. :ref:`int<class_int>` **light_mask** = ``1`` :ref:`๐Ÿ”—<class_CanvasItem_property_light_mask>`
  357. .. rst-class:: classref-property-setget
  358. - |void| **set_light_mask**\ (\ value\: :ref:`int<class_int>`\ )
  359. - :ref:`int<class_int>` **get_light_mask**\ (\ )
  360. The rendering layers in which this **CanvasItem** responds to :ref:`Light2D<class_Light2D>` nodes.
  361. .. rst-class:: classref-item-separator
  362. ----
  363. .. _class_CanvasItem_property_material:
  364. .. rst-class:: classref-property
  365. :ref:`Material<class_Material>` **material** :ref:`๐Ÿ”—<class_CanvasItem_property_material>`
  366. .. rst-class:: classref-property-setget
  367. - |void| **set_material**\ (\ value\: :ref:`Material<class_Material>`\ )
  368. - :ref:`Material<class_Material>` **get_material**\ (\ )
  369. The material applied to this **CanvasItem**.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_CanvasItem_property_modulate:
  373. .. rst-class:: classref-property
  374. :ref:`Color<class_Color>` **modulate** = ``Color(1, 1, 1, 1)`` :ref:`๐Ÿ”—<class_CanvasItem_property_modulate>`
  375. .. rst-class:: classref-property-setget
  376. - |void| **set_modulate**\ (\ value\: :ref:`Color<class_Color>`\ )
  377. - :ref:`Color<class_Color>` **get_modulate**\ (\ )
  378. The color applied to this **CanvasItem**. This property does affect child **CanvasItem**\ s, unlike :ref:`self_modulate<class_CanvasItem_property_self_modulate>` which only affects the node itself.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_CanvasItem_property_self_modulate:
  382. .. rst-class:: classref-property
  383. :ref:`Color<class_Color>` **self_modulate** = ``Color(1, 1, 1, 1)`` :ref:`๐Ÿ”—<class_CanvasItem_property_self_modulate>`
  384. .. rst-class:: classref-property-setget
  385. - |void| **set_self_modulate**\ (\ value\: :ref:`Color<class_Color>`\ )
  386. - :ref:`Color<class_Color>` **get_self_modulate**\ (\ )
  387. The color applied to this **CanvasItem**. This property does **not** affect child **CanvasItem**\ s, unlike :ref:`modulate<class_CanvasItem_property_modulate>` which affects both the node itself and its children.
  388. \ **Note:** Internal children (e.g. sliders in :ref:`ColorPicker<class_ColorPicker>` or tab bar in :ref:`TabContainer<class_TabContainer>`) are also not affected by this property (see ``include_internal`` parameter of :ref:`Node.get_child()<class_Node_method_get_child>` and other similar methods).
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_CanvasItem_property_show_behind_parent:
  392. .. rst-class:: classref-property
  393. :ref:`bool<class_bool>` **show_behind_parent** = ``false`` :ref:`๐Ÿ”—<class_CanvasItem_property_show_behind_parent>`
  394. .. rst-class:: classref-property-setget
  395. - |void| **set_draw_behind_parent**\ (\ value\: :ref:`bool<class_bool>`\ )
  396. - :ref:`bool<class_bool>` **is_draw_behind_parent_enabled**\ (\ )
  397. If ``true``, the object draws behind its parent.
  398. .. rst-class:: classref-item-separator
  399. ----
  400. .. _class_CanvasItem_property_texture_filter:
  401. .. rst-class:: classref-property
  402. :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **texture_filter** = ``0`` :ref:`๐Ÿ”—<class_CanvasItem_property_texture_filter>`
  403. .. rst-class:: classref-property-setget
  404. - |void| **set_texture_filter**\ (\ value\: :ref:`TextureFilter<enum_CanvasItem_TextureFilter>`\ )
  405. - :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **get_texture_filter**\ (\ )
  406. The texture filtering mode to use on this **CanvasItem**.
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_CanvasItem_property_texture_repeat:
  410. .. rst-class:: classref-property
  411. :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **texture_repeat** = ``0`` :ref:`๐Ÿ”—<class_CanvasItem_property_texture_repeat>`
  412. .. rst-class:: classref-property-setget
  413. - |void| **set_texture_repeat**\ (\ value\: :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>`\ )
  414. - :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **get_texture_repeat**\ (\ )
  415. The texture repeating mode to use on this **CanvasItem**.
  416. .. rst-class:: classref-item-separator
  417. ----
  418. .. _class_CanvasItem_property_top_level:
  419. .. rst-class:: classref-property
  420. :ref:`bool<class_bool>` **top_level** = ``false`` :ref:`๐Ÿ”—<class_CanvasItem_property_top_level>`
  421. .. rst-class:: classref-property-setget
  422. - |void| **set_as_top_level**\ (\ value\: :ref:`bool<class_bool>`\ )
  423. - :ref:`bool<class_bool>` **is_set_as_top_level**\ (\ )
  424. If ``true``, this **CanvasItem** will *not* inherit its transform from parent **CanvasItem**\ s. Its draw order will also be changed to make it draw on top of other **CanvasItem**\ s that do not have :ref:`top_level<class_CanvasItem_property_top_level>` set to ``true``. The **CanvasItem** will effectively act as if it was placed as a child of a bare :ref:`Node<class_Node>`.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_CanvasItem_property_use_parent_material:
  428. .. rst-class:: classref-property
  429. :ref:`bool<class_bool>` **use_parent_material** = ``false`` :ref:`๐Ÿ”—<class_CanvasItem_property_use_parent_material>`
  430. .. rst-class:: classref-property-setget
  431. - |void| **set_use_parent_material**\ (\ value\: :ref:`bool<class_bool>`\ )
  432. - :ref:`bool<class_bool>` **get_use_parent_material**\ (\ )
  433. If ``true``, the parent **CanvasItem**'s :ref:`material<class_CanvasItem_property_material>` property is used as this one's material.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_CanvasItem_property_visibility_layer:
  437. .. rst-class:: classref-property
  438. :ref:`int<class_int>` **visibility_layer** = ``1`` :ref:`๐Ÿ”—<class_CanvasItem_property_visibility_layer>`
  439. .. rst-class:: classref-property-setget
  440. - |void| **set_visibility_layer**\ (\ value\: :ref:`int<class_int>`\ )
  441. - :ref:`int<class_int>` **get_visibility_layer**\ (\ )
  442. The rendering layer in which this **CanvasItem** is rendered by :ref:`Viewport<class_Viewport>` nodes. A :ref:`Viewport<class_Viewport>` will render a **CanvasItem** if it and all its parents share a layer with the :ref:`Viewport<class_Viewport>`'s canvas cull mask.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_CanvasItem_property_visible:
  446. .. rst-class:: classref-property
  447. :ref:`bool<class_bool>` **visible** = ``true`` :ref:`๐Ÿ”—<class_CanvasItem_property_visible>`
  448. .. rst-class:: classref-property-setget
  449. - |void| **set_visible**\ (\ value\: :ref:`bool<class_bool>`\ )
  450. - :ref:`bool<class_bool>` **is_visible**\ (\ )
  451. If ``true``, this **CanvasItem** may be drawn. Whether this **CanvasItem** is actually drawn depends on the visibility of all of its **CanvasItem** ancestors. In other words: this **CanvasItem** will be drawn when :ref:`is_visible_in_tree()<class_CanvasItem_method_is_visible_in_tree>` returns ``true`` and all **CanvasItem** ancestors share at least one :ref:`visibility_layer<class_CanvasItem_property_visibility_layer>` with this **CanvasItem**.
  452. \ **Note:** For controls that inherit :ref:`Popup<class_Popup>`, the correct way to make them visible is to call one of the multiple ``popup*()`` functions instead.
  453. .. rst-class:: classref-item-separator
  454. ----
  455. .. _class_CanvasItem_property_y_sort_enabled:
  456. .. rst-class:: classref-property
  457. :ref:`bool<class_bool>` **y_sort_enabled** = ``false`` :ref:`๐Ÿ”—<class_CanvasItem_property_y_sort_enabled>`
  458. .. rst-class:: classref-property-setget
  459. - |void| **set_y_sort_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  460. - :ref:`bool<class_bool>` **is_y_sort_enabled**\ (\ )
  461. If ``true``, this and child **CanvasItem** nodes with a higher Y position are rendered in front of nodes with a lower Y position. If ``false``, this and child **CanvasItem** nodes are rendered normally in scene tree order.
  462. With Y-sorting enabled on a parent node ('A') but disabled on a child node ('B'), the child node ('B') is sorted but its children ('C1', 'C2', etc.) render together on the same Y position as the child node ('B'). This allows you to organize the render order of a scene without changing the scene tree.
  463. Nodes sort relative to each other only if they are on the same :ref:`z_index<class_CanvasItem_property_z_index>`.
  464. .. rst-class:: classref-item-separator
  465. ----
  466. .. _class_CanvasItem_property_z_as_relative:
  467. .. rst-class:: classref-property
  468. :ref:`bool<class_bool>` **z_as_relative** = ``true`` :ref:`๐Ÿ”—<class_CanvasItem_property_z_as_relative>`
  469. .. rst-class:: classref-property-setget
  470. - |void| **set_z_as_relative**\ (\ value\: :ref:`bool<class_bool>`\ )
  471. - :ref:`bool<class_bool>` **is_z_relative**\ (\ )
  472. If ``true``, the node's Z index is relative to its parent's Z index. If this node's Z index is 2 and its parent's effective Z index is 3, then this node's effective Z index will be 2 + 3 = 5.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_CanvasItem_property_z_index:
  476. .. rst-class:: classref-property
  477. :ref:`int<class_int>` **z_index** = ``0`` :ref:`๐Ÿ”—<class_CanvasItem_property_z_index>`
  478. .. rst-class:: classref-property-setget
  479. - |void| **set_z_index**\ (\ value\: :ref:`int<class_int>`\ )
  480. - :ref:`int<class_int>` **get_z_index**\ (\ )
  481. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between :ref:`RenderingServer.CANVAS_ITEM_Z_MIN<class_RenderingServer_constant_CANVAS_ITEM_Z_MIN>` and :ref:`RenderingServer.CANVAS_ITEM_Z_MAX<class_RenderingServer_constant_CANVAS_ITEM_Z_MAX>` (inclusive).
  482. \ **Note:** Changing the Z index of a :ref:`Control<class_Control>` only affects the drawing order, not the order in which input events are handled. This can be useful to implement certain UI animations, e.g. a menu where hovered items are scaled and should overlap others.
  483. .. rst-class:: classref-section-separator
  484. ----
  485. .. rst-class:: classref-descriptions-group
  486. Method Descriptions
  487. -------------------
  488. .. _class_CanvasItem_private_method__draw:
  489. .. rst-class:: classref-method
  490. |void| **_draw**\ (\ ) |virtual| :ref:`๐Ÿ”—<class_CanvasItem_private_method__draw>`
  491. Called when **CanvasItem** has been requested to redraw (after :ref:`queue_redraw()<class_CanvasItem_method_queue_redraw>` is called, either manually or by the engine).
  492. Corresponds to the :ref:`NOTIFICATION_DRAW<class_CanvasItem_constant_NOTIFICATION_DRAW>` notification in :ref:`Object._notification()<class_Object_private_method__notification>`.
  493. .. rst-class:: classref-item-separator
  494. ----
  495. .. _class_CanvasItem_method_draw_animation_slice:
  496. .. rst-class:: classref-method
  497. |void| **draw_animation_slice**\ (\ animation_length\: :ref:`float<class_float>`, slice_begin\: :ref:`float<class_float>`, slice_end\: :ref:`float<class_float>`, offset\: :ref:`float<class_float>` = 0.0\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_animation_slice>`
  498. Subsequent drawing commands will be ignored unless they fall within the specified animation slice. This is a faster way to implement animations that loop on background rather than redrawing constantly.
  499. .. rst-class:: classref-item-separator
  500. ----
  501. .. _class_CanvasItem_method_draw_arc:
  502. .. rst-class:: classref-method
  503. |void| **draw_arc**\ (\ center\: :ref:`Vector2<class_Vector2>`, radius\: :ref:`float<class_float>`, start_angle\: :ref:`float<class_float>`, end_angle\: :ref:`float<class_float>`, point_count\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_arc>`
  504. Draws an unfilled arc between the given angles with a uniform ``color`` and ``width`` and optional antialiasing (supported only for positive ``width``). The larger the value of ``point_count``, the smoother the curve. See also :ref:`draw_circle()<class_CanvasItem_method_draw_circle>`.
  505. If ``width`` is negative, it will be ignored and the arc will be drawn using :ref:`RenderingServer.PRIMITIVE_LINE_STRIP<class_RenderingServer_constant_PRIMITIVE_LINE_STRIP>`. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  506. The arc is drawn from ``start_angle`` towards the value of ``end_angle`` so in clockwise direction if ``start_angle < end_angle`` and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of ``start_angle`` and ``end_angle`` is greater than :ref:`@GDScript.TAU<class_@GDScript_constant_TAU>` radians, then a full circle arc is drawn (i.e. arc will not overlap itself).
  507. .. rst-class:: classref-item-separator
  508. ----
  509. .. _class_CanvasItem_method_draw_char:
  510. .. rst-class:: classref-method
  511. |void| **draw_char**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`String<class_String>`, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_char>`
  512. Draws a string first character using a custom font.
  513. .. rst-class:: classref-item-separator
  514. ----
  515. .. _class_CanvasItem_method_draw_char_outline:
  516. .. rst-class:: classref-method
  517. |void| **draw_char_outline**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, char\: :ref:`String<class_String>`, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_char_outline>`
  518. Draws a string first character outline using a custom font.
  519. .. rst-class:: classref-item-separator
  520. ----
  521. .. _class_CanvasItem_method_draw_circle:
  522. .. rst-class:: classref-method
  523. |void| **draw_circle**\ (\ position\: :ref:`Vector2<class_Vector2>`, radius\: :ref:`float<class_float>`, color\: :ref:`Color<class_Color>`, filled\: :ref:`bool<class_bool>` = true, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_circle>`
  524. Draws a circle. See also :ref:`draw_arc()<class_CanvasItem_method_draw_arc>`, :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>`, and :ref:`draw_polygon()<class_CanvasItem_method_draw_polygon>`.
  525. If ``filled`` is ``true``, the circle will be filled with the ``color`` specified. If ``filled`` is ``false``, the circle will be drawn as a stroke with the ``color`` and ``width`` specified.
  526. If ``width`` is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  527. If ``antialiased`` is ``true``, half transparent "feathers" will be attached to the boundary, making outlines smooth.
  528. \ **Note:** ``width`` is only effective if ``filled`` is ``false``.
  529. .. rst-class:: classref-item-separator
  530. ----
  531. .. _class_CanvasItem_method_draw_colored_polygon:
  532. .. rst-class:: classref-method
  533. |void| **draw_colored_polygon**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>` = PackedVector2Array(), texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_colored_polygon>`
  534. Draws a colored polygon of any number of points, convex or concave. Unlike :ref:`draw_polygon()<class_CanvasItem_method_draw_polygon>`, a single color must be specified for the whole polygon.
  535. \ **Note:** If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with :ref:`Geometry2D.triangulate_polygon()<class_Geometry2D_method_triangulate_polygon>` and using :ref:`draw_mesh()<class_CanvasItem_method_draw_mesh>`, :ref:`draw_multimesh()<class_CanvasItem_method_draw_multimesh>`, or :ref:`RenderingServer.canvas_item_add_triangle_array()<class_RenderingServer_method_canvas_item_add_triangle_array>`.
  536. .. rst-class:: classref-item-separator
  537. ----
  538. .. _class_CanvasItem_method_draw_dashed_line:
  539. .. rst-class:: classref-method
  540. |void| **draw_dashed_line**\ (\ from\: :ref:`Vector2<class_Vector2>`, to\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, dash\: :ref:`float<class_float>` = 2.0, aligned\: :ref:`bool<class_bool>` = true, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_dashed_line>`
  541. Draws a dashed line from a 2D point to another, with a given color and width. See also :ref:`draw_line()<class_CanvasItem_method_draw_line>`, :ref:`draw_multiline()<class_CanvasItem_method_draw_multiline>`, and :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>`.
  542. If ``width`` is negative, then a two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the line parts will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  543. \ ``dash`` is the length of each dash in pixels, with the gap between each dash being the same length. If ``aligned`` is ``true``, the length of the first and last dashes may be shortened or lengthened to allow the line to begin and end at the precise points defined by ``from`` and ``to``. Both ends are always symmetrical when ``aligned`` is ``true``. If ``aligned`` is ``false``, all dashes will have the same length, but the line may appear incomplete at the end due to the dash length not dividing evenly into the line length. Only full dashes are drawn when ``aligned`` is ``false``.
  544. If ``antialiased`` is ``true``, half transparent "feathers" will be attached to the boundary, making outlines smooth.
  545. \ **Note:** ``antialiased`` is only effective if ``width`` is greater than ``0.0``.
  546. .. rst-class:: classref-item-separator
  547. ----
  548. .. _class_CanvasItem_method_draw_end_animation:
  549. .. rst-class:: classref-method
  550. |void| **draw_end_animation**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_end_animation>`
  551. After submitting all animations slices via :ref:`draw_animation_slice()<class_CanvasItem_method_draw_animation_slice>`, this function can be used to revert drawing to its default state (all subsequent drawing commands will be visible). If you don't care about this particular use case, usage of this function after submitting the slices is not required.
  552. .. rst-class:: classref-item-separator
  553. ----
  554. .. _class_CanvasItem_method_draw_lcd_texture_rect_region:
  555. .. rst-class:: classref-method
  556. |void| **draw_lcd_texture_rect_region**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_lcd_texture_rect_region>`
  557. Draws a textured rectangle region of the font texture with LCD subpixel anti-aliasing at a given position, optionally modulated by a color.
  558. Texture is drawn using the following blend operation, blend mode of the :ref:`CanvasItemMaterial<class_CanvasItemMaterial>` is ignored:
  559. ::
  560. dst.r = texture.r * modulate.r * modulate.a + dst.r * (1.0 - texture.r * modulate.a);
  561. dst.g = texture.g * modulate.g * modulate.a + dst.g * (1.0 - texture.g * modulate.a);
  562. dst.b = texture.b * modulate.b * modulate.a + dst.b * (1.0 - texture.b * modulate.a);
  563. dst.a = modulate.a + dst.a * (1.0 - modulate.a);
  564. .. rst-class:: classref-item-separator
  565. ----
  566. .. _class_CanvasItem_method_draw_line:
  567. .. rst-class:: classref-method
  568. |void| **draw_line**\ (\ from\: :ref:`Vector2<class_Vector2>`, to\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_line>`
  569. Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased. See also :ref:`draw_dashed_line()<class_CanvasItem_method_draw_dashed_line>`, :ref:`draw_multiline()<class_CanvasItem_method_draw_multiline>`, and :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>`.
  570. If ``width`` is negative, then a two-point primitive will be drawn instead of a four-point one. This means that when the CanvasItem is scaled, the line will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  571. .. rst-class:: classref-item-separator
  572. ----
  573. .. _class_CanvasItem_method_draw_mesh:
  574. .. rst-class:: classref-method
  575. |void| **draw_mesh**\ (\ mesh\: :ref:`Mesh<class_Mesh>`, texture\: :ref:`Texture2D<class_Texture2D>`, transform\: :ref:`Transform2D<class_Transform2D>` = Transform2D(1, 0, 0, 1, 0, 0), modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_mesh>`
  576. Draws a :ref:`Mesh<class_Mesh>` in 2D, using the provided texture. See :ref:`MeshInstance2D<class_MeshInstance2D>` for related documentation.
  577. .. rst-class:: classref-item-separator
  578. ----
  579. .. _class_CanvasItem_method_draw_msdf_texture_rect_region:
  580. .. rst-class:: classref-method
  581. |void| **draw_msdf_texture_rect_region**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), outline\: :ref:`float<class_float>` = 0.0, pixel_range\: :ref:`float<class_float>` = 4.0, scale\: :ref:`float<class_float>` = 1.0\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_msdf_texture_rect_region>`
  582. Draws a textured rectangle region of the multi-channel signed distance field texture at a given position, optionally modulated by a color. See :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` for more information and caveats about MSDF font rendering.
  583. If ``outline`` is positive, each alpha channel value of pixel in region is set to maximum value of true distance in the ``outline`` radius.
  584. Value of the ``pixel_range`` should the same that was used during distance field texture generation.
  585. .. rst-class:: classref-item-separator
  586. ----
  587. .. _class_CanvasItem_method_draw_multiline:
  588. .. rst-class:: classref-method
  589. |void| **draw_multiline**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_multiline>`
  590. Draws multiple disconnected lines with a uniform ``width`` and ``color``. Each line is defined by two consecutive points from ``points`` array, i.e. i-th segment consists of ``points[2 * i]``, ``points[2 * i + 1]`` endpoints. When drawing large amounts of lines, this is faster than using individual :ref:`draw_line()<class_CanvasItem_method_draw_line>` calls. To draw interconnected lines, use :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>` instead.
  591. If ``width`` is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  592. \ **Note:** ``antialiased`` is only effective if ``width`` is greater than ``0.0``.
  593. .. rst-class:: classref-item-separator
  594. ----
  595. .. _class_CanvasItem_method_draw_multiline_colors:
  596. .. rst-class:: classref-method
  597. |void| **draw_multiline_colors**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_multiline_colors>`
  598. Draws multiple disconnected lines with a uniform ``width`` and segment-by-segment coloring. Each segment is defined by two consecutive points from ``points`` array and a corresponding color from ``colors`` array, i.e. i-th segment consists of ``points[2 * i]``, ``points[2 * i + 1]`` endpoints and has ``colors[i]`` color. When drawing large amounts of lines, this is faster than using individual :ref:`draw_line()<class_CanvasItem_method_draw_line>` calls. To draw interconnected lines, use :ref:`draw_polyline_colors()<class_CanvasItem_method_draw_polyline_colors>` instead.
  599. If ``width`` is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  600. \ **Note:** ``antialiased`` is only effective if ``width`` is greater than ``0.0``.
  601. .. rst-class:: classref-item-separator
  602. ----
  603. .. _class_CanvasItem_method_draw_multiline_string:
  604. .. rst-class:: classref-method
  605. |void| **draw_multiline_string**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_multiline_string>`
  606. Breaks ``text`` into lines and draws it using the specified ``font`` at the ``pos`` (top-left corner). The text will have its color multiplied by ``modulate``. If ``width`` is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
  607. .. rst-class:: classref-item-separator
  608. ----
  609. .. _class_CanvasItem_method_draw_multiline_string_outline:
  610. .. rst-class:: classref-method
  611. |void| **draw_multiline_string_outline**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, max_lines\: :ref:`int<class_int>` = -1, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), brk_flags\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] = 3, justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_multiline_string_outline>`
  612. Breaks ``text`` to the lines and draws text outline using the specified ``font`` at the ``pos`` (top-left corner). The text will have its color multiplied by ``modulate``. If ``width`` is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
  613. .. rst-class:: classref-item-separator
  614. ----
  615. .. _class_CanvasItem_method_draw_multimesh:
  616. .. rst-class:: classref-method
  617. |void| **draw_multimesh**\ (\ multimesh\: :ref:`MultiMesh<class_MultiMesh>`, texture\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_multimesh>`
  618. Draws a :ref:`MultiMesh<class_MultiMesh>` in 2D with the provided texture. See :ref:`MultiMeshInstance2D<class_MultiMeshInstance2D>` for related documentation.
  619. .. rst-class:: classref-item-separator
  620. ----
  621. .. _class_CanvasItem_method_draw_polygon:
  622. .. rst-class:: classref-method
  623. |void| **draw_polygon**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>` = PackedVector2Array(), texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_polygon>`
  624. Draws a solid polygon of any number of points, convex or concave. Unlike :ref:`draw_colored_polygon()<class_CanvasItem_method_draw_colored_polygon>`, each point's color can be changed individually. See also :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>` and :ref:`draw_polyline_colors()<class_CanvasItem_method_draw_polyline_colors>`. If you need more flexibility (such as being able to use bones), use :ref:`RenderingServer.canvas_item_add_triangle_array()<class_RenderingServer_method_canvas_item_add_triangle_array>` instead.
  625. \ **Note:** If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with :ref:`Geometry2D.triangulate_polygon()<class_Geometry2D_method_triangulate_polygon>` and using :ref:`draw_mesh()<class_CanvasItem_method_draw_mesh>`, :ref:`draw_multimesh()<class_CanvasItem_method_draw_multimesh>`, or :ref:`RenderingServer.canvas_item_add_triangle_array()<class_RenderingServer_method_canvas_item_add_triangle_array>`.
  626. .. rst-class:: classref-item-separator
  627. ----
  628. .. _class_CanvasItem_method_draw_polyline:
  629. .. rst-class:: classref-method
  630. |void| **draw_polyline**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, color\: :ref:`Color<class_Color>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_polyline>`
  631. Draws interconnected line segments with a uniform ``color`` and ``width`` and optional antialiasing (supported only for positive ``width``). When drawing large amounts of lines, this is faster than using individual :ref:`draw_line()<class_CanvasItem_method_draw_line>` calls. To draw disconnected lines, use :ref:`draw_multiline()<class_CanvasItem_method_draw_multiline>` instead. See also :ref:`draw_polygon()<class_CanvasItem_method_draw_polygon>`.
  632. If ``width`` is negative, it will be ignored and the polyline will be drawn using :ref:`RenderingServer.PRIMITIVE_LINE_STRIP<class_RenderingServer_constant_PRIMITIVE_LINE_STRIP>`. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  633. .. rst-class:: classref-item-separator
  634. ----
  635. .. _class_CanvasItem_method_draw_polyline_colors:
  636. .. rst-class:: classref-method
  637. |void| **draw_polyline_colors**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_polyline_colors>`
  638. Draws interconnected line segments with a uniform ``width``, point-by-point coloring, and optional antialiasing (supported only for positive ``width``). Colors assigned to line points match by index between ``points`` and ``colors``, i.e. each line segment is filled with a gradient between the colors of the endpoints. When drawing large amounts of lines, this is faster than using individual :ref:`draw_line()<class_CanvasItem_method_draw_line>` calls. To draw disconnected lines, use :ref:`draw_multiline_colors()<class_CanvasItem_method_draw_multiline_colors>` instead. See also :ref:`draw_polygon()<class_CanvasItem_method_draw_polygon>`.
  639. If ``width`` is negative, it will be ignored and the polyline will be drawn using :ref:`RenderingServer.PRIMITIVE_LINE_STRIP<class_RenderingServer_constant_PRIMITIVE_LINE_STRIP>`. This means that when the CanvasItem is scaled, the polyline will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_CanvasItem_method_draw_primitive:
  643. .. rst-class:: classref-method
  644. |void| **draw_primitive**\ (\ points\: :ref:`PackedVector2Array<class_PackedVector2Array>`, colors\: :ref:`PackedColorArray<class_PackedColorArray>`, uvs\: :ref:`PackedVector2Array<class_PackedVector2Array>`, texture\: :ref:`Texture2D<class_Texture2D>` = null\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_primitive>`
  645. Draws a custom primitive. 1 point for a point, 2 points for a line, 3 points for a triangle, and 4 points for a quad. If 0 points or more than 4 points are specified, nothing will be drawn and an error message will be printed. See also :ref:`draw_line()<class_CanvasItem_method_draw_line>`, :ref:`draw_polyline()<class_CanvasItem_method_draw_polyline>`, :ref:`draw_polygon()<class_CanvasItem_method_draw_polygon>`, and :ref:`draw_rect()<class_CanvasItem_method_draw_rect>`.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_CanvasItem_method_draw_rect:
  649. .. rst-class:: classref-method
  650. |void| **draw_rect**\ (\ rect\: :ref:`Rect2<class_Rect2>`, color\: :ref:`Color<class_Color>`, filled\: :ref:`bool<class_bool>` = true, width\: :ref:`float<class_float>` = -1.0, antialiased\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_rect>`
  651. Draws a rectangle. If ``filled`` is ``true``, the rectangle will be filled with the ``color`` specified. If ``filled`` is ``false``, the rectangle will be drawn as a stroke with the ``color`` and ``width`` specified. See also :ref:`draw_texture_rect()<class_CanvasItem_method_draw_texture_rect>`.
  652. If ``width`` is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive ``width`` like ``1.0``.
  653. If ``antialiased`` is ``true``, half transparent "feathers" will be attached to the boundary, making outlines smooth.
  654. \ **Note:** ``width`` is only effective if ``filled`` is ``false``.
  655. \ **Note:** Unfilled rectangles drawn with a negative ``width`` may not display perfectly. For example, corners may be missing or brighter due to overlapping lines (for a translucent ``color``).
  656. .. rst-class:: classref-item-separator
  657. ----
  658. .. _class_CanvasItem_method_draw_set_transform:
  659. .. rst-class:: classref-method
  660. |void| **draw_set_transform**\ (\ position\: :ref:`Vector2<class_Vector2>`, rotation\: :ref:`float<class_float>` = 0.0, scale\: :ref:`Vector2<class_Vector2>` = Vector2(1, 1)\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_set_transform>`
  661. Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this.
  662. \ **Note:** :ref:`FontFile.oversampling<class_FontFile_property_oversampling>` does *not* take ``scale`` into account. This means that scaling up/down will cause bitmap fonts and rasterized (non-MSDF) dynamic fonts to appear blurry or pixelated. To ensure text remains crisp regardless of scale, you can enable MSDF font rendering by enabling :ref:`ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field<class_ProjectSettings_property_gui/theme/default_font_multichannel_signed_distance_field>` (applies to the default project font only), or enabling **Multichannel Signed Distance Field** in the import options of a DynamicFont for custom fonts. On system fonts, :ref:`SystemFont.multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` can be enabled in the inspector.
  663. .. rst-class:: classref-item-separator
  664. ----
  665. .. _class_CanvasItem_method_draw_set_transform_matrix:
  666. .. rst-class:: classref-method
  667. |void| **draw_set_transform_matrix**\ (\ xform\: :ref:`Transform2D<class_Transform2D>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_set_transform_matrix>`
  668. Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
  669. .. rst-class:: classref-item-separator
  670. ----
  671. .. _class_CanvasItem_method_draw_string:
  672. .. rst-class:: classref-method
  673. |void| **draw_string**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_string>`
  674. Draws ``text`` using the specified ``font`` at the ``pos`` (bottom-left corner using the baseline of the font). The text will have its color multiplied by ``modulate``. If ``width`` is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
  675. \ **Example:** Draw "Hello world", using the project's default font:
  676. .. tabs::
  677. .. code-tab:: gdscript
  678. # If using this method in a script that redraws constantly, move the
  679. # `default_font` declaration to a member variable assigned in `_ready()`
  680. # so the Control is only created once.
  681. var default_font = ThemeDB.fallback_font
  682. var default_font_size = ThemeDB.fallback_font_size
  683. draw_string(default_font, Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, default_font_size)
  684. .. code-tab:: csharp
  685. // If using this method in a script that redraws constantly, move the
  686. // `default_font` declaration to a member variable assigned in `_Ready()`
  687. // so the Control is only created once.
  688. Font defaultFont = ThemeDB.FallbackFont;
  689. int defaultFontSize = ThemeDB.FallbackFontSize;
  690. DrawString(defaultFont, new Vector2(64, 64), "Hello world", HORIZONTAL_ALIGNMENT_LEFT, -1, defaultFontSize);
  691. See also :ref:`Font.draw_string()<class_Font_method_draw_string>`.
  692. .. rst-class:: classref-item-separator
  693. ----
  694. .. _class_CanvasItem_method_draw_string_outline:
  695. .. rst-class:: classref-method
  696. |void| **draw_string_outline**\ (\ font\: :ref:`Font<class_Font>`, pos\: :ref:`Vector2<class_Vector2>`, text\: :ref:`String<class_String>`, alignment\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` = 0, width\: :ref:`float<class_float>` = -1, font_size\: :ref:`int<class_int>` = 16, size\: :ref:`int<class_int>` = 1, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), justification_flags\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] = 3, direction\: :ref:`Direction<enum_TextServer_Direction>` = 0, orientation\: :ref:`Orientation<enum_TextServer_Orientation>` = 0\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_draw_string_outline>`
  697. Draws ``text`` outline using the specified ``font`` at the ``pos`` (bottom-left corner using the baseline of the font). The text will have its color multiplied by ``modulate``. If ``width`` is greater than or equal to 0, the text will be clipped if it exceeds the specified width.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_CanvasItem_method_draw_style_box:
  701. .. rst-class:: classref-method
  702. |void| **draw_style_box**\ (\ style_box\: :ref:`StyleBox<class_StyleBox>`, rect\: :ref:`Rect2<class_Rect2>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_style_box>`
  703. Draws a styled rectangle.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_CanvasItem_method_draw_texture:
  707. .. rst-class:: classref-method
  708. |void| **draw_texture**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, position\: :ref:`Vector2<class_Vector2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_texture>`
  709. Draws a texture at a given position.
  710. .. rst-class:: classref-item-separator
  711. ----
  712. .. _class_CanvasItem_method_draw_texture_rect:
  713. .. rst-class:: classref-method
  714. |void| **draw_texture_rect**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, tile\: :ref:`bool<class_bool>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), transpose\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_texture_rect>`
  715. Draws a textured rectangle at a given position, optionally modulated by a color. If ``transpose`` is ``true``, the texture will have its X and Y coordinates swapped. See also :ref:`draw_rect()<class_CanvasItem_method_draw_rect>` and :ref:`draw_texture_rect_region()<class_CanvasItem_method_draw_texture_rect_region>`.
  716. .. rst-class:: classref-item-separator
  717. ----
  718. .. _class_CanvasItem_method_draw_texture_rect_region:
  719. .. rst-class:: classref-method
  720. |void| **draw_texture_rect_region**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, rect\: :ref:`Rect2<class_Rect2>`, src_rect\: :ref:`Rect2<class_Rect2>`, modulate\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), transpose\: :ref:`bool<class_bool>` = false, clip_uv\: :ref:`bool<class_bool>` = true\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_draw_texture_rect_region>`
  721. Draws a textured rectangle from a texture's region (specified by ``src_rect``) at a given position, optionally modulated by a color. If ``transpose`` is ``true``, the texture will have its X and Y coordinates swapped. See also :ref:`draw_texture_rect()<class_CanvasItem_method_draw_texture_rect>`.
  722. .. rst-class:: classref-item-separator
  723. ----
  724. .. _class_CanvasItem_method_force_update_transform:
  725. .. rst-class:: classref-method
  726. |void| **force_update_transform**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_force_update_transform>`
  727. Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_CanvasItem_method_get_canvas:
  731. .. rst-class:: classref-method
  732. :ref:`RID<class_RID>` **get_canvas**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_canvas>`
  733. Returns the :ref:`RID<class_RID>` of the :ref:`World2D<class_World2D>` canvas where this item is in.
  734. .. rst-class:: classref-item-separator
  735. ----
  736. .. _class_CanvasItem_method_get_canvas_item:
  737. .. rst-class:: classref-method
  738. :ref:`RID<class_RID>` **get_canvas_item**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_canvas_item>`
  739. Returns the canvas item RID used by :ref:`RenderingServer<class_RenderingServer>` for this item.
  740. .. rst-class:: classref-item-separator
  741. ----
  742. .. _class_CanvasItem_method_get_canvas_layer_node:
  743. .. rst-class:: classref-method
  744. :ref:`CanvasLayer<class_CanvasLayer>` **get_canvas_layer_node**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_canvas_layer_node>`
  745. Returns the :ref:`CanvasLayer<class_CanvasLayer>` that contains this node, or ``null`` if the node is not in any :ref:`CanvasLayer<class_CanvasLayer>`.
  746. .. rst-class:: classref-item-separator
  747. ----
  748. .. _class_CanvasItem_method_get_canvas_transform:
  749. .. rst-class:: classref-method
  750. :ref:`Transform2D<class_Transform2D>` **get_canvas_transform**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_canvas_transform>`
  751. Returns the transform from the coordinate system of the canvas, this item is in, to the :ref:`Viewport<class_Viewport>`\ s coordinate system.
  752. .. rst-class:: classref-item-separator
  753. ----
  754. .. _class_CanvasItem_method_get_global_mouse_position:
  755. .. rst-class:: classref-method
  756. :ref:`Vector2<class_Vector2>` **get_global_mouse_position**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_global_mouse_position>`
  757. Returns the mouse's position in the :ref:`CanvasLayer<class_CanvasLayer>` that this **CanvasItem** is in using the coordinate system of the :ref:`CanvasLayer<class_CanvasLayer>`.
  758. \ **Note:** For screen-space coordinates (e.g. when using a non-embedded :ref:`Popup<class_Popup>`), you can use :ref:`DisplayServer.mouse_get_position()<class_DisplayServer_method_mouse_get_position>`.
  759. .. rst-class:: classref-item-separator
  760. ----
  761. .. _class_CanvasItem_method_get_global_transform:
  762. .. rst-class:: classref-method
  763. :ref:`Transform2D<class_Transform2D>` **get_global_transform**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_global_transform>`
  764. Returns the global transform matrix of this item, i.e. the combined transform up to the topmost **CanvasItem** node. The topmost item is a **CanvasItem** that either has no parent, has non-**CanvasItem** parent or it has :ref:`top_level<class_CanvasItem_property_top_level>` enabled.
  765. .. rst-class:: classref-item-separator
  766. ----
  767. .. _class_CanvasItem_method_get_global_transform_with_canvas:
  768. .. rst-class:: classref-method
  769. :ref:`Transform2D<class_Transform2D>` **get_global_transform_with_canvas**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_global_transform_with_canvas>`
  770. Returns the transform from the local coordinate system of this **CanvasItem** to the :ref:`Viewport<class_Viewport>`\ s coordinate system.
  771. .. rst-class:: classref-item-separator
  772. ----
  773. .. _class_CanvasItem_method_get_instance_shader_parameter:
  774. .. rst-class:: classref-method
  775. :ref:`Variant<class_Variant>` **get_instance_shader_parameter**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_instance_shader_parameter>`
  776. Get the value of a shader parameter as set on this instance.
  777. .. rst-class:: classref-item-separator
  778. ----
  779. .. _class_CanvasItem_method_get_local_mouse_position:
  780. .. rst-class:: classref-method
  781. :ref:`Vector2<class_Vector2>` **get_local_mouse_position**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_local_mouse_position>`
  782. Returns the mouse's position in this **CanvasItem** using the local coordinate system of this **CanvasItem**.
  783. .. rst-class:: classref-item-separator
  784. ----
  785. .. _class_CanvasItem_method_get_screen_transform:
  786. .. rst-class:: classref-method
  787. :ref:`Transform2D<class_Transform2D>` **get_screen_transform**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_screen_transform>`
  788. Returns the transform of this **CanvasItem** in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.
  789. Equals to :ref:`get_global_transform()<class_CanvasItem_method_get_global_transform>` if the window is embedded (see :ref:`Viewport.gui_embed_subwindows<class_Viewport_property_gui_embed_subwindows>`).
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_CanvasItem_method_get_transform:
  793. .. rst-class:: classref-method
  794. :ref:`Transform2D<class_Transform2D>` **get_transform**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_transform>`
  795. Returns the transform matrix of this item.
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. _class_CanvasItem_method_get_viewport_rect:
  799. .. rst-class:: classref-method
  800. :ref:`Rect2<class_Rect2>` **get_viewport_rect**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_viewport_rect>`
  801. Returns the viewport's boundaries as a :ref:`Rect2<class_Rect2>`.
  802. .. rst-class:: classref-item-separator
  803. ----
  804. .. _class_CanvasItem_method_get_viewport_transform:
  805. .. rst-class:: classref-method
  806. :ref:`Transform2D<class_Transform2D>` **get_viewport_transform**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_viewport_transform>`
  807. Returns the transform from the coordinate system of the canvas, this item is in, to the :ref:`Viewport<class_Viewport>`\ s embedders coordinate system.
  808. .. rst-class:: classref-item-separator
  809. ----
  810. .. _class_CanvasItem_method_get_visibility_layer_bit:
  811. .. rst-class:: classref-method
  812. :ref:`bool<class_bool>` **get_visibility_layer_bit**\ (\ layer\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_visibility_layer_bit>`
  813. Returns an individual bit on the rendering visibility layer.
  814. .. rst-class:: classref-item-separator
  815. ----
  816. .. _class_CanvasItem_method_get_world_2d:
  817. .. rst-class:: classref-method
  818. :ref:`World2D<class_World2D>` **get_world_2d**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_get_world_2d>`
  819. Returns the :ref:`World2D<class_World2D>` where this item is in.
  820. .. rst-class:: classref-item-separator
  821. ----
  822. .. _class_CanvasItem_method_hide:
  823. .. rst-class:: classref-method
  824. |void| **hide**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_hide>`
  825. Hide the **CanvasItem** if it's currently visible. This is equivalent to setting :ref:`visible<class_CanvasItem_property_visible>` to ``false``.
  826. .. rst-class:: classref-item-separator
  827. ----
  828. .. _class_CanvasItem_method_is_local_transform_notification_enabled:
  829. .. rst-class:: classref-method
  830. :ref:`bool<class_bool>` **is_local_transform_notification_enabled**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_is_local_transform_notification_enabled>`
  831. Returns ``true`` if local transform notifications are communicated to children.
  832. .. rst-class:: classref-item-separator
  833. ----
  834. .. _class_CanvasItem_method_is_transform_notification_enabled:
  835. .. rst-class:: classref-method
  836. :ref:`bool<class_bool>` **is_transform_notification_enabled**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_is_transform_notification_enabled>`
  837. Returns ``true`` if global transform notifications are communicated to children.
  838. .. rst-class:: classref-item-separator
  839. ----
  840. .. _class_CanvasItem_method_is_visible_in_tree:
  841. .. rst-class:: classref-method
  842. :ref:`bool<class_bool>` **is_visible_in_tree**\ (\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_is_visible_in_tree>`
  843. Returns ``true`` if the node is present in the :ref:`SceneTree<class_SceneTree>`, its :ref:`visible<class_CanvasItem_property_visible>` property is ``true`` and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree, and is therefore not drawn (see :ref:`_draw()<class_CanvasItem_private_method__draw>`).
  844. Visibility is checked only in parent nodes that inherit from **CanvasItem**, :ref:`CanvasLayer<class_CanvasLayer>`, and :ref:`Window<class_Window>`. If the parent is of any other type (such as :ref:`Node<class_Node>`, :ref:`AnimationPlayer<class_AnimationPlayer>`, or :ref:`Node3D<class_Node3D>`), it is assumed to be visible.
  845. \ **Note:** This method does not take :ref:`visibility_layer<class_CanvasItem_property_visibility_layer>` into account, so even if this method returns ``true``, the node might end up not being rendered.
  846. .. rst-class:: classref-item-separator
  847. ----
  848. .. _class_CanvasItem_method_make_canvas_position_local:
  849. .. rst-class:: classref-method
  850. :ref:`Vector2<class_Vector2>` **make_canvas_position_local**\ (\ viewport_point\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_make_canvas_position_local>`
  851. Transforms ``viewport_point`` from the viewport's coordinates to this node's local coordinates.
  852. For the opposite operation, use :ref:`get_global_transform_with_canvas()<class_CanvasItem_method_get_global_transform_with_canvas>`.
  853. ::
  854. var viewport_point = get_global_transform_with_canvas() * local_point
  855. .. rst-class:: classref-item-separator
  856. ----
  857. .. _class_CanvasItem_method_make_input_local:
  858. .. rst-class:: classref-method
  859. :ref:`InputEvent<class_InputEvent>` **make_input_local**\ (\ event\: :ref:`InputEvent<class_InputEvent>`\ ) |const| :ref:`๐Ÿ”—<class_CanvasItem_method_make_input_local>`
  860. Transformations issued by ``event``'s inputs are applied in local space instead of global space.
  861. .. rst-class:: classref-item-separator
  862. ----
  863. .. _class_CanvasItem_method_move_to_front:
  864. .. rst-class:: classref-method
  865. |void| **move_to_front**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_move_to_front>`
  866. Moves this node to display on top of its siblings.
  867. Internally, the node is moved to the bottom of parent's child list. The method has no effect on nodes without a parent.
  868. .. rst-class:: classref-item-separator
  869. ----
  870. .. _class_CanvasItem_method_queue_redraw:
  871. .. rst-class:: classref-method
  872. |void| **queue_redraw**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_queue_redraw>`
  873. Queues the **CanvasItem** to redraw. During idle time, if **CanvasItem** is visible, :ref:`NOTIFICATION_DRAW<class_CanvasItem_constant_NOTIFICATION_DRAW>` is sent and :ref:`_draw()<class_CanvasItem_private_method__draw>` is called. This only occurs **once** per frame, even if this method has been called multiple times.
  874. .. rst-class:: classref-item-separator
  875. ----
  876. .. _class_CanvasItem_method_set_instance_shader_parameter:
  877. .. rst-class:: classref-method
  878. |void| **set_instance_shader_parameter**\ (\ name\: :ref:`StringName<class_StringName>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_set_instance_shader_parameter>`
  879. Set the value of a shader uniform for this instance only (`per-instance uniform <../tutorials/shaders/shader_reference/shading_language.html#per-instance-uniforms>`__). See also :ref:`ShaderMaterial.set_shader_parameter()<class_ShaderMaterial_method_set_shader_parameter>` to assign a uniform on all instances using the same :ref:`ShaderMaterial<class_ShaderMaterial>`.
  880. \ **Note:** For a shader uniform to be assignable on a per-instance basis, it *must* be defined with ``instance uniform ...`` rather than ``uniform ...`` in the shader code.
  881. \ **Note:** ``name`` is case-sensitive and must match the name of the uniform in the code exactly (not the capitalized name in the inspector).
  882. .. rst-class:: classref-item-separator
  883. ----
  884. .. _class_CanvasItem_method_set_notify_local_transform:
  885. .. rst-class:: classref-method
  886. |void| **set_notify_local_transform**\ (\ enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_set_notify_local_transform>`
  887. If ``enable`` is ``true``, this node will receive :ref:`NOTIFICATION_LOCAL_TRANSFORM_CHANGED<class_CanvasItem_constant_NOTIFICATION_LOCAL_TRANSFORM_CHANGED>` when its local transform changes.
  888. .. rst-class:: classref-item-separator
  889. ----
  890. .. _class_CanvasItem_method_set_notify_transform:
  891. .. rst-class:: classref-method
  892. |void| **set_notify_transform**\ (\ enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_set_notify_transform>`
  893. If ``enable`` is ``true``, this node will receive :ref:`NOTIFICATION_TRANSFORM_CHANGED<class_CanvasItem_constant_NOTIFICATION_TRANSFORM_CHANGED>` when its global transform changes.
  894. .. rst-class:: classref-item-separator
  895. ----
  896. .. _class_CanvasItem_method_set_visibility_layer_bit:
  897. .. rst-class:: classref-method
  898. |void| **set_visibility_layer_bit**\ (\ layer\: :ref:`int<class_int>`, enabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_set_visibility_layer_bit>`
  899. Set/clear individual bits on the rendering visibility layer. This simplifies editing this **CanvasItem**'s visibility layer.
  900. .. rst-class:: classref-item-separator
  901. ----
  902. .. _class_CanvasItem_method_show:
  903. .. rst-class:: classref-method
  904. |void| **show**\ (\ ) :ref:`๐Ÿ”—<class_CanvasItem_method_show>`
  905. Show the **CanvasItem** if it's currently hidden. This is equivalent to setting :ref:`visible<class_CanvasItem_property_visible>` to ``true``. For controls that inherit :ref:`Popup<class_Popup>`, the correct way to make them visible is to call one of the multiple ``popup*()`` functions instead.
  906. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  907. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  908. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  909. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  910. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  911. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  912. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  913. .. |void| replace:: :abbr:`void (No return value.)`