Exemplo n.º 1
0
 /**
  * Adds to the receiver a circular or elliptical arc that lies within the specified rectangular
  * area.
  *
  * <p>The resulting arc begins at <code>startAngle</code> and extends for <code>arcAngle</code>
  * 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.
  *
  * <p>The center of the arc is the center of the rectangle whose origin is (<code>x</code>, <code>
  * y</code>) and whose size is specified by the <code>width</code> and <code>height</code>
  * arguments.
  *
  * <p>The resulting arc covers an area <code>width + 1</code> pixels wide by <code>height + 1
  * </code> pixels tall.
  *
  * @param x the x coordinate of the upper-left corner of the arc
  * @param y the y coordinate of the upper-left corner of the arc
  * @param width the width of the arc
  * @param height the height of the arc
  * @param startAngle the beginning angle
  * @param arcAngle the angular extent of the arc, relative to the start angle
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed
  *     </ul>
  */
 public void addArc(
     float x, float y, float width, float height, float startAngle, float arcAngle) {
   if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
   NSAffineTransform transform = NSAffineTransform.transform();
   transform.translateXBy(x + width / 2f, y + height / 2f);
   transform.scaleXBy(width / 2f, height / 2f);
   NSBezierPath path = NSBezierPath.bezierPath();
   NSPoint center = new NSPoint();
   float sAngle = -startAngle;
   float eAngle = -(startAngle + arcAngle);
   path.appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_clockwise_(
       center, 1, sAngle, eAngle, arcAngle > 0);
   path.transformUsingAffineTransform(transform);
   handle.appendBezierPath(path);
 }