.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_CanvasItem: CanvasItem ========== **Inherits:** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`Node2D`, :ref:`Control` **Category:** Core Brief Description ----------------- Base class of anything 2D. Member Functions ---------------- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_draw` **(** **)** virtual | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`draw_char` **(** :ref:`Font` font, :ref:`Vector2` pos, :ref:`String` char, :ref:`String` next, :ref:`Color` modulate=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_circle` **(** :ref:`Vector2` pos, :ref:`float` radius, :ref:`Color` color **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_colored_polygon` **(** :ref:`PoolVector2Array` points, :ref:`Color` color, :ref:`PoolVector2Array` uvs=null, :ref:`Texture` texture=PoolVector2Array( ), :ref:`Texture` normal_map=null, :ref:`bool` antialiased=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_line` **(** :ref:`Vector2` from, :ref:`Vector2` to, :ref:`Color` color, :ref:`float` width=null, :ref:`bool` antialiased=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_polygon` **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`PoolVector2Array` uvs=null, :ref:`Texture` texture=PoolVector2Array( ), :ref:`Texture` normal_map=null, :ref:`bool` antialiased=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_polyline` **(** :ref:`PoolVector2Array` points, :ref:`Color` color, :ref:`float` width=null, :ref:`bool` antialiased=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_polyline_colors` **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`float` width=null, :ref:`bool` antialiased=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_primitive` **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`PoolVector2Array` uvs, :ref:`Texture` texture=null, :ref:`float` width=null, :ref:`Texture` normal_map=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_rect` **(** :ref:`Rect2` rect, :ref:`Color` color, :ref:`bool` filled=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_set_transform` **(** :ref:`Vector2` pos, :ref:`float` rot, :ref:`Vector2` scale **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_set_transform_matrix` **(** :ref:`Transform2D` xform **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_string` **(** :ref:`Font` font, :ref:`Vector2` pos, :ref:`String` text, :ref:`Color` modulate=null, :ref:`int` clip_w=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_style_box` **(** :ref:`StyleBox` style_box, :ref:`Rect2` rect **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_texture` **(** :ref:`Texture` texture, :ref:`Vector2` pos, :ref:`Color` modulate=null, :ref:`Texture` normal_map=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_texture_rect` **(** :ref:`Texture` texture, :ref:`Rect2` rect, :ref:`bool` tile, :ref:`Color` modulate=null, :ref:`bool` transpose=null, :ref:`Texture` normal_map=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`draw_texture_rect_region` **(** :ref:`Texture` texture, :ref:`Rect2` rect, :ref:`Rect2` src_rect, :ref:`Color` modulate=Color( 1, 1, 1, 1 ), :ref:`bool` transpose=null, :ref:`Texture` normal_map=null, :ref:`bool` clip_uv=null **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`edit_get_state` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_rotate` **(** :ref:`float` degrees **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_set_rect` **(** :ref:`Rect2` rect **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`edit_set_state` **(** :ref:`Variant` state **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_canvas` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_canvas_item` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_canvas_transform` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_global_mouse_position` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_global_transform` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_global_transform_with_canvas` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_item_and_children_rect` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_item_rect` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_light_mask` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_local_mouse_pos` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Material` | :ref:`get_material` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`get_modulate` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`get_self_modulate` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_transform` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_use_parent_material` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2` | :ref:`get_viewport_rect` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_viewport_transform` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`World2D` | :ref:`get_world_2d` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`hide` **(** **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_draw_behind_parent_enabled` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_local_transform_notification_enabled` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_set_as_toplevel` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_transform_notification_enabled` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_visible` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_visible_in_tree` **(** **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`make_canvas_pos_local` **(** :ref:`Vector2` screen_point **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`InputEvent` | :ref:`make_input_local` **(** :ref:`InputEvent` event **)** const | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_as_toplevel` **(** :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_draw_behind_parent` **(** :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_light_mask` **(** :ref:`int` light_mask **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_material` **(** :ref:`Material` material **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_modulate` **(** :ref:`Color` modulate **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_notify_local_transform` **(** :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_notify_transform` **(** :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_self_modulate` **(** :ref:`Color` self_modulate **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_use_parent_material` **(** :ref:`bool` enable **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_visible` **(** :ref:`bool` visible **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`show` **(** **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update` **(** **)** | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **draw** **(** **)** Emitted when the CanvasItem must redraw. This can only be connected realtime, as deferred will not allow drawing. - **hide** **(** **)** Emitted when becoming hidden. - **item_rect_changed** **(** **)** Emitted when the item rect has changed. - **visibility_changed** **(** **)** Emitted when the visibility (hidden/visible) changes. Numeric Constants ----------------- - **BLEND_MODE_MIX** = **0** --- Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value. - **BLEND_MODE_ADD** = **1** --- Additive blending mode. - **BLEND_MODE_SUB** = **2** --- Subtractive blending mode. - **BLEND_MODE_MUL** = **3** --- Multiplicative blending mode. - **BLEND_MODE_PREMULT_ALPHA** = **4** --- Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. - **NOTIFICATION_DRAW** = **30** --- CanvasItem is requested to draw. - **NOTIFICATION_VISIBILITY_CHANGED** = **31** --- Canvas item visibility has changed. - **NOTIFICATION_ENTER_CANVAS** = **32** --- Canvas item has entered the canvas. - **NOTIFICATION_EXIT_CANVAS** = **33** --- Canvas item has exited the canvas. - **NOTIFICATION_TRANSFORM_CHANGED** = **29** --- Canvas item transform has changed. Only received if requested. Description ----------- Base class of anything 2D. Canvas items are laid out in a tree and children inherit and extend the transform of their parent. CanvasItem is extended by :ref:`Control`, for anything GUI related, and by :ref:`Node2D` for anything 2D engine related. Any CanvasItem can draw. For this, the "update" function must be called, then NOTIFICATION_DRAW will be received on idle time to request redraw. Because of this, canvas items don't need to be redraw on every frame, improving the performance significantly. Several functions for drawing on the CanvasItem are provided (see draw\_\* functions). They can only be used inside the notification, signal or _draw() overrides function, though. Canvas items are draw in tree order. By default, children are on top of their parents so a root CanvasItem will be drawn behind everything (this can be changed per item though). Canvas items can also be hidden (hiding also their subtree). They provide many means for changing standard parameters such as opacity (for it and the subtree) and self opacity, blend mode. Ultimately, a transform notification can be requested, which will notify the node that its global position changed in case the parent tree changed. Member Function Description --------------------------- .. _class_CanvasItem__draw: - void **_draw** **(** **)** virtual Called (if exists) to draw the canvas item. .. _class_CanvasItem_draw_char: - :ref:`float` **draw_char** **(** :ref:`Font` font, :ref:`Vector2` pos, :ref:`String` char, :ref:`String` next, :ref:`Color` modulate=null **)** Draw a string character using a custom font. Returns the advance, depending on the char width and kerning with an optional next char. .. _class_CanvasItem_draw_circle: - void **draw_circle** **(** :ref:`Vector2` pos, :ref:`float` radius, :ref:`Color` color **)** Draw a colored circle. .. _class_CanvasItem_draw_colored_polygon: - void **draw_colored_polygon** **(** :ref:`PoolVector2Array` points, :ref:`Color` color, :ref:`PoolVector2Array` uvs=null, :ref:`Texture` texture=PoolVector2Array( ), :ref:`Texture` normal_map=null, :ref:`bool` antialiased=null **)** Draw a colored polygon of any amount of points, convex or concave. .. _class_CanvasItem_draw_line: - void **draw_line** **(** :ref:`Vector2` from, :ref:`Vector2` to, :ref:`Color` color, :ref:`float` width=null, :ref:`bool` antialiased=null **)** Draw a line from a 2D point to another, with a given color and width. It can be optionally antialiased. .. _class_CanvasItem_draw_polygon: - void **draw_polygon** **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`PoolVector2Array` uvs=null, :ref:`Texture` texture=PoolVector2Array( ), :ref:`Texture` normal_map=null, :ref:`bool` antialiased=null **)** Draw a polygon of any amount of points, convex or concave. .. _class_CanvasItem_draw_polyline: - void **draw_polyline** **(** :ref:`PoolVector2Array` points, :ref:`Color` color, :ref:`float` width=null, :ref:`bool` antialiased=null **)** .. _class_CanvasItem_draw_polyline_colors: - void **draw_polyline_colors** **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`float` width=null, :ref:`bool` antialiased=null **)** .. _class_CanvasItem_draw_primitive: - void **draw_primitive** **(** :ref:`PoolVector2Array` points, :ref:`PoolColorArray` colors, :ref:`PoolVector2Array` uvs, :ref:`Texture` texture=null, :ref:`float` width=null, :ref:`Texture` normal_map=null **)** Draw a custom primitive, 1 point for a point, 2 points for a line, 3 points for a triangle and 4 points for a quad. .. _class_CanvasItem_draw_rect: - void **draw_rect** **(** :ref:`Rect2` rect, :ref:`Color` color, :ref:`bool` filled=null **)** Draw a colored rectangle. .. _class_CanvasItem_draw_set_transform: - void **draw_set_transform** **(** :ref:`Vector2` pos, :ref:`float` rot, :ref:`Vector2` scale **)** Set a custom transform for drawing. Anything drawn afterwards will be transformed by this. .. _class_CanvasItem_draw_set_transform_matrix: - void **draw_set_transform_matrix** **(** :ref:`Transform2D` xform **)** .. _class_CanvasItem_draw_string: - void **draw_string** **(** :ref:`Font` font, :ref:`Vector2` pos, :ref:`String` text, :ref:`Color` modulate=null, :ref:`int` clip_w=null **)** Draw a string using a custom font. .. _class_CanvasItem_draw_style_box: - void **draw_style_box** **(** :ref:`StyleBox` style_box, :ref:`Rect2` rect **)** Draw a styled rectangle. .. _class_CanvasItem_draw_texture: - void **draw_texture** **(** :ref:`Texture` texture, :ref:`Vector2` pos, :ref:`Color` modulate=null, :ref:`Texture` normal_map=null **)** Draw a texture at a given position. .. _class_CanvasItem_draw_texture_rect: - void **draw_texture_rect** **(** :ref:`Texture` texture, :ref:`Rect2` rect, :ref:`bool` tile, :ref:`Color` modulate=null, :ref:`bool` transpose=null, :ref:`Texture` normal_map=null **)** Draw a textured rectangle at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture. .. _class_CanvasItem_draw_texture_rect_region: - void **draw_texture_rect_region** **(** :ref:`Texture` texture, :ref:`Rect2` rect, :ref:`Rect2` src_rect, :ref:`Color` modulate=Color( 1, 1, 1, 1 ), :ref:`bool` transpose=null, :ref:`Texture` normal_map=null, :ref:`bool` clip_uv=null **)** Draw a textured rectangle region at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture. .. _class_CanvasItem_edit_get_state: - :ref:`Variant` **edit_get_state** **(** **)** const Used for editing, returns an opaque value representing the transform state. .. _class_CanvasItem_edit_rotate: - void **edit_rotate** **(** :ref:`float` degrees **)** Used for editing, handle rotation. .. _class_CanvasItem_edit_set_rect: - void **edit_set_rect** **(** :ref:`Rect2` rect **)** .. _class_CanvasItem_edit_set_state: - void **edit_set_state** **(** :ref:`Variant` state **)** Set the transform state of this CanvasItem. For :ref:`Node2D`, this is an :ref:`Array` with (in order) a :ref:`Vector2` for position, a float for rotation (radians) and another :ref:`Vector2` for scale. For :ref:`Control` this is a :ref:`Rect2` with the position and size. .. _class_CanvasItem_get_canvas: - :ref:`RID` **get_canvas** **(** **)** const Return the :ref:`RID` of the :ref:`World2D` canvas where this item is in. .. _class_CanvasItem_get_canvas_item: - :ref:`RID` **get_canvas_item** **(** **)** const Return the canvas item RID used by :ref:`VisualServer` for this item. .. _class_CanvasItem_get_canvas_transform: - :ref:`Transform2D` **get_canvas_transform** **(** **)** const Get the transform matrix of this item's canvas. .. _class_CanvasItem_get_global_mouse_position: - :ref:`Vector2` **get_global_mouse_position** **(** **)** const Get the global position of the mouse. .. _class_CanvasItem_get_global_transform: - :ref:`Transform2D` **get_global_transform** **(** **)** const Get the global transform matrix of this item. .. _class_CanvasItem_get_global_transform_with_canvas: - :ref:`Transform2D` **get_global_transform_with_canvas** **(** **)** const Get the global transform matrix of this item in relation to the canvas. .. _class_CanvasItem_get_item_and_children_rect: - :ref:`Rect2` **get_item_and_children_rect** **(** **)** const Get a :ref:`Rect2` with the boundaries of this item and its children. .. _class_CanvasItem_get_item_rect: - :ref:`Rect2` **get_item_rect** **(** **)** const Return a rect containing the editable boundaries of the item. .. _class_CanvasItem_get_light_mask: - :ref:`int` **get_light_mask** **(** **)** const Get this item's light mask number. .. _class_CanvasItem_get_local_mouse_pos: - :ref:`Vector2` **get_local_mouse_pos** **(** **)** const Get the mouse position relative to this item's position. .. _class_CanvasItem_get_material: - :ref:`Material` **get_material** **(** **)** const Get the material of this item. .. _class_CanvasItem_get_modulate: - :ref:`Color` **get_modulate** **(** **)** const Get the modulate of the CanvasItem, which affects children items too. .. _class_CanvasItem_get_self_modulate: - :ref:`Color` **get_self_modulate** **(** **)** const Get the self-modulate of the CanvasItem. .. _class_CanvasItem_get_transform: - :ref:`Transform2D` **get_transform** **(** **)** const Get the transform matrix of this item. .. _class_CanvasItem_get_use_parent_material: - :ref:`bool` **get_use_parent_material** **(** **)** const Get whether this item uses its parent's material. .. _class_CanvasItem_get_viewport_rect: - :ref:`Rect2` **get_viewport_rect** **(** **)** const Get the viewport's boundaries as a :ref:`Rect2`. .. _class_CanvasItem_get_viewport_transform: - :ref:`Transform2D` **get_viewport_transform** **(** **)** const Get this item's transform in relation to the viewport. .. _class_CanvasItem_get_world_2d: - :ref:`World2D` **get_world_2d** **(** **)** const Get the :ref:`World2D` where this item is in. .. _class_CanvasItem_hide: - void **hide** **(** **)** Hide the CanvasItem currently visible. .. _class_CanvasItem_is_draw_behind_parent_enabled: - :ref:`bool` **is_draw_behind_parent_enabled** **(** **)** const Return whether the item is drawn behind its parent. .. _class_CanvasItem_is_local_transform_notification_enabled: - :ref:`bool` **is_local_transform_notification_enabled** **(** **)** const .. _class_CanvasItem_is_set_as_toplevel: - :ref:`bool` **is_set_as_toplevel** **(** **)** const Return if set as toplevel. See :ref:`set_as_toplevel`. .. _class_CanvasItem_is_transform_notification_enabled: - :ref:`bool` **is_transform_notification_enabled** **(** **)** const .. _class_CanvasItem_is_visible: - :ref:`bool` **is_visible** **(** **)** const Return true if this CanvasItem is visible. It may be invisible because itself or a parent canvas item is hidden. .. _class_CanvasItem_is_visible_in_tree: - :ref:`bool` **is_visible_in_tree** **(** **)** const .. _class_CanvasItem_make_canvas_pos_local: - :ref:`Vector2` **make_canvas_pos_local** **(** :ref:`Vector2` screen_point **)** const .. _class_CanvasItem_make_input_local: - :ref:`InputEvent` **make_input_local** **(** :ref:`InputEvent` event **)** const .. _class_CanvasItem_set_as_toplevel: - void **set_as_toplevel** **(** :ref:`bool` enable **)** Set as top level. This means that it will not inherit transform from parent canvas items. .. _class_CanvasItem_set_draw_behind_parent: - void **set_draw_behind_parent** **(** :ref:`bool` enable **)** Set whether the canvas item is drawn behind its parent. .. _class_CanvasItem_set_light_mask: - void **set_light_mask** **(** :ref:`int` light_mask **)** Set the ligtht mask number of this item. .. _class_CanvasItem_set_material: - void **set_material** **(** :ref:`Material` material **)** Set the material of this item. .. _class_CanvasItem_set_modulate: - void **set_modulate** **(** :ref:`Color` modulate **)** Set the modulate of the CanvasItem. This *affects* the modulation of children items. .. _class_CanvasItem_set_notify_local_transform: - void **set_notify_local_transform** **(** :ref:`bool` enable **)** .. _class_CanvasItem_set_notify_transform: - void **set_notify_transform** **(** :ref:`bool` enable **)** .. _class_CanvasItem_set_self_modulate: - void **set_self_modulate** **(** :ref:`Color` self_modulate **)** Set the self-modulate of the CanvasItem. This does not affect the modulation of children items. .. _class_CanvasItem_set_use_parent_material: - void **set_use_parent_material** **(** :ref:`bool` enable **)** Set whether or not this item should use its parent's material. .. _class_CanvasItem_set_visible: - void **set_visible** **(** :ref:`bool` visible **)** Set whether this item should be visible or not. Note that a hidden CanvasItem will make all children hidden too, so no matter what is set here this item won't be shown if its parent or grandparents nodes are hidden. .. _class_CanvasItem_show: - void **show** **(** **)** Show the CanvasItem currently hidden. .. _class_CanvasItem_update: - void **update** **(** **)** Queue the CanvasItem for update. ``NOTIFICATION_DRAW`` will be called on idle time to request redraw.