case ARROW: p = new Path(false, true); Path2D.Double arrow = new Path2D.Double(); arrow.moveTo((-lineWidth * scaleX), (-lineWidth * scaleY / 2)); arrow.lineTo(0, 0); case TRIANGLE: p = new Path(); Path2D.Double triangle = new Path2D.Double(); triangle.moveTo((-lineWidth * scaleX), (-lineWidth * scaleY / 2)); triangle.lineTo(0, 0);
case ARROW: p = new Path(false, true); Path2D.Double arrow = new Path2D.Double(); arrow.moveTo((lineWidth * scaleX), (-lineWidth * scaleY / 2)); arrow.lineTo(0, 0); case TRIANGLE: p = new Path(); Path2D.Double triangle = new Path2D.Double(); triangle.moveTo((lineWidth * scaleX), (-lineWidth * scaleY / 2)); triangle.lineTo(0, 0);
public Path2D.Double getPath() { if (getDel()) return null; // intentionally shadowing variables here double cx = getX(); // center double cy = getY(); double a = getA(); // left double b = getB(); double c = getC(); // top double d = getD(); // compute radius double rx = Math.hypot(a - cx, b - cy); double ry = Math.hypot(c - cx, d - cy); // compute angle of ellipse double angle = (2.0 * Math.PI + (cy > b ? 1.0 : -1.0) * Math.acos((cx - a) / rx)) % (2.0 * Math.PI); // create ellipse Ellipse2D.Double ellipse = new Ellipse2D.Double(cx - rx, cy - ry, rx * 2, ry * 2); // create a path, rotate it about its center Path2D.Double path = new Path2D.Double(ellipse); AffineTransform tr = new AffineTransform(); tr.rotate(angle, cx, cy); path.transform(tr); return path; }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a diamond double diamondHalfSize = (double) markerSize / 2 * 1.3; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - diamondHalfSize, yOffset); path.lineTo(xOffset, yOffset - diamondHalfSize); path.lineTo(xOffset + diamondHalfSize, yOffset); path.lineTo(xOffset, yOffset + diamondHalfSize); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a cross double halfSize = (double) markerSize / 2; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, yOffset - halfSize); path.lineTo(xOffset + halfSize, yOffset + halfSize); path.moveTo(xOffset - halfSize, yOffset + halfSize); path.lineTo(xOffset + halfSize, yOffset - halfSize); g.draw(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); double halfSize = (double) markerSize / 2; // Make a triangle Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, yOffset - halfSize + markerSize - 1); path.lineTo(xOffset - halfSize + markerSize, yOffset - halfSize + markerSize - 1); path.lineTo(xOffset, yOffset - halfSize - 1); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); double halfSize = (double) markerSize / 2; // Make a triangle Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, 1 + yOffset - halfSize); path.lineTo(xOffset, 1 + yOffset - halfSize + markerSize); path.lineTo(xOffset - halfSize + markerSize, 1 + yOffset - halfSize); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a cross double halfSize = (double) markerSize / 2; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset + halfSize, yOffset); path.lineTo(xOffset - halfSize, yOffset); path.moveTo(xOffset, yOffset + halfSize); path.lineTo(xOffset, yOffset - halfSize); g.draw(path); } }
Path2D path = new Path2D.Double(); path.moveTo(valoresX[0], valoresY[0]); for(int i = 1; i < valoresX.length; ++i) { path.lineTo(valoresX[i], valoresY[i]); } path.closePath();
DriverLineG2d.manageStroke(param, g2d); final Path2D.Double p = new Path2D.Double(); boolean hasBezier = false; final MinMaxDouble minMax = new MinMaxDouble();
Path2D.Double path = new Path2D.Double();
@Override public Path2D.Double getPath() { final Path2D.Double path = new Path2D.Double(); at.scale(1./Units.EMU_PER_POINT, 1./Units.EMU_PER_POINT); at.translate(-xfrm2d.getCenterX(), -xfrm2d.getCenterY()); return new Path2D.Double(at.createTransformedShape(path));
/** * Strokes the outline of a <code>Shape</code> using the settings of the * current <code>Graphics2D</code> context. The rendering attributes * applied include the <code>Clip</code>, <code>Transform</code>, * <code>Paint</code>, <code>Composite</code> and * <code>Stroke</code> attributes. * @param shape the <code>Shape</code> to be rendered * @see #setStroke * @see #setPaint * @see java.awt.Graphics#setColor * @see #_transform * @see #setTransform * @see #clip * @see #setClip * @see #setComposite */ public void draw(Shape shape){ Path2D.Double path = new Path2D.Double(_transform.createTransformedShape(shape)); FreeformShape<?,?> p = _group.createFreeform(); p.setPath(path); p.setFillColor(null); applyStroke(p); if (_paint instanceof Color) { p.setStrokeStyle((Color)_paint); } }
public Path2D.Double getPath() { Path2D.Double path = new Path2D.Double();
Path2D path = new Path2D.Double(); x += .5; int lineLength = 18;
} else if (SHAPE_TYPE.Rhombus.equals(shapeType)) { Path2D.Double rhombus = new Path2D.Double(); rhombus.moveTo(graphicInfo.getX(), graphicInfo.getY() + graphicInfo.getHeight() / 2);
/** * Fills the interior of a <code>Shape</code> using the settings of the * <code>Graphics2D</code> context. The rendering attributes applied * include the <code>Clip</code>, <code>Transform</code>, * <code>Paint</code>, and <code>Composite</code>. * @param shape the <code>Shape</code> to be filled * @see #setPaint * @see java.awt.Graphics#setColor * @see #_transform * @see #setTransform * @see #setComposite * @see #clip * @see #setClip */ public void fill(Shape shape){ Path2D.Double path = new Path2D.Double(_transform.createTransformedShape(shape)); FreeformShape<?,?> p = _group.createFreeform(); p.setPath(path); applyPaint(p); p.setStrokeStyle(); //Fills must be "No Line" }
/** * @return returns bounds as a path in local coordinates, which is * userful if you need to transform to global coordinates * * Warning: Don't use this for 1d objects, and will fail for * infinite line objects */ public Path2D.Double getBoundsAsPath() { Double w = getWidth(); Double h = getHeight(); Path2D.Double bounds = new Path2D.Double(); bounds.moveTo(0, 0); bounds.lineTo(w, 0); bounds.lineTo(w, h); bounds.lineTo(0, h); bounds.lineTo(0, 0); return bounds; }
/** * @return Text bounds as a path in local coordinates, which is useful * if you need to transform to global coordinates */ public Path2D.Double getBoundsAsPath() { Rectangle2D.Double rect = getTextBounds(); double w = rect.getWidth(); double h = rect.getHeight(); Path2D.Double bounds = new Path2D.Double(); bounds.moveTo(0, 0); bounds.lineTo(w, 0); bounds.lineTo(w, h); bounds.lineTo(0, h); bounds.lineTo(0, 0); return bounds; }
/** * Convert the internal represenation to java.awt.geom.Path2D */ public Path2D.Double getPath(Context ctx) { Path2D.Double path = new Path2D.Double(); for(PathCommand cmd : commands) { cmd.execute(path, ctx); } return path; }