Packagecom.nocircleno.graffiti.tools
Classpublic class Brush
InheritanceBrush Inheritance Object
Implements ITool

Brush Class allows the user to paint anti-alias shapes to the Canvas.



Public Properties
 PropertyDefined By
  color : uint
Brush
  mode : String
Brush
  renderType : String
[read-only] Brush Render Mode
Brush
  size : Number
Brush
  type : String
Brush
Public Methods
 MethodDefined By
  
Brush(brushSize:Number = 4, brushColor:uint = 0x000000, brushType:String = null, toolMode:String = null)
The Brush constructor.
Brush
  
apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void
The apply method applies the brush to the Sprite object passed to the method.
Brush
  
generateBrush(brushSize:Number = 0, brushColor:int = -1):Sprite
The generateBrush method creates a visual representation of the Brush that could be used for a button or a cursor.
Brush
Property Detail
colorproperty
color:uint  [read-write]


Implementation
    public function get color():uint
    public function set color(value:uint):void
modeproperty 
mode:String  [read-write]


Implementation
    public function get mode():String
    public function set mode(value:String):void
renderTypeproperty 
renderType:String  [read-only]

Brush Render Mode


Implementation
    public function get renderType():String
sizeproperty 
size:Number  [read-write]


Implementation
    public function get size():Number
    public function set size(value:Number):void
typeproperty 
type:String  [read-write]


Implementation
    public function get type():String
    public function set type(value:String):void
Constructor Detail
Brush()Constructor
public function Brush(brushSize:Number = 4, brushColor:uint = 0x000000, brushType:String = null, toolMode:String = null)

The Brush constructor.

Parameters
brushSize:Number (default = 4) — Size of the brush.
 
brushColor:uint (default = 0x000000) — Color of the brush.
 
brushType:String (default = null) — Type of Brush
 
toolMode:String (default = null) — Tool mode the Brush will be drawing with.

Example
The following code creates a Brush instance.
        // create a diamond brush of size 8 and the color of red
        var diamondBrush:Brush = new Brush(8, 0xFF0000, BrushType.DIAMOND);
        
Method Detail
apply()method
public function apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void

The apply method applies the brush to the Sprite object passed to the method. We use two point due to the delay in Mouse Events to create continuous brush strokes.

Parameters

drawingTarget:DisplayObject — Sprite that the brush will draw to.
 
point1:Point — Starting point to apply brush.
 
point2:Point (default = null) — End point to apply brush.

generateBrush()method 
public function generateBrush(brushSize:Number = 0, brushColor:int = -1):Sprite

The generateBrush method creates a visual representation of the Brush that could be used for a button or a cursor.

Parameters

brushSize:Number (default = 0) — Size of the brush, if you don't want to use the defined size.
 
brushColor:int (default = -1) — Color of the brush, if you don't want to use the defined color.

Returns
Sprite — A Sprite object containing the brush.