@Override public Point2D getCurrentPoint() { return linePath.getCurrentPoint(); }
@Override public Point2D getCurrentPoint() { return currentPath.getCurrentPoint(); }
/** * Close path. */ private void closepath() { if (path.getCurrentPoint() == null) { LOG.warn("closepath without initial moveTo in font " + fontName + ", glyph " + glyphName); } else { path.closePath(); } path.moveTo(current.getX(), current.getY()); }
/** * Relative lineto. */ private void rlineTo(Number dx, Number dy) { float x = (float)current.getX() + dx.floatValue(); float y = (float)current.getY() + dy.floatValue(); if (path.getCurrentPoint() == null) { LOG.warn("rlineTo without initial moveTo in font " + fontName + ", glyph " + glyphName); path.moveTo(x, y); } else { path.lineTo(x, y); } current.setLocation(x, y); }
/** * Relative curveto. */ private void rrcurveTo(Number dx1, Number dy1, Number dx2, Number dy2, Number dx3, Number dy3) { float x1 = (float) current.getX() + dx1.floatValue(); float y1 = (float) current.getY() + dy1.floatValue(); float x2 = x1 + dx2.floatValue(); float y2 = y1 + dy2.floatValue(); float x3 = x2 + dx3.floatValue(); float y3 = y2 + dy3.floatValue(); if (path.getCurrentPoint() == null) { LOG.warn("rrcurveTo without initial moveTo in font " + fontName + ", glyph " + glyphName); path.moveTo(x3, y3); } else { path.curveTo(x1, y1, x2, y2, x3, y3); } current.setLocation(x3, y3); }
public static Shape getDonutSliceShape( Rectangle2D pieBounds, double thickness, double start, double extent) { thickness = thickness / 2; GeneralPath generalPath = new GeneralPath(); GeneralPath dummy = new GeneralPath(); // used to find arc endpoints double x = pieBounds.getX(); double y = pieBounds.getY(); double width = pieBounds.getWidth(); double height = pieBounds.getHeight(); Shape outer = new Arc2D.Double(x, y, width, height, start, extent, Arc2D.OPEN); double wt = width * thickness; double ht = height * thickness; Shape inner = new Arc2D.Double( x + wt, y + ht, width - 2 * wt, height - 2 * ht, start + extent, -extent, Arc2D.OPEN); generalPath.append(outer, false); dummy.append( new Arc2D.Double( x + wt, y + ht, width - 2 * wt, height - 2 * ht, start, extent, Arc2D.OPEN), false); Point2D point = dummy.getCurrentPoint(); if (point != null) { generalPath.lineTo(point.getX(), point.getY()); } generalPath.append(inner, false); dummy.append(new Arc2D.Double(x, y, width, height, start + extent, -extent, Arc2D.OPEN), false); point = dummy.getCurrentPoint(); generalPath.lineTo(point.getX(), point.getY()); return generalPath; }
@Override public Point2D getCurrentPoint() { return linePath.getCurrentPoint(); }
@Override public Point2D getCurrentPoint() { return linePath.getCurrentPoint(); }
/** * Draws a line segment relative to the current point of the GeneralPath. */ public static void lineToRelative(GeneralPath gp, float x, float y) { Point2D currentPoint = gp.getCurrentPoint(); gp.lineTo((float) currentPoint.getX() + x, (float) currentPoint.getY() + y); }
protected static void consume_v(Stack stack, GeneralPath geometricPath) { float y3 = ((Number) stack.pop()).floatValue(); float x3 = ((Number) stack.pop()).floatValue(); float y2 = ((Number) stack.pop()).floatValue(); float x2 = ((Number) stack.pop()).floatValue(); geometricPath.curveTo( (float) geometricPath.getCurrentPoint().getX(), (float) geometricPath.getCurrentPoint().getY(), x2, y2, x3, y3); }
/** * Set the line path to draw. * * @param newLinePath Set the line path to draw. */ public void setLinePath(GeneralPath newLinePath) { if (linePath == null || linePath.getCurrentPoint() == null){ linePath = newLinePath; }else{ linePath.append (newLinePath, false); } }
/** Converts point string to path */ static GeneralPath toPath(String pointStr) { checkPointString(pointStr); String ps = pointStr.replaceAll("\\s*,\\s*", ","); GeneralPath path = new GeneralPath(); for (String p : ps.split("\\s+")) { String[] sp2 = p.split(","); if (path.getCurrentPoint() == null) { path.moveTo(Double.valueOf(sp2[0]), Double.valueOf(sp2[1])); } else { path.lineTo(Double.valueOf(sp2[0]), Double.valueOf(sp2[1])); } } return path; }
/** * Draws a curve segment relative to the current point of the GeneralPath. * * Adds a curved segment, defined by three new points, to the path by * drawing a Bézier curve that intersects both the current coordinates and * the coordinates (x3, y3), using the specified points (x1, y1) and (x2, * y2) as Bézier control points. */ public static void curveTo(GeneralPath gp, float x1, float y1, float x2, float y2, float x3, float y3) { Point2D currentPoint = gp.getCurrentPoint(); gp.curveTo( x1 + (float) currentPoint.getX(), y1 + (float) currentPoint.getY(), x2 + (float) currentPoint.getX(), y2 + (float) currentPoint.getY(), x3 + (float) currentPoint.getX(), y3 + (float) currentPoint.getY()); }
@Override public void quadraticVertex(float ctrlX, float ctrlY, float endX, float endY) { bezierVertexCheck(); Point2D cur = gpath.getCurrentPoint(); float x1 = (float) cur.getX(); float y1 = (float) cur.getY(); bezierVertex(x1 + ((ctrlX-x1)*2/3.0f), y1 + ((ctrlY-y1)*2/3.0f), endX + ((ctrlX-endX)*2/3.0f), endY + ((ctrlY-endY)*2/3.0f), endX, endY); }
/** * Close path. */ private void closepath() { if (path.getCurrentPoint() == null) { LOG.warn("closepath without initial moveTo in font " + fontName + ", glyph " + glyphName); } else { path.closePath(); } path.moveTo(current.getX(), current.getY()); }
/** * Close path. */ private void closepath() { if (path.getCurrentPoint() == null) { LOG.warn("closepath without initial moveTo in font " + fontName + ", glyph " + glyphName); } else { path.closePath(); } path.moveTo(current.getX(), current.getY()); }
/** * Relative lineto. */ private void rlineTo(Number dx, Number dy) { float x = (float)current.getX() + dx.floatValue(); float y = (float)current.getY() + dy.floatValue(); if (path.getCurrentPoint() == null) { LOG.warn("rlineTo without initial moveTo in font " + fontName + ", glyph " + glyphName); path.moveTo(x, y); } else { path.lineTo(x, y); } current.setLocation(x, y); }
/** * Relative lineto. */ private void rlineTo(Number dx, Number dy) { float x = (float)current.getX() + dx.floatValue(); float y = (float)current.getY() + dy.floatValue(); if (path.getCurrentPoint() == null) { LOG.warn("rlineTo without initial moveTo in font " + fontName + ", glyph " + glyphName); path.moveTo(x, y); } else { path.lineTo(x, y); } current.setLocation(x, y); }
/** * Relative curveto. */ private void rrcurveTo(Number dx1, Number dy1, Number dx2, Number dy2, Number dx3, Number dy3) { float x1 = (float) current.getX() + dx1.floatValue(); float y1 = (float) current.getY() + dy1.floatValue(); float x2 = x1 + dx2.floatValue(); float y2 = y1 + dy2.floatValue(); float x3 = x2 + dx3.floatValue(); float y3 = y2 + dy3.floatValue(); if (path.getCurrentPoint() == null) { LOG.warn("rrcurveTo without initial moveTo in font " + fontName + ", glyph " + glyphName); path.moveTo(x3, y3); } else { path.curveTo(x1, y1, x2, y2, x3, y3); } current.setLocation(x3, y3); }
public void execute(GeneralPath path, Context ctx){ double rx = ctx.getValue(wr); double ry = ctx.getValue(hr); double start = ctx.getValue(stAng) / 60000; double extent = ctx.getValue(swAng) / 60000; Point2D pt = path.getCurrentPoint(); double x0 = pt.getX() - rx - rx * Math.cos(Math.toRadians(start)); double y0 = pt.getY() - ry - ry * Math.sin(Math.toRadians(start)); Arc2D arc = new Arc2D.Double( x0, y0, 2 * rx, 2 * ry, -start, -extent, Arc2D.OPEN); path.append(arc, true); } }