public RenderableSVG(Document doc) { this.node = getGraphicNode(doc); this.bounds = getSvgDocBounds(doc); if (bounds == null) bounds = node.getBounds(); }
/** * Returns the bounds of the area covered by this node's primitive paint. */ public Rectangle2D getPrimitiveBounds() { if (source == null) return null; return source.getBounds(); }
/** * Returns the bounds of the area covered by this node's primitive paint. */ public Rectangle2D getPrimitiveBounds() { if (source == null) return null; return source.getBounds(); }
/** * Returns the bounds of the area covered by this node's primitive paint. */ public Rectangle2D getPrimitiveBounds() { if (source == null) return null; return source.getBounds(); }
public SVGDrawable( final GraphicsNode rootNode ) { if ( rootNode == null ) { throw new NullPointerException(); } this.rootNode = rootNode; final Rectangle2D bounds = rootNode.getBounds(); if ( bounds != null ) { this.width = bounds.getWidth(); this.height = bounds.getHeight(); } }
public RenderableSVG(Document doc) { this.node = getGraphicNode(doc); this.bounds = getSvgDocBounds(doc); if (bounds == null) bounds = node.getBounds(); }
/** * Returns the bounds of this Rable in the user coordinate system. */ public Rectangle2D getBounds2D(){ if (usePrimitivePaint){ Rectangle2D primitiveBounds = node.getPrimitiveBounds(); if(primitiveBounds == null) return new Rectangle2D.Double(0, 0, 0, 0); return (Rectangle2D)(primitiveBounds.clone()); } // When not using Primitive paint we return out bounds in our // parent's user space. This makes sense since this is the // space that we will draw our selves into (since paint unlike // primitivePaint incorporates the transform from our user // space to our parents user space). Rectangle2D bounds = node.getBounds(); if(bounds == null){ return new Rectangle2D.Double(0, 0, 0, 0); } AffineTransform at = node.getTransform(); if (at != null){ bounds = at.createTransformedShape(bounds).getBounds2D(); } return bounds; }
/** * Returns the bounds of this Rable in the user coordinate system. */ public Rectangle2D getBounds2D(){ if (usePrimitivePaint){ Rectangle2D primitiveBounds = node.getPrimitiveBounds(); if(primitiveBounds == null) return new Rectangle2D.Double(0, 0, 0, 0); return (Rectangle2D)(primitiveBounds.clone()); } // When not using Primitive paint we return out bounds in our // parent's user space. This makes sense since this is the // space that we will draw our selves into (since paint unlike // primitivePaint incorporates the transform from our user // space to our parents user space). Rectangle2D bounds = node.getBounds(); if(bounds == null){ return new Rectangle2D.Double(0, 0, 0, 0); } AffineTransform at = node.getTransform(); if (at != null){ bounds = at.createTransformedShape(bounds).getBounds2D(); } return bounds; }
/** * Returns the bounds of this Rable in the user coordinate system. */ public Rectangle2D getBounds2D(){ if (usePrimitivePaint){ Rectangle2D primitiveBounds = node.getPrimitiveBounds(); if(primitiveBounds == null) return new Rectangle2D.Double(0, 0, 0, 0); return (Rectangle2D)(primitiveBounds.clone()); } // When not using Primitive paint we return out bounds in our // parent's user space. This makes sense since this is the // space that we will draw our selves into (since paint unlike // primitivePaint incorporates the transform from our user // space to our parents user space). Rectangle2D bounds = node.getBounds(); if(bounds == null){ return new Rectangle2D.Double(0, 0, 0, 0); } AffineTransform at = node.getTransform(); if (at != null){ bounds = at.createTransformedShape(bounds).getBounds2D(); } return bounds; }
Rectangle2D cr2d = gn.getBounds(); if (cr2d == null) continue; AffineTransform at = gn.getTransform();
Rectangle2D cr2d = gn.getBounds(); if (cr2d == null) continue; AffineTransform at = gn.getTransform();
Rectangle2D cr2d = gn.getBounds(); if (cr2d == null) continue; AffineTransform at = gn.getTransform();
if (ret == null) { if (f != null) ret = f.getBounds2D(); else ret = gn.getBounds(); } else if (ret == NULL_RECT) ret = null;
protected Rectangle2D getViewBoxRect() { SVGDocument doc = canvas.getSVGDocument(); if (doc == null) return null; SVGSVGElement el = doc.getRootElement(); if (el == null) return null; String viewBoxStr = el.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if (viewBoxStr.length() != 0) { float[] rect = ViewBox.parseViewBoxAttribute(el, viewBoxStr, null); return new Rectangle2D.Float(rect[0], rect[1], rect[2], rect[3]); } GraphicsNode gn = canvas.getGraphicsNode(); if (gn == null) return null; Rectangle2D bounds = gn.getBounds(); if (bounds == null) return null; return (Rectangle2D) bounds.clone(); }
protected Rectangle2D getViewBoxRect() { SVGDocument doc = canvas.getSVGDocument(); if (doc == null) return null; SVGSVGElement el = doc.getRootElement(); if (el == null) return null; String viewBoxStr = el.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if (viewBoxStr.length() != 0) { float[] rect = ViewBox.parseViewBoxAttribute(el, viewBoxStr, null); return new Rectangle2D.Float(rect[0], rect[1], rect[2], rect[3]); } GraphicsNode gn = canvas.getGraphicsNode(); if (gn == null) return null; Rectangle2D bounds = gn.getBounds(); if (bounds == null) return null; return (Rectangle2D) bounds.clone(); }
if (ret == null) { if (f != null) ret = f.getBounds2D(); else ret = gn.getBounds(); } else if (ret == NULL_RECT) ret = null;
protected Rectangle2D getViewBoxRect() { SVGDocument doc = canvas.getSVGDocument(); if (doc == null) return null; SVGSVGElement el = doc.getRootElement(); if (el == null) return null; String viewBoxStr = el.getAttributeNS (null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE); if (viewBoxStr.length() != 0) { float[] rect = ViewBox.parseViewBoxAttribute(el, viewBoxStr, null); return new Rectangle2D.Float(rect[0], rect[1], rect[2], rect[3]); } GraphicsNode gn = canvas.getGraphicsNode(); if (gn == null) return null; Rectangle2D bounds = gn.getBounds(); if (bounds == null) return null; return (Rectangle2D) bounds.clone(); }
public Rectangle getBounds(GraphicsNode rootGN) { Rectangle2D r2d; switch (this) { case sensitive: r2d = rootGN.getSensitiveBounds(); break; case geometry: r2d = rootGN.getGeometryBounds(); break; case primitive: r2d = rootGN.getPrimitiveBounds(); break; case all: default: r2d = rootGN.getBounds(); break; } return r2d.getBounds(); }
final GVTBuilder builder = new GVTBuilder(); final GraphicsNode node = builder.build( ctx, document ); final Rectangle2D bounds = node.getBounds();
public Rectangle getBounds(GraphicsNode rootGN) { Rectangle2D r2d; switch (this) { case sensitive: r2d = rootGN.getSensitiveBounds(); break; case geometry: r2d = rootGN.getGeometryBounds(); break; case primitive: r2d = rootGN.getPrimitiveBounds(); break; case all: default: r2d = rootGN.getBounds(); break; } return r2d.getBounds(); }