org.jdrawing.graphics
Class ArcOperation

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsOperation
      extended byorg.jdrawing.graphics.ArcOperation
All Implemented Interfaces:
DrawingElement
Direct Known Subclasses:
DrawArc, FillArc

public abstract class ArcOperation
extends GraphicsOperation

Base class for operations, which get arc as argument.


Constructor Summary
ArcOperation(int x, int y, int width, int height, int startAngle, int arcAngle)
          Returns ArcOperation for a circular or elliptical arc covering the specified rectangle.
ArcOperation(int x, int y, int width, int height, int startAngle, int arcAngle, Style style)
          Returns ArcOperation for a circular or elliptical arc covering the specified rectangle.
 
Method Summary
 int getArcAngle()
          Gets the angular extent of the arc, relative to the start angle.
 int getHeight()
          Gets the height of the arc.
 int getStartAngle()
          Gets the beginning angle of the arc.
 int getWidth()
          Gets the width of the arc.
 int getX()
          Gets the X coordinate of the upper-left corner of the arc.
 int getY()
          Gets the Y coordinate of the upper-left corner of the arc.
 void setArc(int x, int y, int width, int height, int startAngle, int arcAngle)
          Sets the attributes of the rounded rectangle.
 void setArcAngle(int arcAngle)
          Sets the angular extent of the arc, relative to the start angle.
 void setHeight(int height)
          Sets the height of the arc.
 void setStartAngle(int startAngle)
          Sets the beginning angle of the arc.
 void setWidth(int width)
          Sets the width of the arc.
 void setX(int x)
          Sets the X coordinate of the upper-left corner of the arc.
 void setY(int y)
          Sets the Y coordinate of the upper-left corner of the arc.
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
contains, getBounds, getBounds2D, getPosition, getShapeOfOperation, getStyle, intersects, paint, paintOperation, setPosition, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArcOperation

public ArcOperation(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Returns ArcOperation for a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.

Parameters:
x - the x coordinate of the upper-left corner of the arc.
y - the y coordinate of the upper-left corner of the arc.
width - the width of the arc.
height - the height of the arc.
startAngle - the beginning angle.
arcAngle - the angular extent of the arc, relative to the start angle.

ArcOperation

public ArcOperation(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle,
                    Style style)
Returns ArcOperation for a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.

Parameters:
x - the x coordinate of the upper-left corner of the arc.
y - the y coordinate of the upper-left corner of the arc.
width - the width of the arc.
height - the height of the arc.
startAngle - the beginning angle.
arcAngle - the angular extent of the arc, relative to the start angle.
style - the style for this graphics operation
Method Detail

setX

public void setX(int x)
Sets the X coordinate of the upper-left corner of the arc.

Parameters:
x - the x coordinate of the upper-left corner of the arc.

getX

public int getX()
Gets the X coordinate of the upper-left corner of the arc.

Returns:
the x coordinate of the upper-left corner of the arc.

setY

public void setY(int y)
Sets the Y coordinate of the upper-left corner of the arc.

Parameters:
y - the y coordinate of the upper-left corner of the arc.

getY

public int getY()
Gets the Y coordinate of the upper-left corner of the arc.

Returns:
the y coordinate of the upper-left corner of the arc.

setWidth

public void setWidth(int width)
Sets the width of the arc.

Parameters:
width - the width of the arc

getWidth

public int getWidth()
Gets the width of the arc.

Returns:
the width of the arc

setHeight

public void setHeight(int height)
Sets the height of the arc.

Parameters:
height - the height of the arc

getHeight

public int getHeight()
Gets the height of the arc.

Returns:
the height of the arc

setStartAngle

public void setStartAngle(int startAngle)
Sets the beginning angle of the arc.

Parameters:
startAngle - the beginning angle

getStartAngle

public int getStartAngle()
Gets the beginning angle of the arc.

Returns:
the beginning angle

setArcAngle

public void setArcAngle(int arcAngle)
Sets the angular extent of the arc, relative to the start angle.

Parameters:
arcAngle - the angular extent of the arc, relative to the start angle

getArcAngle

public int getArcAngle()
Gets the angular extent of the arc, relative to the start angle.

Returns:
the angular extent of the arc, relative to the start angle

setArc

public void setArc(int x,
                   int y,
                   int width,
                   int height,
                   int startAngle,
                   int arcAngle)
Sets the attributes of the rounded rectangle.

Parameters:
x - the x coordinate of the upper-left corner of the arc.
y - the y coordinate of the upper-left corner of the arc.
width - the width of the arc.
height - the height of the arc.
startAngle - the beginning angle.
arcAngle - the angular extent of the arc, relative to the start angle.