DrawUtil

Kind of class:public class
Package:org.casalib.util
Inherits from:none
Version:12/04/08
Author:Aaron Clinger
Classpath:org.casalib.util.DrawUtil
File last modified:Thursday, 19 February 2009, 11:33:36
Utilities for drawing shapes.

Summary


Class methods
  • drawWedge (graphics:Graphics, ellipse:Ellipse, startAngle:Number, arc:Number) : void
    • Draws a circular wedge.
  • drawRoundRect (graphics:Graphics, x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number, topLeft:Boolean = true, topRight:Boolean = true, bottomRight:Boolean = true, bottomLeft:Boolean = true) : void
    • Draws a rounded rectangle.

Class methods

drawRoundRect

public static function drawRoundRect (
graphics:Graphics, x:Number, y:Number, width:Number, height:Number, ellipseWidth:Number, ellipseHeight:Number, topLeft:Boolean = true, topRight:Boolean = true, bottomRight:Boolean = true, bottomLeft:Boolean = true) : void

Draws a rounded rectangle. Act identically to Graphics.drawRoundRect but allows the specification of which corners are rounded.
Parameters:
graphics :
The location where drawing should occur.
x :
The horizontal position of the rectangle.
y :
The vertical position of the rectangle.
width :
The width of the rectangle.
height :
The height of the rectangle.
ellipseWidth :
The width in pixels of the ellipse used to draw the rounded corners.
ellipseHeight:
The height in pixels of the ellipse used to draw the rounded corners.
topLeft :
Specifies if the top left corner of the rectangle should be rounded true, or should be square false.
topRight :
Specifies if the top right corner of the rectangle should be rounded true, or should be square false.
bottomRight :
Specifies if the bottom right corner of the rectangle should be rounded true, or should be square false.
bottomLeft :
Specifies if the bottom left corner of the rectangle should be rounded true, or should be square false.
Usage:
  • this.graphics.beginFill(0xFF00FF);
    DrawUtil.drawRoundRect(this.graphics, 10, 10, 200, 200, 50, 50, true, false, true, false);
    this.graphics.endFill();

drawWedge

public static function drawWedge (
graphics:Graphics, ellipse:Ellipse, startAngle:Number, arc:Number) : void

Draws a circular wedge.
Parameters:
graphics :
The location where drawing should occur.
ellipse :
An Ellipse object that contains the size and position of the shape.
startAngle:
The starting angle of wedge in degrees.
arc :
The sweep of the wedge in degrees.
Usage:
  • this.graphics.beginFill(0xFF00FF);
    DrawUtil.drawWedge(this.graphics, new Ellipse(0, 0, 300, 200), 0, 300);
    this.graphics.endFill();