| Package | graphics.drawing |
| Class | public dynamic class Canvas |
| Inheritance | Canvas Pen flash.utils.Proxy |
Example :
import graphics.drawing.Canvas ;
var shape:Shape = new Shape() ;
shape.x = 200 ;
shape.y = 200 ;
addChild(shape) ;
var data:Array =
[
['S',[2, 0xFFFFFF, 100]] , // lineStyle(2, 0xFFFFFF, 100)
['F',[0xFF0000, 100]] , // beginFill(0xFF0000)
['M',[0,0]] , // moveTo (0,0)
['L',[80,90]] , // lineTo (80,90)
['L',[20,90]] , // lineTo (20,90)
['L',[20,50]], // lineTo (20,50)
['EF'] // endFill ()
] ;
var pen:Canvas = new Canvas( shape.graphics , data) ;
pen.draw() ;
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
Determinates the align value of the pen. | Pen | |
| data : Array
Determinates the array representation of the model of this canvas. | Canvas | ||
![]() | fill : IFillStyle
Determinates the fill style object of the pen. | Pen | |
![]() | graphics : *
Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur. | Pen | |
![]() | line : ILineStyle
Determinates the line style object of the pen. | Pen | |
| transform : Function
Apply a transform method in this Canvas. | Canvas | ||
![]() | useClear : Boolean = true
Indicates if the clear() method is invoked at the end of the draw method. | Pen | |
![]() | useEndFill : Boolean = true
Indicates if the endFill() method is invoked at the end of the draw method. | Pen | |
| Method | Defined By | ||
|---|---|---|---|
Canvas(graphic:*, data:Array = null)
Creates a new Canvas instance. | Canvas | ||
![]() | BF(... arguments):void
Defines a shortcut reference to used the beginBitmapFill method. | Pen | |
C(... arguments):void [override]
Defines a shortcut reference to used the curveTo method. | Canvas | ||
![]() | CL():void
Defines a shortcut reference to used the clear method. | Pen | |
curvesToLines():void
Converts the curves in the model to lines. | Canvas | ||
draw(... arguments):void [override]
Draws the shape. | Canvas | ||
drawShape():void [override]
This method contains the basic drawing shape algorithm. | Canvas | ||
![]() | EF():void
Defines a shortcut reference to used the endFill method. | Pen | |
![]() | F(... arguments):void
Defines a shortcut reference to used the beginFill method. | Pen | |
![]() | GF(... arguments):void
Defines a shortcut reference to used the beginGradientFill method. | Pen | |
![]() | GS(... arguments):void
Defines a shortcut reference to used the lineGradientStyle method. | Pen | |
L(... arguments):void [override]
Defines a shortcut reference to used the lineTo method. | Canvas | ||
linesToCurves():void
Converts the lines in the model to curves. | Canvas | ||
M(... arguments):void [override]
Defines a shortcut reference to used the moveTo method. | Canvas | ||
[static]
This static method launch the process to draw in a specified movieclip target the canvas defined with the ( | Canvas | ||
![]() | S(... arguments):void
Defines a shortcut reference to used the lineStyle method. | Pen | |
size():Number
Returns the number of elements in the model. | Canvas | ||
| data | property |
data:ArrayDeterminates the array representation of the model of this canvas.
public function get data():Array public function set data(value:Array):void| transform | property |
transform:Function
Apply a transform method in this Canvas. Uses the CanvasTransform tool class and this static methods.
public function get transform():Function public function set transform(value:Function):voidSee also
| Canvas | () | Constructor |
public function Canvas(graphic:*, data:Array = null)Creates a new Canvas instance.
Parametersgraphic:* — The Graphics reference to control with this helper. You can passed-in a Shape or Sprite/MovieClip reference in argument.
| |
data:Array (default = null) — An Array to fill of x/y points the model of the canvas.
|
| C | () | method |
override public function C(... arguments):void
Defines a shortcut reference to used the curveTo method.
Parameters
... arguments |
| curvesToLines | () | method |
public function curvesToLines():voidConverts the curves in the model to lines.
| draw | () | method |
override public function draw(... arguments):voidDraws the shape.
Parameters
... arguments — The array representation of all items of the canvas to draw the shape.
|
| drawShape | () | method |
override public function drawShape():voidThis method contains the basic drawing shape algorithm.
| L | () | method |
override public function L(... arguments):void
Defines a shortcut reference to used the lineTo method.
Parameters
... arguments |
| linesToCurves | () | method |
public function linesToCurves():voidConverts the lines in the model to curves.
| M | () | method |
override public function M(... arguments):void
Defines a shortcut reference to used the moveTo method.
Parameters
... arguments |
| process | () | method |
public static function process(graphics:Graphics, pen:Canvas):voidThis static method launch the process to draw in a specified movieclip target the canvas defined with the (
Parameters
graphics:Graphics — the Graphics reference.
| |
pen:Canvas — the Canvas reference used to draw in the target reference.
|
NullPointerError — The Canvas process failed with a 'null' or 'undefined' graphics reference in argument.") ;
|
| size | () | method |
public function size():NumberReturns the number of elements in the model.
ReturnsNumber — the number of elements in the model.
|