Refine search
private GeneralPath makeEllipsePath(Diagram diagram) { if(points.size() != 4) return null; Rectangle bounds = makeIntoPath().getBounds(); float xOff = (float) bounds.getWidth() * 0.5f * KAPPA; float yOff = (float) bounds.getHeight() * 0.5f * KAPPA; ShapePoint pointMid = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getCenterY()); ShapePoint left = new ShapePoint((float)bounds.getMinX(), (float)pointMid.getY()); ShapePoint right = new ShapePoint((float)bounds.getMaxX(), (float)pointMid.getY()); ShapePoint top = new ShapePoint((float)pointMid.getX(), (float)bounds.getMinY()); ShapePoint bottom = new ShapePoint((float)pointMid.getX(), (float)bounds.getMaxY()); GeneralPath path = new GeneralPath(); path.moveTo(top.x, top.y); path.curveTo(top.x + xOff, top.y, right.x, right.y - yOff, right.x, right.y); path.curveTo(right.x, right.y + yOff, bottom.x + xOff, bottom.y, bottom.x, bottom.y); path.curveTo(bottom.x - xOff, bottom.y, left.x, left.y + yOff, left.x, left.y); path.curveTo(left.x, left.y - yOff, top.x - xOff, top.y, top.x, top.y); path.closePath(); return path; }
void _extendPath(GeneralPath gp) { if (points.size() == 0) return; Point pt = points.get(0); Point ctrl1, ctrl2; gp.moveTo(pt.x, pt.y); int pointCount = getPointCount(); for (int i = 1; i < pointCount; i++) { pt = points.get(i); if (pt.isLineTo()) { gp.lineTo(pt.x, pt.y); } else if (pt.isCurveTo()) { ctrl1 = points.get(i - 2); ctrl2 = points.get(i - 1); gp.curveTo(ctrl1.x, ctrl1.y, ctrl2.x, ctrl2.y, pt.x, pt.y); } } if (closed) gp.closePath(); }
protected static GeneralPath consume_c(Stack stack, GeneralPath geometricPath) { if (!stack.isEmpty()) { float y3 = ((Number) stack.pop()).floatValue(); float x3 = ((Number) stack.pop()).floatValue(); float y2 = ((Number) stack.pop()).floatValue(); float x2 = ((Number) stack.pop()).floatValue(); float y1 = ((Number) stack.pop()).floatValue(); float x1 = ((Number) stack.pop()).floatValue(); if (geometricPath == null) { geometricPath = new GeneralPath(); } geometricPath.curveTo(x1, y1, x2, y2, x3, y3); } return geometricPath; }
GeneralPath path = new GeneralPath(); path.moveTo(point1.x, point1.y); path.curveTo( point1.x + cpOffsetX, point1.y + cpOffsetYTop, point2.x - cpOffsetX, point2.y + cpOffsetYTop, point2.x, point2.y ); path.curveTo( point2.x - cpOffsetX, point2.y - cpOffsetYTop, point1.x + cpOffsetX, point1.y - cpOffsetYTop, path.moveTo(point1.x, point1.y); path.lineTo(point4.x, point4.y); path.curveTo( point4.x + cpOffsetX, point4.y + cpOffsetYBottom, point3.x - cpOffsetX, point3.y + cpOffsetYBottom,
/** * 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); }
DriverLineG2d.manageStroke(param, g2d); final GeneralPath p = new GeneralPath(); boolean hasBezier = false; final MinMaxDouble minMax = new MinMaxDouble(); p.moveTo((float) (x + coord[0]), (float) (y + coord[1])); minMax.manage(x + coord[0], y + coord[1]); } else if (type == USegmentType.SEG_LINETO) { minMax.manage(x + coord[0], y + coord[1]); } else if (type == USegmentType.SEG_CUBICTO) { p.curveTo((float) (x + coord[0]), (float) (y + coord[1]), (float) (x + coord[2]), (float) (y + coord[3]), (float) (x + coord[4]), (float) (y + coord[5])); minMax.manage(x + coord[4], y + coord[5]);
public static void setupRoundedGeneralPath(Polygon polygon, GeneralPath generalPath) { generalPath.reset(); List<int[]> l = new ArrayList<int[]>(); for(int i=0; i < polygon.npoints; i++){ l.add(new int[]{polygon.xpoints[i],polygon.ypoints[i]}); } l.add(l.get(0)); l.add(l.get(1)); int[][] a=l.toArray(new int[][]{}); generalPath.moveTo(a[0][0],a[0][1]); for(int pointIndex=1; pointIndex<a.length-1;pointIndex++){ int[] p1=a[pointIndex-1]; int[] p2=a[pointIndex]; int[] p3=a[pointIndex+1]; int[] mPoint = calculatePoint(p1, p2); generalPath.lineTo(mPoint[0], mPoint[1]); mPoint = calculatePoint(p3, p2); generalPath.curveTo(p2[0], p2[1], p2[0], p2[1], mPoint[0], mPoint[1]); } }
private static void paintConnectionLine(Graphics2D g, int x0, int y0, int x1, int y1) { double dy = Math.abs(y1 - y0); if (dy < GRID_CELL_SIZE) { g.drawLine(x0, y0, x1, y1); } else { double halfDx = Math.abs(x1 - x0) / 2.0; GeneralPath p = new GeneralPath(); p.moveTo(x0, y0); p.curveTo(x0, y0 + halfDx, x1, y1 - halfDx, x1, y1); g.draw(p); } }
public void drawSphere(Camera camera, OutputShape shape) { Matrix4Red orig = shape.matrix; // draw.setColor(lighting.lightObject(shape)); draw.setColor(shape.getColor()); Matrix4 b = HALF; Point2 p2 = camera.mapTo2D(v3d.set(orig.m03, -orig.m13, orig.m23)); Point2 p3 = camera.mapTo2D(v3d.setXyz(orig, b)); float dx = (p3.x - p2.x); float dy = (p3.y - p2.y); float r = (float) Math.sqrt(dx * dx + dy * dy); float fact = 0.55f; path.reset(); path.moveTo(p2.x, p2.y - r); path.curveTo(p2.x + r * fact, p2.y - r, p2.x + r, p2.y - r * fact, p2.x + r, p2.y); path.curveTo(p2.x + r, p2.y + r * fact, p2.x + r * fact, p2.y + r, p2.x, p2.y + r); path.curveTo(p2.x - r * fact, p2.y + r, p2.x - r, p2.y + r * fact, p2.x - r, p2.y); path.curveTo(p2.x - r, p2.y - r * fact, p2.x - r * fact, p2.y - r, p2.x, p2.y - r); path.closePath(); path.transform(toScreen); draw.fill(path); }
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, paths.size()); GeneralPath subpath = null; subpath = new GeneralPath(Path2D.WIND_EVEN_ODD, length); subpath.moveTo(current.apx, current.apy); subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy); subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy); subpath.curveTo(current.cplx, current.cply, first.cppx, first.cppy, first.apx, first.apy); subpath.closePath(); path.append(subpath, false);
/** * 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); }
private static GeneralPath createPathCyclic() { GeneralPath p = new GeneralPath(); p.moveTo(99.936f, 51.019f); p.curveTo(99.936f, 51.019f, 78.316f, 86.931f, 51.019f, 89.745f); p.curveTo(23.721f, 92.559f, -2.012f, 75.843f, 11.082f, 61.21f); p.curveTo(4.178f, 46.576f, 34.931f, 39.565f, 62.229f, 36.751f); p.curveTo(89.526f, 33.937f, 99.936f, 51.019f, 99.936f, 51.019f); return p; } private static GeneralPath createPathAcross() {
/** * 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); }
GeneralPath shape = new GeneralPath(); shape.moveTo(cubicCurve1.x1, cubicCurve1.y1); shape.curveTo(cubicCurve1.ctrlx1, cubicCurve1.ctrly1, cubicCurve1.ctrlx2, cubicCurve1.ctrly2, cubicCurve1.x2, cubicCurve1.y2); shape.curveTo(cubicCurve2.ctrlx1, cubicCurve2.ctrly1, cubicCurve2.ctrlx2, cubicCurve2.ctrly2, cubicCurve2.x2, cubicCurve2.y2); shape.curveTo(cubicCurve3.ctrlx1, cubicCurve3.ctrly1, cubicCurve3.ctrlx2, cubicCurve3.ctrly2, cubicCurve1.x1, cubicCurve1.y1); g2D.draw(shape); g2D.setClip(shape); // Draw an image g2D.drawImage(image, 0, 0, this);
private void paintShapeNode_0_0_0_2(Graphics2D g) { GeneralPath shape2 = new GeneralPath(); shape2.moveTo(7.5232677, 3.498762); shape2.curveTo(7.5232677, 4.1954064, 5.2491736, 4.760148, 2.4439359, 4.760148); shape2.curveTo(-0.36130166, 4.760148, -2.635396, 4.1954064, -2.635396, 3.498762); shape2.curveTo(-2.635396, 2.8021176, -0.36130166, 2.2373757, 2.4439359, 2.2373757); shape2.curveTo(5.2491736, 2.2373757, 7.5232677, 2.8021176, 7.5232677, 3.498762); shape2.closePath(); g.fill(shape2); }
private void paintShapeNode_0_0_0_4(Graphics2D g) { GeneralPath shape4 = new GeneralPath(); shape4.moveTo(7.5232677, 3.498762); shape4.curveTo(7.5232677, 4.1954064, 5.2491736, 4.760148, 2.4439359, 4.760148); shape4.curveTo(-0.36130166, 4.760148, -2.635396, 4.1954064, -2.635396, 3.498762); shape4.curveTo(-2.635396, 2.8021176, -0.36130166, 2.2373757, 2.4439359, 2.2373757); shape4.curveTo(5.2491736, 2.2373757, 7.5232677, 2.8021176, 7.5232677, 3.498762); shape4.closePath(); g.fill(shape4); }
private void paintShapeNode_0_0_0_3(Graphics2D g) { GeneralPath shape3 = new GeneralPath(); shape3.moveTo(7.5232677, 3.498762); shape3.curveTo(7.5232677, 4.1954064, 5.2491736, 4.760148, 2.4439359, 4.760148); shape3.curveTo(-0.36130166, 4.760148, -2.635396, 4.1954064, -2.635396, 3.498762); shape3.curveTo(-2.635396, 2.8021176, -0.36130166, 2.2373757, 2.4439359, 2.2373757); shape3.curveTo(5.2491736, 2.2373757, 7.5232677, 2.8021176, 7.5232677, 3.498762); shape3.closePath(); g.fill(shape3); }
private static GeneralPath createPathAcross() { GeneralPath p = new GeneralPath(); p.moveTo(99.936f, 21.019f); p.curveTo(99.936f, 51.019f, 78.316f, 86.931f, 51.019f, 89.745f); p.curveTo(23.721f, 92.559f, -2.012f, 75.843f, 0, 61.21f); return p; }
private GeneralPath getPathCBow() { GeneralPath path = new GeneralPath(); path.moveTo(31, 12); path.curveTo(29, -3.5f, 2, -5.5f, 0, 14.5f); path.lineTo(11, 14.5f); path.curveTo(11, 8.5f, 18, 9, 18, 12); path.lineTo(31, 12); path.closePath(); return path; } }
private GeneralPath getPathOBow() { GeneralPath path = new GeneralPath(); path.moveTo(0, 0); path.curveTo(23, 0, 23, 31, 0, 31); path.lineTo(0, 20); path.curveTo(8, 20, 8, 11, 0, 11); path.lineTo(0, 0); path.closePath(); return path; }