Overridable function called by the engine (if defined) to draw the canvas item.
Draws an arc between the given angles. The larger the value of point_count, the smoother the curve.
Draws a string character using a custom font. Returns the advance, depending on the character width and kerning with an optional next character.
Draws a colored circle.
Draws a colored polygon of any amount of points, convex or concave.
Draws a line from a 2D point to another, with a given color and width. It can be optionally antialiased.
Draws a Mesh in 2D, using the provided texture. See MeshInstance2D for related documentation.
Draws multiple, parallel lines with a uniform color. Note: width and antialiased are currently not implemented and have no effect.
Draws multiple, parallel lines with a uniform width and segment-by-segment coloring. Colors assigned to line segments match by index between points and colors. Note: width and antialiased are currently not implemented and have no effect.
Draws a MultiMesh in 2D with the provided texture. See MultiMeshInstance2D for related documentation.
Draws a polygon of any amount of points, convex or concave.
Draws interconnected line segments with a uniform color and width and optional antialiasing.
Draws interconnected line segments with a uniform width, segment-by-segment coloring, and optional antialiasing. Colors assigned to line segments match by index between points and colors.
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.
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. If antialiased is true, the lines will be antialiased. Note: width and antialiased are only effective if filled is false.
Sets a custom transform for drawing via components. Anything drawn afterwards will be transformed by this.
Sets a custom transform for drawing via matrix. Anything drawn afterwards will be transformed by this.
Draws text using the specified font at the position (bottom-left corner using the baseline of the font). The text will have its color multiplied by modulate. If clip_w is greater than or equal to 0, the text will be clipped if it exceeds the specified width. Example using the default project font:
Draws a styled rectangle.
Draws a texture at a given position.
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.
Draws a textured rectangle region at a given position, optionally modulated by a color. If transpose is true, the texture will have its X and Y coordinates swapped.
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.
Returns the RID of the World2D canvas where this item is in.
Returns the canvas item RID used by VisualServer for this item.
Returns the transform matrix of this item's canvas.
Returns the global position of the mouse.
Returns the global transform matrix of this item.
Returns the global transform matrix of this item in relation to the canvas.
Returns the mouse position relative to this item's position.
Returns the transform matrix of this item.
Returns the viewport's boundaries as a Rect2.
Returns this item's transform in relation to the viewport.
Returns the World2D where this item is in.
Hide the CanvasItem if it's currently visible.
Returns true if local transform notifications are communicated to children.
Returns true if the node is set as top-level. See setAsToplevel.
Returns true if global transform notifications are communicated to children.
Returns true if the node is present in the SceneTree, its visible property is true and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree.
Assigns screen_point as this node's new local transform.
Transformations issued by event's inputs are applied in local space instead of global space.
If enable is true, the node won't inherit its transform from parent canvas items.
If enable is true, children will be updated with local transform data.
If enable is true, children will be updated with global transform data.
Show the CanvasItem if it's currently hidden. For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead.
Queue the CanvasItem for update. constant NOTIFICATION_DRAW will be called on idle time to request redraw.
The rendering layers in which this CanvasItem responds to Light2D nodes.
The color applied to textures on this CanvasItem.
The color applied to textures on this CanvasItem. This is not inherited by children CanvasItems.
If true, the object draws behind its parent.
If true, the object draws on top of its parent.
If true, the parent CanvasItem's material property is used as this one's material.
If true, this CanvasItem is drawn. The node is only visible if all of its antecedents are visible as well (in other words, isVisibleInTree must return true). Note: For controls that inherit Popup, the correct way to make them visible is to call one of the multiple popup*() functions instead.
Construct a new instance of CanvasItem. Note: use memnew!CanvasItem instead.
Base class of anything 2D.
Canvas items are laid out in a tree; children inherit and extend their parent's transform. CanvasItem is extended by Control for anything GUI-related, and by Node2D for anything related to the 2D engine. Any CanvasItem can draw. For this, update must be called, then constant NOTIFICATION_DRAW will be received on idle time to request 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 the GodotObject._notification, signal or _draw virtual functions. Canvas items are drawn in tree order. 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. A CanvasItem can also be hidden, which will also hide its children. It provides many ways to change parameters such as modulation (for itself and its children) and self modulation (only for itself), as well as its 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. Note: Unless otherwise specified, all methods that have angle parameters must have angles specified as radians. To convert degrees to radians, use @GDScript.deg2rad.