Packagecom.apdevblog.utils
Classpublic class Draw
InheritanceDraw Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9

Class with little helpers for drawing different Shapes.



Public Properties
 PropertyDefined By
  HORIZONTAL : int = 2
[static]
Draw
  VERTICAL : int = 1
[static]
Draw
Public Methods
 MethodDefined By
  
bitmapCircle(offsetX:Number, offsetY:Number, r:Number, bmp:BitmapData, alpha:Number = 1):Shape
[static] draws a circle in a newly created Shape and fills it w/ the specified BitmapData and alpha value.
Draw
  
bitmapRect(w:int, h:int, bmp:BitmapData, alpha:Number):Shape
[static] draws a rectangle in a newly created Shape and fills it with submitted Bitmap.
Draw
  
bitmapRoundedRect(w:int, h:int, radius:int, bmp:BitmapData, alpha:Number):Shape
[static] draws a rectangle with rounded corners in a newly created Shape and fills it with submitted Bitmap.
Draw
  
checkeredRect(w:int, h:int, color32_1:uint, color32_2:uint, alpha:Number = 1):Shape
[static] draws a checkered rectangle in a newly created Shape.
Draw
  
circle(offsetX:Number, offsetY:Number, r:Number, color:Number, alpha:Number = 1):Shape
[static] draws a circle in a newly created Shape and fills it w/ the specified color and alpha value.
Draw
  
cross(w:int, h:int, color:int, alpha:Number = 1, lineWidth:int = 2):Shape
[static] draws a cross (x) in a newly created Shape.
Draw
  
donut(r1:Number, r2:Number, deg:Number, color:int, alpha:Number):Shape
[static] draws a donut in a newly created shape.
Draw
  
dottedLine(length:int, layout:int, color32_1:uint, color32_2:uint, w_1:int = 1, w_2:int = 1, alpha:Number = 1):Shape
[static] draws a dotted line in a newly created Shape.
Draw
  
gradientRect(w:Number, h:Number, rotation:Number, color1:Number, color2:Number, alpha1:Number = 1, alpha2:Number = 1):Shape
[static] draws a rectangle w/ gradient in a newly created Shape.
Draw
  
outline(w:int, h:int, color:int, alpha:Number):Shape
[static] draws an outline in a newly created Shape.
Draw
  
rect(w:Number, h:Number, color:Number, alpha:Number = 1, x:Number = 0, y:Number = 0):Shape
[static] draws a checkered rectangle in a newly created Shape.
Draw
  
roundedRect(x:Number, y:Number, w:Number, h:Number, radius:Number, color:Number, alpha:Number):Shape
[static] draws a rectangle with rounded corners in a newly created Shape and fills it with specified color.
Draw
Public Constants
 ConstantDefined By
  TO_RADIANS : Number
[static]
Draw
Property Detail
HORIZONTALproperty
public static var HORIZONTAL:int = 2

VERTICALproperty 
public static var VERTICAL:int = 1

Method Detail
bitmapCircle()method
public static function bitmapCircle(offsetX:Number, offsetY:Number, r:Number, bmp:BitmapData, alpha:Number = 1):Shape

draws a circle in a newly created Shape and fills it w/ the specified BitmapData and alpha value.

Parameters

offsetX:Number — x position of the circle's center
 
offsetY:Number — y position of the circle's center
 
r:Number — circle's radius
 
bmp:BitmapData — BitmapData the circle will be filled w/
 
alpha:Number (default = 1) — alpha value of the created Shape

Returns
Shape — circular shape
bitmapRect()method 
public static function bitmapRect(w:int, h:int, bmp:BitmapData, alpha:Number):Shape

draws a rectangle in a newly created Shape and fills it with submitted Bitmap.

Parameters

w:int — width of the new rectangle
 
h:int — height of the new rectangle
 
bmp:BitmapData — BitmapData to fill the rect
 
alpha:Number — alpha of the created Shape

Returns
Shape — rectangle shape
bitmapRoundedRect()method 
public static function bitmapRoundedRect(w:int, h:int, radius:int, bmp:BitmapData, alpha:Number):Shape

draws a rectangle with rounded corners in a newly created Shape and fills it with submitted Bitmap.

Parameters

w:int — width of the new rectangle
 
h:int — height of the new rectangle
 
radius:int — corner radius of the new rectangle
 
bmp:BitmapData — BitmapData to fill the rect
 
alpha:Number — alpha of the created Shape

