private Shape getHitShape() { if (cachedHitShape == null) { cachedHitShape = new GrowStroke( (float) SVGAttributeKeys.getStrokeTotalWidth(this) / 2f, (float) SVGAttributeKeys.getStrokeTotalMiterLimit(this)).createStrokedShape(getTransformedShape()); } return cachedHitShape; }
private Shape getHitShape() { if (cachedHitShape == null) { if (get(FILL_COLOR) != null || get(FILL_GRADIENT) != null) { cachedHitShape = new GrowStroke( (float) SVGAttributeKeys.getStrokeTotalWidth(this) / 2f, (float) SVGAttributeKeys.getStrokeTotalMiterLimit(this)).createStrokedShape(getTransformedShape()); } else { cachedHitShape = SVGAttributeKeys.getHitStroke(this).createStrokedShape(getTransformedShape()); } } return cachedHitShape; }
case PathIterator.SEG_MOVETO: if (bp.size() != 0) { traceStroke(bp, left, right); traceStroke(bp, left, right);
private Shape getHitShape() { if (cachedHitShape == null) { if (get(FILL_COLOR) != null || get(FILL_GRADIENT) != null) { cachedHitShape = new GrowStroke( (float) SVGAttributeKeys.getStrokeTotalWidth(this) / 2f, (float) SVGAttributeKeys.getStrokeTotalMiterLimit(this)).createStrokedShape(getTransformedShape()); } else { cachedHitShape = SVGAttributeKeys.getHitStroke(this).createStrokedShape(getTransformedShape()); } } return cachedHitShape; }
private Shape getHitShape() { if (cachedHitShape == null) { cachedHitShape = new GrowStroke( (float) ODGAttributeKeys.getStrokeTotalWidth(this) / 2f, (float) ODGAttributeKeys.getStrokeTotalMiterLimit(this)).createStrokedShape(getTransformedShape()); } return cachedHitShape; }
@Override protected void drawFill(Graphics2D g) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularFillGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle = gs.createStrokedShape(triangle); } g.fill(triangle); }
@Override protected void drawStroke(Graphics2D g) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularDrawGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle = gs.createStrokedShape(triangle); } g.draw(triangle); } @Override
@Override protected void drawFill(Graphics2D g) { if (isClosed() || get(UNCLOSED_PATH_FILLED)) { double grow = AttributeKeys.getPerpendicularFillGrowth(this); if (grow == 0d) { g.fill(path); } else { GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)); g.fill(gs.createStrokedShape(path)); } } }
public Point2D.Double chop(Point2D.Double p) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle =gs.createStrokedShape(triangle); } return Geom.chop(triangle, p); } /**
@Override protected void drawStroke(Graphics2D g) { if (isClosed()) { double grow = AttributeKeys.getPerpendicularDrawGrowth(this); if (grow == 0d) { g.draw(path); } else { GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)); g.draw(gs.createStrokedShape(path)); } } else { g.draw(getCappedPath()); } drawCaps(g); }
private void writeLineElement(IXMLElement parent, SVGPathFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); if (writePolyAttributes(elem, f, new GrowStroke( (getStrokeTotalWidth(f) / 2d), getStrokeTotalWidth(f)).createStrokedShape(new Line2D.Double( f.getStartPoint(), f.getEndPoint())))) { parent.addChild(elem); } }
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean contains(Point2D.Double p) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle =gs.createStrokedShape(triangle); } return triangle.contains(p); } @Override
private void writePolygonElement(IXMLElement parent, SVGPathFigure f) throws IOException { IXMLElement elem = parent.createElement("area"); if (writePolyAttributes(elem, f, new GrowStroke( (getStrokeTotalWidth(f) / 2d), getStrokeTotalWidth(f)).createStrokedShape(f.getChild(0).getBezierPath()))) { parent.addChild(elem); } }
public Point2D.Double chop(Point2D.Double p) { if (isClosed()) { double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow == 0d) { return path.chop(p); } else { GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)); return Geom.chop(gs.createStrokedShape(path), p); } } else { return path.chop(p); } }
private void writePathElement(IXMLElement parent, SVGPathFigure f) throws IOException { GrowStroke growStroke = new GrowStroke( (getStrokeTotalWidth(f) / 2d), getStrokeTotalWidth(f)); BasicStroke basicStroke = new BasicStroke((float) getStrokeTotalWidth(f)); for (Figure child : f.getChildren()) { SVGBezierFigure bezier = (SVGBezierFigure) child; IXMLElement elem = parent.createElement("area"); if (bezier.isClosed()) { writePolyAttributes(elem, f, growStroke.createStrokedShape(bezier.getBezierPath())); } else { writePolyAttributes(elem, f, basicStroke.createStrokedShape(bezier.getBezierPath())); } parent.addChild(elem); } }
GrowStroke gs = new GrowStroke(grow, (AttributeKeys.getStrokeTotalWidth(this) if (gs.createStrokedShape(getPath()).contains(p)) { return true; } else {
private void writeRectElement(IXMLElement parent, SVGRectFigure f) throws IOException { IXMLElement elem = parent.createElement("AREA"); boolean isContained; if (f.getArcHeight() == 0 && f.getArcWidth() == 0) { Rectangle2D.Double rect = f.getBounds(); double grow = getPerpendicularHitGrowth(f); rect.x -= grow; rect.y -= grow; rect.width += grow; rect.height += grow; isContained = writeRectAttributes(elem, f, rect); } else { isContained = writePolyAttributes(elem, f, new GrowStroke( (getStrokeTotalWidth(f) / 2d), getStrokeTotalWidth(f)).createStrokedShape(new RoundRectangle2D.Double( f.getX(), f.getY(), f.getWidth(), f.getHeight(), f.getArcWidth(), f.getArcHeight()))); } if (isContained) { parent.addChild(elem); } }
GrowStroke gs = new GrowStroke(grow, (AttributeKeys.getStrokeTotalWidth(this) if (gs.createStrokedShape(getPath()).contains(p)) { return true; } else {
GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this) if (gs.createStrokedShape(path).contains(p)) { return true; } else {