Packagecom.joshtynjala.utils
Classpublic class GraphicsUtil

A collection of utility functions for manipulating Graphics objects.



Public Methods
 MethodDefined by
  
drawArc(target:Graphics, centerX:Number, centerY:Number, startDegrees:Number, arcDegrees:Number, radius:Number, yRadius:Number):Point
[static] Draws a regular or elliptical arc segment.
GraphicsUtil
  
drawBurst(target:Graphics, x:Number, y:Number, pointCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number):void
[static] Draws a star-like burst.
GraphicsUtil
  
drawDashedLine(target:Graphics, xStart:Number, yStart:Number, xEnd:Number, yEnd:Number, dashSize:Number = 10, gapSize:Number = 10):void
[static] Draws a dashed line between two points.
GraphicsUtil
  
drawGear(target:Graphics, centerX:Number, centerY:Number, sideCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number, holeSideCount:int = 0, holeRadius:Number):void
[static] Draws a gear, a cog with teeth and a hole in the middle where an axle may be placed.
GraphicsUtil
  
drawPolygon(target:Graphics, centerX:Number, centerY:Number, sideCount:int, radius:Number, startDegrees:Number = 0):void
[static] Draws a regular polygon with the specified number of sides.
GraphicsUtil
  
drawStar(target:Graphics, centerX:Number, centerY:Number, pointCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number = 0):void
[static] Draws a star-shaped polygon.
GraphicsUtil
Method detail
drawArc()method
public static function drawArc(target:Graphics, centerX:Number, centerY:Number, startDegrees:Number, arcDegrees:Number, radius:Number, yRadius:Number):Point

Draws a regular or elliptical arc segment.

Parameters
target:Graphics — The Graphics object to which to draw
 
centerX:Number — x component of the arc's center point
 
centerY:Number — y component of the arc's center point
 
startDegrees:Number — Starting angle, in degrees.
 
arcDegrees:Number — Sweep of the arc. Negative values draw clockwise.
 
radius:Number — Radius of the arc. If the optional yRadius is defined, then radius is the x-axis radius.
 
yRadius:Number — Y-axis radius for arc.

Returns
Point
drawBurst()method 
public static function drawBurst(target:Graphics, x:Number, y:Number, pointCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number):void

Draws a star-like burst.

Parameters
target:Graphics — The Graphics object to which to draw.
 
x:Number — x component of the burst's center point.
 
y:Number — y component of the burst's center point.
 
pointCount:int — The number of points on the burst, must be greater than two.
 
innerRadius:Number — The radius of the indent of the points from the center.
 
outerRadius:Number — The radius of the tips of the points from the center.
 
startDegrees:Number — The starting angle from which to draw, in degrees.
drawDashedLine()method 
public static function drawDashedLine(target:Graphics, xStart:Number, yStart:Number, xEnd:Number, yEnd:Number, dashSize:Number = 10, gapSize:Number = 10):void

Draws a dashed line between two points.

Parameters
target:Graphics — The Graphics object to which to draw
 
xStart:Number — The x position of the start of the line
 
yStart:Number — The y position of the start of the line
 
xEnd:Number — The x position of the end of the line
 
yEnd:Number — The y position of the end of the line
 
dashSize:Number (default = 10) — the size of dashes, in pixels
 
gapSize:Number (default = 10) — the size of gaps between dashes, in pixels
drawGear()method 
public static function drawGear(target:Graphics, centerX:Number, centerY:Number, sideCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number, holeSideCount:int = 0, holeRadius:Number):void

Draws a gear, a cog with teeth and a hole in the middle where an axle may be placed.

Parameters
target:Graphics — The Graphics object to which to draw.
 
centerX:Number — x component of the gear's center point.
 
centerY:Number — y component of the gear's center point.
 
sideCount:int — The number of "teeth" on the gear, must be greater than two.
 
innerRadius:Number — The radius of the indent of the points from the center.
 
outerRadius:Number — The radius of the tips of the points from the center.
 
startDegrees:Number — The starting angle from which to draw, in degrees.
 
holeSideCount:int (default = 0) — The number of sides to the polygonal hole in the middle of the gear. Must be greater than two.
 
holeRadius:Number
drawPolygon()method 
public static function drawPolygon(target:Graphics, centerX:Number, centerY:Number, sideCount:int, radius:Number, startDegrees:Number = 0):void

Draws a regular polygon with the specified number of sides. Negative values for sideCount will draw the polygon in the reverse direction, which allows for creating knock-outs in masks.

Parameters
target:Graphics — The Graphics object to which to draw.
 
centerX:Number — x component of the polygon's center point.
 
centerY:Number — y component of the polygon's center point.
 
sideCount:int — The number of sides on the polygon, must be greater than two.
 
radius:Number — The radius of the points of the polygon from the center.
 
startDegrees:Number (default = 0) — The starting angle from which to draw, in degrees.
drawStar()method 
public static function drawStar(target:Graphics, centerX:Number, centerY:Number, pointCount:int, innerRadius:Number, outerRadius:Number, startDegrees:Number = 0):void

Draws a star-shaped polygon. Note that the stars by default 'point' to the right. This is because the method starts drawing at 0 degrees by default, putting the first point to the right of center. Using negative values for the pointCount draws the star in reverse direction, allowing for knock-outs when used as part of a mask.

Parameters
target:Graphics — The Graphics object to which to draw.
 
centerX:Number — x component of the polygon's center point.
 
centerY:Number — y component of the polygon's center point.
 
pointCount:int — The number of points on the star, must be greater than two.
 
innerRadius:Number — The radius of the indent of the points from the center.
 
outerRadius:Number — The radius of the tips of the points from the center.
 
startDegrees:Number (default = 0) — The starting angle from which to draw, in degrees.