Packagecom.nocircleno.graffiti.tools
Classpublic final class BrushTool
InheritanceBrushTool Inheritance BitmapTool Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 10 - AIR 1.5

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



Public Properties
 PropertyDefined By
  alpha : Number
BrushTool
  blur : Number
BrushTool
  color : uint
BrushTool
 InheritedlayerType : String
[read-only] Layer Tool Writes to
BitmapTool
 Inheritedmode : String
BitmapTool
 InheritedrenderType : String
[read-only] Render Type
BitmapTool
  size : Number
BrushTool
  type : String
Type of brush
BrushTool
Protected Properties
 PropertyDefined By
 Inheritedcommands : Vector.<int>
BitmapTool
 InheriteddrawingData : Vector.<Number>
BitmapTool
 Inherited_mode : String
BitmapTool
 Inherited_renderType : String
BitmapTool
 Inherited_type : String
BitmapTool
Public Methods
 MethodDefined By
  
BrushTool(brushSize:Number = 4, brushColor:uint = 0x000000, brushAlpha:Number = 1, brushBlur:Number = 0, brushType:String = null, toolMode:String = null)
The BrushTool constructor.
BrushTool
  
apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void
The apply method applies the brush to the DisplayObject passed to the method.
BrushTool
  
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.
BrushTool
 Inherited
resetTool():void
The resetTool method will reset the drawing data held by the tool.
BitmapTool
Protected Constants
 ConstantDefined By
 InheritedLAYER_TYPE : String = drawingLayer
BitmapTool
Property Detail
alphaproperty
alpha:Number  [read-write]


Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
blurproperty 
blur:Number  [read-write]


Implementation
    public function get blur():Number
    public function set blur(value:Number):void
colorproperty 
color:uint  [read-write]


Implementation
    public function get color():uint
    public function set color(value:uint):void
sizeproperty 
size:Number  [read-write]


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

Type of brush


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

The BrushTool constructor.

Parameters
brushSize:Number (default = 4) — Size of the brush.
 
brushColor:uint (default = 0x000000) — Color of the brush.
 
brushAlpha:Number (default = 1) — Alpha value of the brush.
 
brushBlur:Number (default = 0) — Blur value 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
        var diamondBrush:BrushTool = new BrushTool(8, 0xFF0000, 1, 0, BrushType.DIAMOND);
        
Method Detail
apply()method
override public function apply(drawingTarget:DisplayObject, point1:Point, point2:Point = null):void

The apply method applies the brush to the DisplayObject 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.