@Override public Dimension render(Graphics2D graphics) { //Construct the arc Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE); arc.setAngleStart(90); arc.setAngleExtent(progress * 360); arc.setFrame(position.getX() - diameter / 2, position.getY() - diameter / 2, diameter, diameter); //Draw the inside of the arc graphics.setColor(fill); graphics.fill(arc); //Draw the outlines of the arc graphics.setStroke(stroke); graphics.setColor(borderColor); graphics.drawOval(position.getX() - diameter / 2, position.getY() - diameter / 2, diameter, diameter); return new Dimension(diameter, diameter); }
private void calculateShape() { Arc2D.Float head = new Arc2D.Float( cx - (radius * 1), cy - (radius * 1), radius * 2, radius * 2, 0, 181, Arc2D.PIE ); GeneralPath body = new GeneralPath(); body.moveTo( cx - radius, cy ); body.lineTo( cx, cy + height ); body.lineTo( cx + radius, cy ); body.closePath(); pin = new Area( head ); ((Area) pin).add( new Area( body ) ); pin = ShapeUtils.rotate( pin, angle, cx, cy ); } }
private Area createArm() { Area arm = new Area(new Arc2D.Float(cx, cy - radius/2, radius, radius, 0f, 180f, Arc2D.CHORD)); arm.add( new Area(new Ellipse2D.Float(cx + radius/2, cy - radius/4, radius/2, radius/2)) ); arm.subtract( new Area(new Ellipse2D.Float(cx, cy - radius/4, radius/2, radius/2)) ); // arm.add( new Area(new Arc2D.Float(cx + radius/2, cy - radius/4, radius/2, radius/2, 180f, 360f, Arc2D.CHORD)) ); // arm.subtract( new Area(new Arc2D.Float(cx, cy - radius/4, radius/2, radius/2, 0f, 180f, Arc2D.CHORD)) ); return arm; } }
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { fill(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE)); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); }
public void fillArc(int i, int j, int k, int l, int i1, int j1) { fill(new java.awt.geom.Arc2D.Float(i, j, k, l, i1, j1, 2)); }
public void fillArc(int i, int j, int k, int l, int i1, int j1) { fill(new java.awt.geom.Arc2D.Float(i, j, k, l, i1, j1, 2)); }
public void fillArc(int i, int j, int k, int l, int i1, int j1) { fill(new java.awt.geom.Arc2D.Float(i, j, k, l, i1, j1, 2)); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new java.awt.geom.Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0)); }
/** * Draws an arc. */ public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { Shape shape = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN); draw(shape); }
public void fillArc(int i, int j, int k, int l, int i1, int j1) { fill(new java.awt.geom.Arc2D.Float(i, j, k, l, i1, j1, 2)); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new java.awt.geom.Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0)); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new java.awt.geom.Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0)); }
@Implementation(minSdk = LOLLIPOP) protected void addArc( float left, float top, float right, float bottom, float startAngle, float sweepAngle) { mPath.append( new Arc2D.Float( left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN), false); }
/** * Fills an arc. */ public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { Shape shape = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE); draw(shape, "fill"); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new java.awt.geom.Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0)); }
public void fillArc(int i, int j, int k, int l, int i1, int j1) { fill(new java.awt.geom.Arc2D.Float(i, j, k, l, i1, j1, 2)); }
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { draw(new java.awt.geom.Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0)); }
@Implementation(minSdk = LOLLIPOP) protected void arcTo( float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) { isSimplePath = false; Arc2D arc = new Arc2D.Float( left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN); mPath.append(arc, true /*connect*/); resetLastPointFromPath(); }
@Implementation(minSdk = LOLLIPOP) protected void addArc( float left, float top, float right, float bottom, float startAngle, float sweepAngle) { mPath.append( new Arc2D.Float( left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN), false); }