int getGradientSteps(Shape gradientShape) { Rectangle rect = gradientShape.getBounds(); int lower = 1; int upper = (int)(Math.max(rect.getWidth(),rect.getHeight())/2.0); while (lower < upper-1) { int mid = lower + (upper - lower) / 2; BasicStroke bs = new BasicStroke(mid, capStyle, joinStyle); Area area = new Area(bs.createStrokedShape(gradientShape)); if (area.isSingular()) { upper = mid; } else { lower = mid; } } return upper; }
return new BasicStroke(getWidth(), BasicStroke.CAP_SQUARE, getJoin()).createStrokedShape(result);
return new BasicStroke(getWidth(), BasicStroke.CAP_SQUARE, getJoin()).createStrokedShape(result);
public Shape createStrokedShape (Shape shape) { GeneralPath result = new GeneralPath(); shape = new BasicStroke(getWidth(), BasicStroke.CAP_SQUARE, getJoin()).createStrokedShape(shape); PathIterator it = new FlatteningPathIterator(shape.getPathIterator(null), FLATNESS); float points[] = new float[6];
public Shape createStrokedShape (Shape shape) { GeneralPath result = new GeneralPath(); shape = new BasicStroke(getWidth(), BasicStroke.CAP_SQUARE, getJoin()).createStrokedShape(shape); PathIterator it = new FlatteningPathIterator(shape.getPathIterator(null), FLATNESS); float points[] = new float[6];
/** */ public Shape getHaloShape(Graphics2D graphics) { GlyphVector gv = getTextGlyphVector(graphics); haloShape = new BasicStroke(2f * haloRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND) .createStrokedShape(gv.getOutline()); return haloShape; }
/** * @see java.awt.BasicStroke#createStrokedShape(java.awt.Shape) */ public Shape createStrokedShape(Shape s) { return stroke.createStrokedShape(s); }
public Shape createStrokedShape(Shape s) { // Use the first stroke to create an outline of the shape Shape outline = stroke1.createStrokedShape(s); // Use the second stroke to create an outline of that outline. // It is this outline of the outline that will be filled in return stroke2.createStrokedShape(outline); } }
/** * draw an outline using the current stroke and draw paint * @param s the path to stroke * @return a Rectangle2D to which the current region being * drawn will be added. May also be null, in which case no dirty * region will be recorded. */ public Rectangle2D stroke(GeneralPath s) { g.setComposite(state.strokeAlpha); s = new GeneralPath(autoAdjustStrokeWidth(g, state.stroke).createStrokedShape(s)); return state.strokePaint.fill(this, g, s); }
/** * draw an outline using the current stroke and draw paint * @param s the path to stroke * @return a Rectangle2D to which the current region being * drawn will be added. May also be null, in which case no dirty * region will be recorded. */ public Rectangle2D stroke(GeneralPath s) { g.setComposite(state.strokeAlpha); s = new GeneralPath(autoAdjustStrokeWidth(g, state.stroke).createStrokedShape(s)); return state.strokePaint.fill(this, g, s); }
/** * draw an outline using the current stroke and draw paint * @param s the path to stroke * @return a Rectangle2D to which the current region being * drawn will be added. May also be null, in which case no dirty * region will be recorded. */ public Rectangle2D stroke(GeneralPath s) { g.setComposite(state.strokeAlpha); s = new GeneralPath(autoAdjustStrokeWidth(g, state.stroke).createStrokedShape(s)); return state.strokePaint.fill(this, g, s); }
/** */ public Shape getHaloShape(Graphics2D graphics) { GlyphVector gv = getTextGlyphVector(graphics); haloShape = new BasicStroke(2f * haloRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND).createStrokedShape(gv.getOutline()); return haloShape; }
/** */ public Shape getHaloShape(Graphics2D graphics) { GlyphVector gv = getTextGlyphVector(graphics); haloShape = new BasicStroke(2f * haloRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND).createStrokedShape(gv.getOutline()); return haloShape; }
private Shape getShape() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke((float)getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Shape outlineShape = stroke.createStrokedShape(arrow); Area a1 = new Area(arrow); Area a2 = new Area(outlineShape); try {a1.add(a2);} catch(Exception e) {}; return a1; }
public static Shape strokedShape(Shape primitive, AttributeSet style) { return Styles.hasStroke(style) ? new BasicStroke(style.getFloat(Styles.STROKE_WIDTH)).createStrokedShape(primitive) : null; }
private Shape getShape() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke((float)getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Shape outlineShape = stroke.createStrokedShape(arrow); Area a1 = new Area(arrow); Area a2 = new Area(outlineShape); try {a1.add(a2);} catch(Exception e) {}; return a1; }
private ShapeRoi getShapeRoi() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke(getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); ShapeRoi sroi = new ShapeRoi(arrow); Shape outlineShape = stroke.createStrokedShape(arrow); sroi.or(new ShapeRoi(outlineShape)); return sroi; }
private ShapeRoi getShapeRoi() { Shape arrow = getPath(); BasicStroke stroke = new BasicStroke(getStrokeWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); ShapeRoi sroi = new ShapeRoi(arrow); Shape outlineShape = stroke.createStrokedShape(arrow); sroi.or(new ShapeRoi(outlineShape)); return sroi; }
private void writePolylineElement(IXMLElement parent, SVGPathFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); if (writePolyAttributes(elem, f, new BasicStroke((float) getStrokeTotalWidth(f)).createStrokedShape(f.getChild(0).getBezierPath()))) { parent.addChild(elem); } }
public boolean contains(Point2D aPoint) { final double MAX_DIST = 10; // the end points may contain small node, so don't // match them Line2D conn = getConnectionPoints(); if (aPoint.distance(conn.getP1()) <= MAX_DIST || aPoint.distance(conn.getP2()) <= MAX_DIST) return false; Shape p = getShape(); BasicStroke fatStroke = new BasicStroke((float) (2 * MAX_DIST)); Shape fatPath = fatStroke.createStrokedShape(p); return fatPath.contains(aPoint); } }