Base class of anything 2D. 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 [Control], for anything GUI related, and by [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. Called (if exists) to draw the canvas item. Draw a string character using a custom font. Returns the advance, depending on the char width and kerning with an optional next char. Draw a colored circle. Draw a colored polygon of any amount of points, convex or concave. Draw a line from a 2D point to another, with a given color and width. It can be optionally antialiased. Draw a polygon of any amount of points, convex or concave. 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. Draw a colored rectangle. Set a custom transform for drawing. Anything drawn afterwards will be transformed by this. Draw a string using a custom font. Draw a styled rectangle. Draw a texture at a given position. Draw a textured rectangle at a given position, optionally modulated by a color. Transpose swaps the x and y coordinates when reading the texture. 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. Return the [RID] of the [World2D] canvas where this item is in. Return the canvas item RID used by [VisualServer] for this item. Get the transform matrix of this item's canvas. Get the global position of the mouse. Get the global transform matrix of this item. Get the global transform matrix of this item in relation to the canvas. Get the mouse position relative to this item's position. Get the transform matrix of this item. Get the viewport's boundaries as a [Rect2]. Get this item's transform in relation to the viewport. Get the [World2D] where this item is in. Hide the CanvasItem currently visible. Return if set as toplevel. See [method set_as_toplevel]. Set as top level. This means that it will not inherit transform from parent canvas items. Show the CanvasItem currently hidden. Queue the CanvasItem for update. [code]NOTIFICATION_DRAW[/code] will be called on idle time to request redraw. Emitted when the CanvasItem must redraw. This can only be connected realtime, as deferred will not allow drawing. Emitted when becoming hidden. Emitted when the item rect has changed. Emitted when the visibility (hidden/visible) changes. Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value. Additive blending mode. Subtractive blending mode. Multiplicative blending mode. Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value. Canvas item transform has changed. Only received if requested. CanvasItem is requested to draw. Canvas item visibility has changed. Canvas item has entered the canvas. Canvas item has exited the canvas.