-
Notifications
You must be signed in to change notification settings - Fork 0
CanvasItem
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.CanvasItem |
| Namespace | Electron2D |
| Kind | class |
| Category | Rendering |
Provides the Electron2D base node for items that can be drawn on a 2D canvas.
public class Electron2D.CanvasItem : Electron2D.NodeProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: CanvasItem
Visibility, inherited modulate, self-modulate, z-index, y-sort flag, show/hide and GetWorld2D() baseline.
CanvasItem owns visibility, color modulation and draw-order properties for
2D nodes. Electron2D 0.1.0 Preview implements the subset required by
Node2D, Sprite2D and internal sprite submission.
Visibility and Modulate are inherited only through direct CanvasItem
ancestors. A plain Electron2D.Node between two canvas items breaks the
inherited canvas chain, matching the canvas inheritance behavior used by this preview.
This type is not synchronized. Create and mutate canvas items on the main thread that owns the scene tree.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.Node2DElectron2D.Sprite2D
| Member | Kind | Summary |
|---|---|---|
Modulate |
Property | Gets or sets the color multiplied into this item and its direct canvas descendants. |
SelfModulate |
Property | Gets or sets the color multiplied into this item only. |
Visible |
Property | Gets or sets whether this canvas item is visible. |
YSortEnabled |
Property | Gets or sets whether this item participates in Y-sort ordering. |
ZIndex |
Property | Gets or sets the 2D draw-order index inside the current canvas layer. |
Electron2D.CanvasItem() |
Constructor | Initializes a new instance of the CanvasItem type. |
DrawCircle(Electron2D.Vector2, System.Single, Electron2D.Color, System.Boolean, System.Single, System.Boolean) |
Method | Draws a filled or stroked circle in local space. |
DrawLine(Electron2D.Vector2, Electron2D.Vector2, Electron2D.Color, System.Single, System.Boolean) |
Method | Draws a line between two local-space points. |
DrawPolygon(Electron2D.Vector2[], Electron2D.Color[], Electron2D.Vector2[], Electron2D.Texture2D) |
Method | Draws a solid polygon using per-point colors. |
DrawRect(Electron2D.Rect2, Electron2D.Color, System.Boolean, System.Single, System.Boolean) |
Method | Draws a filled or stroked rectangle in local space. |
DrawString(Electron2D.Font, Electron2D.Vector2, System.String, Electron2D.HorizontalAlignment, System.Single, System.Int32, Electron2D.Color?) |
Method | Draws text using a font at a local-space baseline position. |
DrawTexture(Electron2D.Texture2D, Electron2D.Vector2, Electron2D.Color?) |
Method | Draws a texture at a local-space position. |
GetWorld2D() |
Method | Gets the 2D world associated with this canvas item. |
Hide() |
Method | Hides this canvas item. |
IsVisibleInTree() |
Method | Checks whether this canvas item is visible after direct canvas ancestors are considered. |
QueueRedraw() |
Method | Queues this canvas item to redraw during the next processed frame. |
Show() |
Method | Shows this canvas item. |
_Draw() |
Method | Called when this canvas item has been requested to redraw. |
Kind: Property
public Electron2D.Color Modulate { get; set; }Gets or sets the color multiplied into this item and its direct canvas descendants.
The default value is Electron2D.Color.White. During submission,
inherited Modulate values are multiplied before the current
Electron2D.CanvasItem.SelfModulate is applied to the current item.
The current modulate value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.SelfModulate
Kind: Property
public Electron2D.Color SelfModulate { get; set; }Gets or sets the color multiplied into this item only.
SelfModulate does not affect children. Use Electron2D.CanvasItem.Modulate
when a color should be inherited by direct canvas descendants.
The current self modulate value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.Modulate
Kind: Property
public System.Boolean Visible { get; set; }Gets or sets whether this canvas item is visible.
Hidden canvas items also hide direct CanvasItem descendants in the
inherited canvas chain. Descendants separated by a non-CanvasItem
node start a new independent canvas chain.
The current visible value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Property
public System.Boolean YSortEnabled { get; set; }Gets or sets whether this item participates in Y-sort ordering.
Electron2D 0.1.0 Preview forwards this flag to the internal render queue. The full Y-sort container behavior is intentionally limited to the existing queue ordering rules.
The current ysort enabled value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Property
public System.Int32 ZIndex { get; set; }Gets or sets the 2D draw-order index inside the current canvas layer.
Lower values are drawn before higher values within the same
Electron2D.CanvasLayer. Layer order still has priority over
ZIndex.
The current zindex value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Constructor
public Electron2D.CanvasItem()Initializes a new instance of the CanvasItem type.
The new instance follows the lifetime and validation rules of its declaring type.
This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.
This API is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
DrawCircle(Electron2D.Vector2, System.Single, Electron2D.Color, System.Boolean, System.Single, System.Boolean)
Kind: Method
public System.Void DrawCircle(Electron2D.Vector2, System.Single, Electron2D.Color, System.Boolean, System.Single, System.Boolean)(Electron2D.Vector2 position, System.Single radius, Electron2D.Color color, System.Boolean filled, System.Single width, System.Boolean antialiased)Draws a filled or stroked circle in local space.
This method follows the validation and lifetime rules of its declaring type.
-
position: The local-space circle center. -
radius: The circle radius. It must be finite and non-negative. -
color: The circle color. -
filled: Whether the circle should be filled. -
width: The stroke width used whenfilledisfalse. -
antialiased: Whether the stroke should request antialiasing when supported.
-
System.ArgumentOutOfRangeException: Thrown whenradiusis negative or not finite.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public System.Void DrawLine(Electron2D.Vector2, Electron2D.Vector2, Electron2D.Color, System.Single, System.Boolean)(Electron2D.Vector2 from, Electron2D.Vector2 to, Electron2D.Color color, System.Single width, System.Boolean antialiased)Draws a line between two local-space points.
This method follows the validation and lifetime rules of its declaring type.
-
from: The local-space start point. -
to: The local-space end point. -
color: The line color. -
width: The line width. Negative values represent a thin non-scaling primitive line. -
antialiased: Whether the line should request antialiasing when supported.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public System.Void DrawPolygon(Electron2D.Vector2[], Electron2D.Color[], Electron2D.Vector2[], Electron2D.Texture2D)(Electron2D.Vector2[] points, Electron2D.Color[] colors, Electron2D.Vector2[] uvs, Electron2D.Texture2D texture)Draws a solid polygon using per-point colors.
This method follows the validation and lifetime rules of its declaring type.
-
points: The local-space polygon points. At least three points are required. -
colors: The colors for each point. The array length must matchpoints. -
uvs: Optional texture coordinates. When provided, the array length must matchpoints. -
texture: An optional texture sampled by the polygon.
-
System.ArgumentException: Thrown when the point, color or UV arrays do not describe a valid polygon.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public System.Void DrawRect(Electron2D.Rect2, Electron2D.Color, System.Boolean, System.Single, System.Boolean)(Electron2D.Rect2 rect, Electron2D.Color color, System.Boolean filled, System.Single width, System.Boolean antialiased)Draws a filled or stroked rectangle in local space.
This method follows the validation and lifetime rules of its declaring type.
-
rect: The local-space rectangle. -
color: The rectangle color. -
filled: Whether the rectangle should be filled. -
width: The stroke width used whenfilledisfalse. -
antialiased: Whether the stroke should request antialiasing when supported.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
DrawString(Electron2D.Font, Electron2D.Vector2, System.String, Electron2D.HorizontalAlignment, System.Single, System.Int32, Electron2D.Color?)
Kind: Method
public System.Void DrawString(Electron2D.Font, Electron2D.Vector2, System.String, Electron2D.HorizontalAlignment, System.Single, System.Int32, Electron2D.Color?)(Electron2D.Font font, Electron2D.Vector2 position, System.String text, Electron2D.HorizontalAlignment alignment, System.Single width, System.Int32 fontSize, Electron2D.Color? modulate)Draws text using a font at a local-space baseline position.
This method follows the validation and lifetime rules of its declaring type.
-
font: The font resource used to draw the text. -
position: The local-space baseline position. -
text: The text to draw. -
alignment: The horizontal alignment used whenwidthis non-negative. -
width: The optional clipping/alignment width. Negative values mean no width limit. -
fontSize: The requested font size in pixels. -
modulate: The optional color multiplied into the text. The default isElectron2D.Color.White.
-
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Font
Kind: Method
public System.Void DrawTexture(Electron2D.Texture2D, Electron2D.Vector2, Electron2D.Color?)(Electron2D.Texture2D texture, Electron2D.Vector2 position, Electron2D.Color? modulate)Draws a texture at a local-space position.
This method follows the validation and lifetime rules of its declaring type.
-
texture: The texture to draw. -
position: The local-space top-left draw position. -
modulate: The optional color multiplied into the texture. The default isElectron2D.Color.White.
This method is not synchronized. Call it only from Electron2D.CanvasItem._Draw
on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public Electron2D.World2D GetWorld2D()()Gets the 2D world associated with this canvas item.
This method follows the validation and lifetime rules of its declaring type.
A Electron2D.World2D object whose direct space state can query the
current Electron2D.SceneTree, or an empty world when this item is not
inside a tree.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public System.Void Hide()()Hides this canvas item.
This is equivalent to setting Electron2D.CanvasItem.Visible to false.
Direct canvas descendants become hidden through the inherited canvas
chain.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.Show
Kind: Method
public System.Boolean IsVisibleInTree()()Checks whether this canvas item is visible after direct canvas ancestors are considered.
This method follows the validation and lifetime rules of its declaring type.
true when this item and its direct CanvasItem ancestor chain
are visible; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem
Kind: Method
public System.Void QueueRedraw()()Queues this canvas item to redraw during the next processed frame.
Multiple calls before the next frame are coalesced into one
Electron2D.CanvasItem._Draw callback. Cached draw commands remain active until
the callback runs again.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem._Draw
Kind: Method
public System.Void Show()()Shows this canvas item.
This is equivalent to setting Electron2D.CanvasItem.Visible to true.
Ancestor visibility can still make Electron2D.CanvasItem.IsVisibleInTree
return false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.Hide
Kind: Method
public System.Void _Draw()()Called when this canvas item has been requested to redraw.
Override this method and call the Draw* methods from inside the
override. Draw commands are cached and reused until
Electron2D.CanvasItem.QueueRedraw requests another draw callback.
This callback is invoked on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.QueueRedraw
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.