Packagegraphics.drawing
Classpublic dynamic class Canvas
InheritanceCanvas Inheritance Pen Inheritance flash.utils.Proxy

The Canvas pen is used to draw a complex shape with differents points in a data model.

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() ;
     



Public Properties
 PropertyDefined By
 Inheritedalign : uint
Determinates the align value of the pen.
Pen
  data : Array
Determinates the array representation of the model of this canvas.
Canvas
 Inheritedfill : IFillStyle
Determinates the fill style object of the pen.
Pen
 Inheritedgraphics : *
Specifies the Graphics object belonging to this Shape object, where vector drawing commands can occur.
Pen
 Inheritedline : ILineStyle
Determinates the line style object of the pen.
Pen
  transform : Function
Apply a transform method in this Canvas.
Canvas
 InheriteduseClear : Boolean = true
Indicates if the clear() method is invoked at the end of the draw method.
Pen
 InheriteduseEndFill : Boolean = true
Indicates if the endFill() method is invoked at the end of the draw method.
Pen
Public Methods
 MethodDefined By
  
Canvas(graphic:*, data:Array = null)
Creates a new Canvas instance.
Canvas
 Inherited
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
 Inherited
CL():void
Defines a shortcut reference to used the clear method.
Pen
  
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
 Inherited
EF():void
Defines a shortcut reference to used the endFill method.
Pen
 Inherited
F(... arguments):void
Defines a shortcut reference to used the beginFill method.
Pen
 Inherited
GF(... arguments):void
Defines a shortcut reference to used the beginGradientFill method.
Pen
 Inherited
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
  
Converts the lines in the model to curves.
Canvas
  
M(... arguments):void
[override] Defines a shortcut reference to used the moveTo method.
Canvas
  
process(graphics:Graphics, pen:Canvas):void
[static] This static method launch the process to draw in a specified movieclip target the canvas defined with the (
Canvas
 Inherited
S(... arguments):void
Defines a shortcut reference to used the lineStyle method.
Pen
  
size():Number
Returns the number of elements in the model.
Canvas
Property Detail
dataproperty
data:Array

Determinates the array representation of the model of this canvas.


Implementation
    public function get data():Array
    public function set data(value:Array):void
transformproperty 
transform:Function

Apply a transform method in this Canvas. Uses the CanvasTransform tool class and this static methods.


Implementation
    public function get transform():Function
    public function set transform(value:Function):void

See also

CanvasTransform.
Constructor Detail
Canvas()Constructor
public function Canvas(graphic:*, data:Array = null)

Creates a new Canvas instance.

Parameters
graphic:* — 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.
Method Detail
C()method
override public function C(... arguments):void

Defines a shortcut reference to used the curveTo method.

Parameters

... arguments

curvesToLines()method 
public function curvesToLines():void

Converts the curves in the model to lines.

draw()method 
override public function draw(... arguments):void

Draws the shape.

Parameters

... arguments — The array representation of all items of the canvas to draw the shape.

drawShape()method 
override public function drawShape():void

This 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():void

Converts 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):void

This 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.


Throws
NullPointerError — The Canvas process failed with a 'null' or 'undefined' graphics reference in argument.") ;
size()method 
public function size():Number

Returns the number of elements in the model.

Returns
Number — the number of elements in the model.