public SwingUniversalImageSvg( SvgImage svg ) { // get GraphicsNode and size from svg document UserAgentAdapter userAgentAdapter = new UserAgentAdapter(); DocumentLoader documentLoader = new DocumentLoader( userAgentAdapter ); BridgeContext ctx = new BridgeContext( userAgentAdapter, documentLoader ); GVTBuilder builder = new GVTBuilder(); svgGraphicsNode = builder.build( ctx, svg.getDocument() ); svgGraphicsSize = ctx.getDocumentSize(); }
public SwtUniversalImageSvg( SvgImage svg ) { // get GraphicsNode and size from svg document UserAgentAdapter userAgentAdapter = new UserAgentAdapter(); DocumentLoader documentLoader = new DocumentLoader( userAgentAdapter ); BridgeContext ctx = new BridgeContext( userAgentAdapter, documentLoader ); GVTBuilder builder = new GVTBuilder(); svgGraphicsNode = builder.build( ctx, svg.getDocument() ); svgGraphicsSize = ctx.getDocumentSize(); }
/** * Returns the size of the SVG document. */ public Dimension2D getSVGDocumentSize() { return bridgeContext.getDocumentSize(); }
/** * Returns the size of the SVG document. */ public Dimension2D getSVGDocumentSize() { return bridgeContext.getDocumentSize(); }
/** * Returns the size of the SVG document. */ public Dimension2D getSVGDocumentSize() { return bridgeContext.getDocumentSize(); }
Dimension2D docSize = ctx.getDocumentSize(); if (docSize != null) { defaultWidth = (float) docSize.getWidth();
private void prepare(Graphics2D g2d, Rectangle2D area) { // If no viewbox is defined in the svg file, a viewbox of 100x100 is // assumed, as defined in SVGUserAgent.getViewportSize() double tx = area.getX(); double ty = area.getY(); if (tx != 0 || ty != 0) { g2d.translate(tx, ty); } float iw = (float) ctx.getDocumentSize().getWidth(); float ih = (float) ctx.getDocumentSize().getHeight(); float w = (float) area.getWidth(); float h = (float) area.getHeight(); float sx = w / iw; float sy = h / ih; if (sx != 1.0 || sy != 1.0) { g2d.scale(sx, sy); } normaliseScale(g2d); }
public void setGraphicsNode(GraphicsNode gn, boolean createDispatcher) { Dimension2D dim = bridgeContext.getDocumentSize(); Dimension mySz = new Dimension((int)dim.getWidth(), (int)dim.getHeight()); JSVGComponent.this.setMySize(mySz); SVGSVGElement elt = svgDocument.getRootElement(); prevComponentSize = getSize(); AffineTransform at = calculateViewingTransform (fragmentIdentifier, elt); CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn); if (cgn != null) { cgn.setViewingTransform(at); } viewingTransform = null; initialTransform = new AffineTransform(); setRenderingTransform(initialTransform, false); jsvgComponentListener.updateMatrix(initialTransform); addJGVTComponentListener(jsvgComponentListener); addComponentListener(jsvgComponentListener); super.setGraphicsNode(gn, createDispatcher); }
public void setGraphicsNode(GraphicsNode gn, boolean createDispatcher) { Dimension2D dim = bridgeContext.getDocumentSize(); Dimension mySz = new Dimension((int)dim.getWidth(), (int)dim.getHeight()); JSVGComponent.this.setMySize(mySz); SVGSVGElement elt = svgDocument.getRootElement(); prevComponentSize = getSize(); AffineTransform at = calculateViewingTransform (fragmentIdentifier, elt); CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn); if (cgn != null) { cgn.setViewingTransform(at); } viewingTransform = null; initialTransform = new AffineTransform(); setRenderingTransform(initialTransform, false); jsvgComponentListener.updateMatrix(initialTransform); addJGVTComponentListener(jsvgComponentListener); addComponentListener(jsvgComponentListener); super.setGraphicsNode(gn, createDispatcher); }
public void setGraphicsNode(GraphicsNode gn, boolean createDispatcher) { Dimension2D dim = bridgeContext.getDocumentSize(); Dimension mySz = new Dimension((int)dim.getWidth(), (int)dim.getHeight()); JSVGComponent.this.setMySize(mySz); SVGSVGElement elt = svgDocument.getRootElement(); prevComponentSize = getSize(); AffineTransform at = calculateViewingTransform (fragmentIdentifier, elt); CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn); if (cgn != null) { cgn.setViewingTransform(at); } viewingTransform = null; initialTransform = new AffineTransform(); setRenderingTransform(initialTransform, false); jsvgComponentListener.updateMatrix(initialTransform); addJGVTComponentListener(jsvgComponentListener); addComponentListener(jsvgComponentListener); super.setGraphicsNode(gn, createDispatcher); }
float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight();
float docWidth = (float)ctx.getDocumentSize().getWidth(); float docHeight = (float)ctx.getDocumentSize().getHeight();
GVTBuilder builder = new GVTBuilder(); rootNode = builder.build(ctx, document); documentSize = ctx.getDocumentSize();
float iw = (float) ctx.getDocumentSize().getWidth() * 1000f; float ih = (float) ctx.getDocumentSize().getHeight() * 1000f;
float w = (float)ctx.getDocumentSize().getWidth() * 1000f; float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
Dimension2D docSize = ctx.getDocumentSize(); if (docSize != null) { defaultWidth = (float) docSize.getWidth();
float w = (float)ctx.getDocumentSize().getWidth() * 1000f; float h = (float)ctx.getDocumentSize().getHeight() * 1000f;