Prev Up
Go backward to Drawing Ovals
Go up to Drawing Methods

Drawing Arcs


pen.fillArc(  left, top, width, height,   start-angle, angle-width , drawingColor )

pen.invertArc(  left, top, width, height,   start-angle, angle-width )

pen.clearArc(  left, top, width, height,   start-angle, angle-width )

pen.frameArc(  left, top, width, height,   start-angle, angle-width,  drawingColor )

pen.invertArcFrame(  left, top, width, height,   start-angle, angle-width )

pen.clearArcFrame(  left, top, width, height,   start-angle, angle-width )

The final set of drawing methods available through the "pen" can be used to draw fractional portions of ovals called arcs. To draw a fractional portion of an oval, one must of course first specify the shape and location of the oval. So, the first four parameters to the arc drawing methods are identical to those for the oval drawing methods. They specify the upper left corner and the dimensions of a rectangle just containing the oval. Unlike the rectangle and oval drawing primitives, the four parameters describing this rectangle are required in the arc drawing primitives.

The fraction of the oval to be drawn is specified by the fifth and sixth arguments to the arc drawing methods. The fifth argument specifies the starting angle for the arc in degrees. A starting value of 0 degrees corresponds to the position of a clock's hour hand at 3 o'clock. A starting value of 90 degrees corresponds to 12 o'clock. The sixth parameter specifies the span of the arc in degrees. A value of 180, for example, would result in the drawing of a semi-circle.

Arcs can either be filled or framed. When framed, only the portion of the arc falling along the circumference of the oval is affected. While a filled arc may resemble a slice of a pie, a framed arc is likely to look more like a crescent moon.

The fill and frame methods accept an optional seventh parameter specifying the color to be used.

Like all the other drawing methods, the arc methods include clear and invert methods corresponding to both the fill and frame arc methods.

As in earlier sections discussing drawing methods, an applet that can be used to explore the interpretations of the parameters to the fill and frame arc methods is provided below.

WHOOPS. Your applet does not appear to support Java

Prev Up