Class org.aswing.graphices.Graphics

Description

Graphics, use to paint graphics contexts on a MovieClip.

Method Index

new Graphics()
beginDraw(), beginFill(), circle(), curveTo(), drawCircle(), drawEllipse(), drawLine(), drawPolygon(), drawRectangle(), drawRoundRect(), ellipse(), endDraw(), endFill(), fillCircle(), fillCircleRing(), fillCircleRingWithThickness(), fillEllipse(), fillEllipseRing(), fillEllipseRingWithThickness(), fillPolygon(), fillPolygonRing(), fillRectangle(), fillRectangleRing(), fillRectangleRingWithThickness(), fillRoundRect(), fillRoundRectRing(), fillRoundRectRingWithThickness(), lineTo(), moveTo(), polygon(), rectangle(), roundRect(), wedge()

Constructor Detail

Graphics

public function Graphics(target_mc:MovieClip)

Create a graphics with target MovieClip.

Parameters

target_mcwhere the graphics contexts will be paint on.

Method Detail

drawLine

public function drawLine(p:Pen, x1:Number, y1:Number, x2:Number, y2:Number):Void

Draws a line. Between the points (x1, y1) and (x2, y2) in the target MovieClip.

Parameters

pthe pen to draw
x1the x corrdinate of the first point.
y1the y corrdinate of the first point.
x2the x corrdinate of the sencod point.
y2the y corrdinate of the sencod point.

drawPolygon

public function drawPolygon(p:Pen, points:Array):Void

Draws a polygon. Start with the points[0] and end of the points[0] as a closed path.

Parameters

pthe pen to draw
pointsthe Array contains all vertex points in the polygon.

fillPolygon

public function fillPolygon(b:Brush, points:Array):Void

Fills a polygon. Start with the points[0] and end of the points[0] as a closed path.

Parameters

bthe brush to fill.
pointsthe Array contains all vertex points in the polygon.

fillPolygonRing

public function fillPolygonRing(b:Brush, points1:Array, points2:Array):Void

Fills a polygon ring.

Parameters

bthe brush to fill.
points1the first polygon's points.
points2the second polygon's points.

drawRectangle

public function drawRectangle(pen:Pen, x:Number, y:Number, w:Number, h:Number):Void

Draws a rectange.

Parameters

penthe pen to draw.
xthe left top the rectange bounds' x corrdinate.
ythe left top the rectange bounds' y corrdinate.
wthe width of rectange bounds.
hthe height of rectange bounds.

fillRectangle

public function fillRectangle(brush:Brush, x:Number, y:Number, width:Number, height:Number):Void

Fills a rectange.

Parameters

brushthe brush to fill.
xthe left top the rectange bounds' x corrdinate.
ythe left top the rectange bounds' y corrdinate.

fillRectangleRing

public function fillRectangleRing(brush:Brush, cx:Number, cy:Number, w1:Number, h1:Number, w2:Number, h2:Number):Void

Fills a rectange ring.

Parameters

brushthe brush to fill.
cxthe center of the ring's x corrdinate.
cythe center of the ring's y corrdinate.
w1the first rectange's width.
h1the first rectange's height.
w2the second rectange's width.
h2the second rectange's height.

fillRectangleRingWithThickness

public function fillRectangleRingWithThickness(brush:Brush, x:Number, y:Number, w:Number, h:Number, t:Number):Void

Fills a rectange ring with specified thickness.

Parameters

brushthe brush to fill.
xthe left top the ring bounds' x corrdinate.
ythe left top the ring bounds' y corrdinate.
wthe width of ring periphery bounds.
hthe height of ring periphery bounds.
tthe thickness of the ring.

drawCircle

public function drawCircle(p:Pen, cx:Number, cy:Number, radius:Number):Void

Draws a circle.

Parameters

pthe pen to draw.
cxthe center of the circle's x corrdinate.
cythe center of the circle's y corrdinate.
radiusthe radius of the circle.

fillCircle

public function fillCircle(b:Brush, cx:Number, cy:Number, radius:Number):Void

Fills a circle.

Parameters

bthe brush to draw.
cxthe center of the circle's x corrdinate.
cythe center of the circle's y corrdinate.
radiusthe radius of the circle.

fillCircleRing

public function fillCircleRing(b:Brush, cx:Number, cy:Number, r1:Number, r2:Number):Void

Fills a circle ring.

Parameters

bthe brush to draw.
cxthe center of the ring's x corrdinate.
cythe center of the ring's y corrdinate.
r1the first circle radius.
r2the second circle radius.

fillCircleRingWithThickness

public function fillCircleRingWithThickness(b:Brush, cx:Number, cy:Number, r:Number, t:Number):Void

Fills a circle ring with specified thickness.

Parameters

bthe brush to draw.
cxthe center of the ring's x corrdinate.
cythe center of the ring's y corrdinate.
rthe radius of circle periphery.
tthe thickness of the ring.

drawEllipse

public function drawEllipse(p:Pen, x:Number, y:Number, width:Number, height:Number):Void