Returns
Shape — rectangle shape with rounded edges
checkeredRect()method 
public static function checkeredRect(w:int, h:int, color32_1:uint, color32_2:uint, alpha:Number = 1):Shape

draws a checkered rectangle in a newly created Shape.

Parameters

w:int — width of the rectangle
 
h:int — height of the rectangle
 
color32_1:uint — color of the first field 0xAARRGGBB
 
color32_2:uint — color of the second field 0xAARRGGBB
 
alpha:Number (default = 1) — alpha of the created Shape

Returns
Shape — checkered rectangle
circle()method 
public static function circle(offsetX:Number, offsetY:Number, r:Number, color:Number, alpha:Number = 1):Shape

draws a circle in a newly created Shape and fills it w/ the specified color and alpha value.

Parameters

offsetX:Number — x position of the circle's center
 
offsetY:Number — y position of the circle's center
 
r:Number — circle's radius
 
color:Number — color the circle will be filled w/
 
alpha:Number (default = 1) — alpha value of the created Shape

Returns
Shape — circular shape
cross()method 
public static function cross(w:int, h:int, color:int, alpha:Number = 1, lineWidth:int = 2):Shape

draws a cross (x) in a newly created Shape.

Parameters

w:int — width of the new cross
 
h:int — height of the new cross
 
color:int — color of the new cross
 
alpha:Number (default = 1) — alpha of the created Shape
 
lineWidth:int (default = 2) — width of the line

Returns
Shape — cross shape
donut()method 
public static function donut(r1:Number, r2:Number, deg:Number, color:int, alpha:Number):Shape

draws a donut in a newly created shape.

Parameters

r1:Number — outer radius
 
r2:Number — inner radius
 
deg:Number — degrees (of a circle)
 
color:int
 
alpha:Number

Returns
Shape
dottedLine()method 
public static function dottedLine(length:int, layout:int, color32_1:uint, color32_2:uint, w_1:int = 1, w_2:int = 1, alpha:Number = 1):Shape

draws a dotted line in a newly created Shape.

Parameters

length:int — length of the line
 
layout:int — orientation of the line (horizontal / vertical)
 
color32_1:uint — color of the dots 0xAARRGGBB
 
color32_2:uint — color of the spaces 0xAARRGGBB
 
w_1:int (default = 1) — length of the dots
 
w_2:int (default = 1) — length of the spaces
 
alpha:Number (default = 1) — alpha of the created Shape

Returns
Shape — dotted line
gradientRect()method 
public static function gradientRect(w:Number, h:Number, rotation:Number, color1:Number, color2:Number, alpha1:Number = 1, alpha2:Number = 1):Shape

draws a rectangle w/ gradient in a newly created Shape.

Parameters

w:Number — width of the rectangle
 
h:Number — height of the rectangle
 
rotation:Number — rotation of the gradient
 
color1:Number — first color of the gradient
 
color2:Number — second color of the gradient
 
alpha1:Number (default = 1) — first alpha of the gradient
 
alpha2:Number (default = 1) — second alpha of the gradient

Returns
Shape — rectangle filled w/ gradient
outline()method 
public static function outline(w:int, h:int, color:int, alpha:Number):Shape

draws an outline in a newly created Shape.

Parameters

w:int — width of the new outline
 
h:int — height of the new outline
 
color:int — color of the new outline
 
alpha:Number — alpha of the created Shape

Returns
Shape — rounded rectangle shape
rect()method 
public static function rect(w:Number, h:Number, color:Number, alpha:Number = 1, x:Number = 0, y:Number = 0):Shape

draws a checkered rectangle in a newly created Shape.

Parameters

w:Number — width of the rectangle
 
h:Number — height of the rectangle
 
color:Number — color of the rectangle
 
alpha:Number (default = 1) — alpha of the created Shape
 
x:Number (default = 0) — x position of the created Shape
 
y:Number (default = 0) — y position of the created Shape

Returns
Shape — rectangle
roundedRect()method 
public static function roundedRect(x:Number, y:Number, w:Number, h:Number, radius:Number, color:Number, alpha:Number):Shape

draws a rectangle with rounded corners in a newly created Shape and fills it with specified color.

Parameters

x:Number — width of the new rectangle
 
y:Number — height of the new rectangle
 
w:Number — corner radius of the new rectangle
 
h:Number — color to fill the rect
 
radius:Number — alpha of the created Shape
 
color:Number
 
alpha:Number

Returns
Shape — colored rectangle shape with rounded edges
Constant Detail
TO_RADIANSConstant
public static const TO_RADIANS:Number