Packageardisia.utils
Classpublic class GraphicsUtils
InheritanceGraphicsUtils Inheritance Object

Assortment of useful graphics related functions. Purely static class.



Public Methods
 MethodDefined By
  
drawArc(canvas:UIComponent, centerX:Number, centerY:Number, radius:Number, startAngle:Number, arcAngle:Number, steps:Number = 20):void
[static] Draws an arc.
GraphicsUtils
  
drawArrow(graphics:Graphics, beginPt:Point, endPt:Point, arrowSlope:Number = 25, arrowHeadLength:Number = 8):void
[static] Draw an line with an arrow at the end.
GraphicsUtils
  
drawDashedEllipse(g:Graphics, x:Number, y:Number, width:Number, height:Number, dashColorA:uint, dashColorB:uint, strokeWeight:Number, dashLength:Number):void
[static] Draws a dashed ellipse.
GraphicsUtils
  
drawDashedRectangle(g:Graphics, x:Number, y:Number, width:Number, height:Number, dashColorA:uint, dashColorB:uint, strokeWeight:Number, dashLength:Number):void
[static] Draws a dashed rectangle.
GraphicsUtils
  
drawPolyLine(g:Graphics, pts:Array, start:int, end:int, hProp:String, vProp:String, stroke:IStroke, form:Object, moveToStart:Boolean = true):void
[static] Convenience method to call the Flex SDK included GraphicsUtilities drawPolyLine method.
GraphicsUtils
  
drawSpline(target:Graphics, segmentStart:Point, segmentEnd:Point, prevSegmentEnd:Point = null, nextSegmentStart:Point = null):void
[static] Draw a spline (a curve).
GraphicsUtils
  
getEllipseRadiusAtTheta(width:Number, height:Number, theta:Number):Number
[static] Returns the radius of the ellipse from the center of the ellipse to the ellipse perimeter at the provided angle.
GraphicsUtils
  
getLineIntersection(line1Start:Point, line1End:Point, line2Start:Point, line2End:Point):Point
[static] Get the intersection point of 2 lines.
GraphicsUtils
Method Detail
drawArc()method
public static function drawArc(canvas:UIComponent, centerX:Number, centerY:Number, radius:Number, startAngle:Number, arcAngle:Number, steps:Number = 20):void

Draws an arc.

Parameters

canvas:UIComponent — the UIComponent to draw on
 
centerX:Number — the center x point of the ellipse
 
centerY:Number — the center y point of the ellipse
 
radius:Number — the radius of the circle to draw
 
startAngle:Number — angle in degrees
 
arcAngle:Number — the number of degrees to draw
 
steps:Number (default = 20) — the number of steps to draw the arc. More steps means slower performance, but a smoother arc

drawArrow()method 
public static function drawArrow(graphics:Graphics, beginPt:Point, endPt:Point, arrowSlope:Number = 25, arrowHeadLength:Number = 8):void

Draw an line with an arrow at the end.

Parameters

graphics:Graphics — the Graphics object used to draw the arrow
 
beginPt:Point — Point
 
endPt:Point — Point
 
arrowSlope:Number (default = 25) — angle in degrees to slope the arrow head
 
arrowHeadLength:Number (default = 8) — the number of pixels for the arrow head height

drawDashedEllipse()method 
public static function drawDashedEllipse(g:Graphics, x:Number, y:Number, width:Number, height:Number, dashColorA:uint, dashColorB:uint, strokeWeight:Number, dashLength:Number):void

Draws a dashed ellipse.

Parameters

g:Graphics
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
dashColorA:uint
 
dashColorB:uint
 
strokeWeight:Number
 
dashLength:Number

drawDashedRectangle()method 
public static function drawDashedRectangle(g:Graphics, x:Number, y:Number, width:Number, height:Number, dashColorA:uint, dashColorB:uint, strokeWeight:Number, dashLength:Number):void

Draws a dashed rectangle. Black around each corner.

Parameters

g:Graphics
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
dashColorA:uint
 
dashColorB:uint
 
strokeWeight:Number
 
dashLength:Number

drawPolyLine()method 
public static function drawPolyLine(g:Graphics, pts:Array, start:int, end:int, hProp:String, vProp:String, stroke:IStroke, form:Object, moveToStart:Boolean = true):void

Convenience method to call the Flex SDK included GraphicsUtilities drawPolyLine method.

Included mainly to remind me that it exists so as to not re-create the wheel.

Parameters

g:Graphics
 
pts:Array
 
start:int
 
end:int
 
hProp:String
 
vProp:String
 
stroke:IStroke
 
form:Object
 
moveToStart:Boolean (default = true)

drawSpline()method 
public static function drawSpline(target:Graphics, segmentStart:Point, segmentEnd:Point, prevSegmentEnd:Point = null, nextSegmentStart:Point = null):void

Draw a spline (a curve).

Parameters

target:Graphics — the Graphics object used to draw the curve
 
segmentStart:Point — Point
 
segmentEnd:Point — Point
 
prevSegmentEnd:Point (default = null) — Point that
 
nextSegmentStart:Point (default = null) — Point

getEllipseRadiusAtTheta()method 
public static function getEllipseRadiusAtTheta(width:Number, height:Number, theta:Number):Number

Returns the radius of the ellipse from the center of the ellipse to the ellipse perimeter at the provided angle.

Derived from the ellipse equation - see http://en.wikipedia.org/wiki/Ellipse

Parameters

width:Number — the elliptical width
 
height:Number — the elliptical height
 
theta:Number — the angle (in radians) to return the radius

Returns
Number — the radius in pixels
getLineIntersection()method 
public static function getLineIntersection(line1Start:Point, line1End:Point, line2Start:Point, line2End:Point):Point

Get the intersection point of 2 lines.

Parameters

line1Start:Point — Point
 
line1End:Point — Point
 
line2Start:Point — Point
 
line2End:Point — Point

Returns
Point — Point