Draws a ellipse.

Parameters

xthe left top the ellipse bounds' x corrdinate.
ythe left top the ellipse bounds' y corrdinate.

fillEllipse

public function fillEllipse(b:Brush, x:Number, y:Number, width:Number, height:Number):Void

Fills a rectange.

Parameters

xthe left top the ellipse bounds' x corrdinate.
ythe left top the ellipse bounds' y corrdinate.

fillEllipseRing

public function fillEllipseRing(brush:Brush, cx:Number, cy:Number, w1:Number, h1:Number, w2:Number, h2:Number):Void

Fill a ellipse ring.

Parameters

brushthe brush to fill.
cxthe center of the ring's x corrdinate.
cythe center of the ring's y corrdinate.
w1the first eclipse's width.
h1the first eclipse's height.
w2the second eclipse's width.
h2the second eclipse's height.

fillEllipseRingWithThickness

public function fillEllipseRingWithThickness(brush:Brush, x:Number, y:Number, w:Number, h:Number, t:Number):Void

Fill a ellipse ring with specified thickness.

Parameters

brushthe brush to fill.
xthe left top the ring bounds' x corrdinate.
ythe left top the ring bounds' y corrdinate.
wthe width of ellipse periphery bounds.
hthe height of ellipse periphery bounds.
tthe thickness of the ring.

drawRoundRect

public function drawRoundRect(pen:Pen, x:Number, y:Number, width:Number, height:Number, radius:Number, trR:Number, blR:Number, brR:Number):Void

Draws a round rectangle.

Parameters

penthe pen to draw.
xthe left top the rectangle bounds' x corrdinate.
ythe left top the rectangle bounds' y corrdinate.
widththe width of rectangle bounds.
heightthe height of rectangle bounds.
radiusthe top left corner's round radius.
trRthe top right corner's round radius. (miss this param default to same as radius)
blRthe bottom left corner's round radius. (miss this param default to same as radius)
brRthe bottom right corner's round radius. (miss this param default to same as radius)

fillRoundRect

public function fillRoundRect(brush:Brush, x:Number, y:Number, width:Number, height:Number, radius:Number, trR:Number, blR:Number, brR:Number):Void

Fills a round rectangle.

Parameters

brushthe brush to fill.
xthe left top the rectangle bounds' x corrdinate.
ythe left top the rectangle bounds' y corrdinate.
widththe width of rectangle bounds.
heightthe height of rectangle bounds.
radiusthe top left corner's round radius.
trRthe top right corner's round radius. (miss this param default to same as radius)
blRthe bottom left corner's round radius. (miss this param default to same as radius)
brRthe bottom right corner's round radius. (miss this param default to same as radius)

fillRoundRectRing

public function fillRoundRectRing(brush:Brush, cx:Number, cy:Number, w1:Number, h1:Number, r1:Number, w2:Number, h2:Number, r2:Number):Void

Fill a round rect ring.

Parameters

brushthe brush to fill
cxthe center of the ring's x corrdinate
cythe center of the ring's y corrdinate
w1the first round rect's width
h1the first round rect's height
r1the first round rect's round radius
w2the second round rect's width
h2the second round rect's height
r2the second round rect's round radius

fillRoundRectRingWithThickness

public function fillRoundRectRingWithThickness(brush:Brush, x:Number, y:Number, w:Number, h:Number, r:Number, t:Number, ir:Number):Void

Fill a round rect ring with specified thickness.

Parameters

brushthe brush to fill
xthe left top the ring bounds' x corrdinate
ythe left top the ring bounds' y corrdinate
wthe width of ring periphery bounds
hthe height of ring periphery bounds
rthe round radius of the round rect
tthe thickness of the ring
irthe inboard round radius, default is r-t

beginFill

public function beginFill(brush:Brush):Void

endFill

public function endFill():Void

beginDraw

public function beginDraw(pen:Pen):Void

endDraw

public function endDraw():Void

moveTo

public function moveTo(x:Number, y:Number):Void

curveTo

public function curveTo(controlX:Number, controlY:Number, anchorX:Number, anchorY:Number):Void

lineTo

public function lineTo(x:Number, y:Number):Void

polygon

public function polygon(points:Array):Void

Paths a polygon.

See Also

rectangle

public function rectangle(x:Number, y:Number, width:Number, height:Number):Void

Paths a rectangle.

See Also

ellipse

public function ellipse(x:Number, y:Number, width:Number, height:Number):Void

Paths a ellipse.

See Also

circle

public function circle(cx:Number, cy:Number, r:Number):Void

Paths a circle

See Also

roundRect

public function roundRect(x:Number, y:Number, width:Number, height:Number, radius:Number, trR:Number, blR:Number, brR:Number):Void

Paths a round rect.

Parameters

radiustop left radius, if other corner radius if undefined, will be set to this radius

See Also

wedge

public function wedge(radius:Number, x:Number, y:Number, angle:Number, rot:Number):Void

path a wedge.