Graphics class

A vector graphics drawing surface.

Example:

// draw a red circle
var shape = Shape();
shape.graphics.circle(100, 100, 60);
shape.graphics.fillColor(Color.Red);
stage.addChild(shape);

Note: Stroke and fill operations act on the preceding vector drawing operations.

Constructors

Graphics()

Properties

bounds Rectangle<num>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addCommand(GraphicsCommand command) → void
Add a custom graphics command
arc(num x, num y, num radius, num startAngle, num endAngle, [bool antiClockwise = false]) GraphicsCommandArc
Draw an arc at x and y.
arcElliptical(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, [bool antiClockwise = false]) GraphicsCommandArcElliptical
Draw an arc at x and y.
arcTo(num controlX, num controlY, num endX, num endY, num radius) GraphicsCommandArcTo
From the current point in the path, draw an arc to endX and endY
beginPath() GraphicsCommandBeginPath
Start drawing a freeform path.
bezierCurveTo(num controlX1, num controlY1, num controlX2, num controlY2, num endX, num endY) GraphicsCommandBezierCurveTo
From the current point in the path, draw a bezier curve to endX and endY
circle(num x, num y, num radius, [bool antiClockwise = false]) GraphicsCommandCircle
Draw a circle at x and y
clear() → void
Clear all previously added graphics commands.
closePath() GraphicsCommandClosePath
Stop drawing a freeform path.
decode(String text) GraphicsCommandDecode
Decode the path that is encoded in the EaselJS format. Please use the decodePath method.
decodePath(String path, [PathEncoding pathEncoding = PathEncoding.SVG]) GraphicsCommandDecode
ellipse(num x, num y, num width, num height) GraphicsCommandEllipse
Draw an ellipse at x and y
fillColor(int color) GraphicsCommandFillColor
Apply a fill color to the previously drawn vector object.
fillGradient(GraphicsGradient gradient) GraphicsCommandFillGradient
Apply a fill gradient to the previously drawn vector object.
fillPattern(GraphicsPattern pattern) GraphicsCommandFillPattern
Apply a fill pattern to the previously drawn vector object.
hitTest(num localX, num localY) bool
lineTo(num x, num y) GraphicsCommandLineTo
From the current point in the path, draw a line to x and y
moveTo(num x, num y) GraphicsCommandMoveTo
Moves the next point in the path to x and y
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
quadraticCurveTo(num controlX, num controlY, num endX, num endY) GraphicsCommandQuadraticCurveTo
From the current point in the path, draw a quadratic curve to endX and endY
rect(num x, num y, num width, num height) GraphicsCommandRect
Draw a rectangle at x and y
rectRound(num x, num y, num width, num height, num ellipseWidth, num ellipseHeight) GraphicsCommandRectRound
Draw a rounded rectangle at x and y.
render(RenderState renderState) → void
renderMask(RenderState renderState) → void
strokeColor(int color, [num width = 1.0, JointStyle jointStyle = JointStyle.MITER, CapsStyle capsStyle = CapsStyle.NONE]) GraphicsCommandStrokeColor
Apply a stroke color to the previously drawn vector object.
strokeGradient(GraphicsGradient gradient, [num width = 1.0, JointStyle jointStyle = JointStyle.MITER, CapsStyle capsStyle = CapsStyle.NONE]) GraphicsCommandStrokeGradient
Apply a stroke color to the previously drawn vector object.
strokePattern(GraphicsPattern pattern, [num width = 1.0, JointStyle jointStyle = JointStyle.MITER, CapsStyle capsStyle = CapsStyle.NONE]) GraphicsCommandStrokePattern
Apply a stroke pattern to the previously drawn vector object.
toString() String
A string representation of this object.
inherited
undoCommand() → void
Undo last graphics command

Operators

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