WebCanvasSurface class

A DrawSurface backed by a browser web.CanvasRenderingContext2D.

All Xojo Graphics calls map onto Canvas 2D here (see docs/porting-from-xojo.md for the translation table). The surface owns only the drawing context — geometry is decided by the layout + painter.

Implemented types
Mixed-in types

Constructors

WebCanvasSurface(CanvasRenderingContext2D ctx)

Properties

boldState → bool
no setterinherited
ctx → CanvasRenderingContext2D
final
fillState → String
no setterinherited
fontSizeState → double
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
lineWidthState → double
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
strokeState → String
no setterinherited

Methods

clear() → void
Clears the whole surface (canvas reset).
override
drawIcon(String iconKey, double x, double y, double size, {bool disabled = false}) → bool
Draws a registered icon (iconKey) into the given square, or returns false so the caller can render a placeholder glyph. When disabled is true the implementation should apply a ~40% alpha (Xojo Transparency).
override
fillRect(double x, double y, double w, double h) → void
Fills a rectangle with the current fill colour (g.FillRectangle).
override
fillRoundRect(double x, double y, double w, double h, double r) → void
Fills a rounded rectangle with the current fill colour (g.FillRoundRectangle).
override
fillText(String text, double x, double y) → void
Draws text at (x, y) baseline (g.DrawText).
override
line(double x1, double y1, double x2, double y2) → void
Draws a line between two points (g.DrawLine).
override
measureTextWidth(String text) → double
Width of text at the currently set font — mirrors Xojo g.TextWidth.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setFill(String css) → void
inherited
setFont({required double size, bool bold = false}) → void
inherited
setLineWidth(double w) → void
inherited
setStroke(String css) → void
inherited
strokeRoundRect(double x, double y, double w, double h, double r) → void
Strokes a rounded rectangle with the current stroke colour (g.DrawRoundRectangle).
override
textHeight() → double
Approximate text height at the current font — mirrors Xojo g.TextHeight.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited