context.addArcToPoint(2, 2, radius + 2, 2, radius); context.addLineToPoint(rect.getWidth() - radius - 2, 2); context.addArcToPoint(rect.getWidth() - 2, 2, rect.getWidth() - 2, rect.getHeight() / 2, radius); context.addArcToPoint(rect.getWidth() - 2, rect.getHeight() - 2, rect.getWidth() - radius - 2, rect.getHeight() - 2, radius); context.addLineToPoint(radius + 2, rect.getHeight() - 2); context.addArcToPoint(2, rect.getHeight() - 2, 2, rect.getHeight() / 2, radius); context.fillPath(); context.addArcToPoint(2, 2, radius + 2, 2, radius); context.addLineToPoint(rect.getWidth() - radius - 2, 2); context.addArcToPoint(rect.getWidth() - 2, 2, rect.getWidth() - 2, rect.getHeight() / 2, radius); context.addArcToPoint(rect.getWidth() - 2, rect.getHeight() - 2, rect.getWidth() - radius - 2, rect.getHeight() - 2, radius); context.addLineToPoint(radius + 2, rect.getHeight() - 2); context.addArcToPoint(2, rect.getHeight() - 2, 2, rect.getHeight() / 2, radius); context.strokePath(); context.addArcToPoint(4, 4, radius + 4, 4, radius); context.addLineToPoint(amount, 4); context.addLineToPoint(amount, radius + 4); context.addArcToPoint(4, rect.getHeight() - 4, radius + 4, rect.getHeight() - 4, radius); context.addLineToPoint(amount, rect.getHeight() - 4); context.addLineToPoint(amount, radius + 4); context.addArcToPoint(4, 4, radius + 4, 4, radius); context.addLineToPoint(rect.getWidth() - radius - 4, 4); double angle = -Math.acos(x / radius);