path.append(at.createTransformedShape(arc), false);
@Override public void execute(Path2D.Double path, Context ctx){ double rx = ctx.getValue(wr); double ry = ctx.getValue(hr); double ooStart = ctx.getValue(stAng) / OOXML_DEGREE; double ooExtent = ctx.getValue(swAng) / OOXML_DEGREE; // skew the angles for AWT output double awtStart = convertOoxml2AwtAngle(ooStart, rx, ry); double awtSweep = convertOoxml2AwtAngle(ooStart+ooExtent, rx, ry)-awtStart; // calculate the inverse angle - taken from the (reversed) preset definition double radStart = Math.toRadians(ooStart); double invStart = Math.atan2(rx * Math.sin(radStart), ry * Math.cos(radStart)); Point2D pt = path.getCurrentPoint(); // calculate top/left corner double x0 = pt.getX() - rx * Math.cos(invStart) - rx; double y0 = pt.getY() - ry * Math.sin(invStart) - ry; Arc2D arc = new Arc2D.Double(x0, y0, 2 * rx, 2 * ry, awtStart, awtSweep, Arc2D.OPEN); path.append(arc, true); }
180, x0 < x ? 180 : -180, Arc2D.OPEN); path.append(AffineTransform.getRotateInstance(rotate, x0, y0) .createTransformedShape(arc), true);
private Path2D.Double createArrow() { int length = 80; Path2D.Double path = new Path2D.Double(); Rectangle2D.Double rect = new Rectangle2D.Double(-1, -length, 2, length); path.append(rect, true); Rectangle2D.Double rect2 = new Rectangle2D.Double(0, -length, 2, length); path.append(rect2, true); CubicCurve2D c = new CubicCurve2D.Double(); c.setCurve(0, -length, length / 4, -length - 20, length / 2, -length + 10, length, -length); path.append(c, true); Line2D line = new Line2D.Double(length, -length, length, -length / 3); path.append(line, true); c = new CubicCurve2D.Double(); c.setCurve(length, -length / 3, length / 2, -length / 3 + 10, length / 4, -length / 3 - 20, 0, -length / 3); path.append(c, true); return path; }
private static Shape getHCAU0123(double thickness) { double ft = Math.sqrt(getDeltaL(CUT_BORDER, thickness)*getDeltaL(CUT_BORDER, thickness)+ thickness*thickness); double my = (HEX_WID * 5 / 8 - ft - HEX_UL.x - getDeltaL(CUT_BORDER, thickness)) * slopeWYoverX + HEX_UL.y + thickness; Path2D.Double area = new Path2D.Double(); area.append(getHCLU0123(), false); area.lineTo(HEX_LL.x + getDeltaL(CUT_BORDER, thickness), HEX_LL.y - thickness); area.lineTo(HEX_WID * 5 / 8 - ft, HEX_LL.y - my); area.lineTo(HEX_WID * 5 / 8 - ft, HEX_UL.y + my); area.lineTo(HEX_UL.x + getDeltaL(CUT_BORDER, thickness), HEX_UL.y + thickness); area.closePath(); return area; }
private static Shape getHCAU012(double thickness) { double ft = Math.sqrt(getDeltaL(CUT_BORDER, thickness)*getDeltaL(CUT_BORDER, thickness)+ thickness*thickness); double my = (HEX_LR.x - ft - HEX_UL.x - getDeltaL(CUT_BORDER, thickness)) * slopeWYoverX + HEX_UL.y + thickness; Path2D.Double area = new Path2D.Double(); area.append(getHCLU012(), false); area.lineTo(HEX_LR.x - ft, HEX_LR.y); area.lineTo(HEX_LR.x - ft, my); area.lineTo(HEX_UL.x + getDeltaL(CUT_BORDER, thickness), HEX_UL.y + thickness); area.closePath(); return area; }
private static Shape getHCAU01(double thickness) { Path2D.Double area = new Path2D.Double(); area.append(getHCLU01(), false); area.lineTo(HEX_MR.x + getDeltaL(CUT_BORDER, thickness), HEX_MR.y + thickness); area.lineTo(HEX_UL.x + getDeltaL(CUT_BORDER, thickness), HEX_UL.y + thickness); area.closePath(); return area; }
public static Shape getHexBorderArea(int cuttype, double thickness) { Path2D.Double area = new Path2D.Double(); area.append(getHBLU(), false); area.lineTo(HEX_UR.x + getDeltaR(cuttype, thickness), HEX_UR.y + thickness); area.lineTo(HEX_UL.x + getDeltaL(cuttype, thickness), HEX_UL.y + thickness); area.closePath(); return PerfectHextoHex.createTransformedShape(area); }
protected Path2D.Double getPath() { if (cachedPath == null) { cachedPath = new Path2D.Double(); cachedPath.setWindingRule(get(WINDING_RULE) == WindingRule.EVEN_ODD ? Path2D.Double.WIND_EVEN_ODD : Path2D.Double.WIND_NON_ZERO); for (Figure child : getChildren()) { SVGBezierFigure b = (SVGBezierFigure) child; cachedPath.append(b.getBezierPath(), false); } } return cachedPath; }
Rectangle r = new Rectangle( x,y , width, height); Path2D.Double path = new Path2D.Double(); path.append(r, false); AffineTransform t = new AffineTransform(); t.rotate(angle); path.transform(t); g2.draw(path);
public Shape getPadsShape() { Path2D.Double shape = new Path2D.Double(); for (Pad pad : pads) { shape.append(pad.getShape(), false); } return shape; }
public Shape getBodyShape() { Path2D.Double shape = new Path2D.Double(); Pad body = new Pad(); body.setWidth(bodyWidth); body.setHeight(bodyHeight); shape.append(body.getShape(), false); return shape; }
protected Path2D.Double getPath() { if (cachedPath == null) { cachedPath = new Path2D.Double(); cachedPath.setWindingRule(get(WINDING_RULE) == WindingRule.EVEN_ODD ? Path2D.Double.WIND_EVEN_ODD : Path2D.Double.WIND_NON_ZERO); for (Figure child : getChildren()) { ODGBezierFigure b = (ODGBezierFigure) child; cachedPath.append(b.getBezierPath(), false); } } return cachedPath; }
Arc2D innerarc = new Arc2D.Double(x + 1, y - 197 * eh / 700 + 1, ew - 2, eh - 2, 0, 360, Arc2D.OPEN); curve.append(new Rectangle2D.Double(x, y, x2 - x, y2 - y), false); g2.setClip(new Rectangle2D.Double(x, y, x2 - x, y2 - y)); g2.setClip(arc);
path.append(shape, true);
path.append(shape, true);