Java Draw Arc drawArc(Graphics g, int left, int top, int width, int height, int startAngle, int deltaAngle, int lineWidth)

Here you can find the source of drawArc(Graphics g, int left, int top, int width, int height, int startAngle, int deltaAngle, int lineWidth)

Description

_more_

License

Open Source License

Parameter

Parameter Description
g _more_
left _more_
top _more_
width _more_
height _more_
startAngle _more_
deltaAngle _more_
lineWidth _more_

Declaration

public static void drawArc(Graphics g, int left, int top, int width, int height, int startAngle, int deltaAngle,
        int lineWidth) 

Method Source Code

//package com.java2s;
/**//  w w  w.j  av  a  2  s.  co m
* Copyright (c) 2008-2015 Geode Systems LLC
* This Software is licensed under the Geode Systems RAMADDA License available in the source distribution in the file 
* ramadda_license.txt. The above copyright notice shall be included in all copies or substantial portions of the Software.
*/

import java.awt.*;

public class Main {
    /**
     * _more_
     *
     * @param g _more_
     * @param left _more_
     * @param top _more_
     * @param width _more_
     * @param height _more_
     * @param startAngle _more_
     * @param deltaAngle _more_
     * @param lineWidth _more_
     */
    public static void drawArc(Graphics g, int left, int top, int width, int height, int startAngle, int deltaAngle,
            int lineWidth) {
        left = left - lineWidth / 2;
        top = top - lineWidth / 2;
        width = width + lineWidth;
        height = height + lineWidth;
        for (int i = 0; i < lineWidth; i++) {
            g.drawArc(left, top, width, height, startAngle, deltaAngle);
            if ((i + 1) < lineWidth) {
                g.drawArc(left, top, width - 1, height - 1, startAngle, deltaAngle);
                g.drawArc(left + 1, top, width - 1, height - 1, startAngle, deltaAngle);
                g.drawArc(left, top + 1, width - 1, height - 1, startAngle, deltaAngle);
                g.drawArc(left + 1, top + 1, width - 1, height - 1, startAngle, deltaAngle);
                left = left + 1;
                top = top + 1;
                width = width - 2;
                height = height - 2;
            }
        }
    }
}

Related

  1. drawArc(Graphics2D g, int x, int y, int width, int height, double start, double end, int innerXOffset, int innerYOffset)
  2. drawCenteredArc(Graphics g, int x, int y, int r, int start, int dist)