/** * Returns the transformation matrix to apply to initalize a viewport or * null if the specified viewBox disables the rendering of the element. * * @deprecated Replaced by {@link * #getPreserveAspectRatioTransform(Element,float,float,BridgeContext)}, * which has more accurate error reporting. * @param e the element with a viewbox * @param w the width of the effective viewport * @param h The height of the effective viewport */ public static AffineTransform getPreserveAspectRatioTransform(Element e, float w, float h) { return getPreserveAspectRatioTransform(e, w, h, null); }
Px = ViewBox.getViewTransform(ref, root, width, height, null);
return new AffineTransform(); float[] vb = parseViewBoxAttribute(e, viewBox, ctx); return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
return getPreserveAspectRatioTransform(e, w, h, ctx); Element ancestorSVG = getClosestAncestorSVGElement(e); if (!(viewElement.getNamespaceURI().equals(SVG_NAMESPACE_URI) && viewElement.getLocalName().equals(SVG_VIEW_TAG))) { vb = parseViewBoxAttribute(elt, viewBoxStr, ctx); = getPreserveAspectRatioTransform(vb, align, meet, w, h); if (vh.hasTransform) { transform.concatenate(vh.getAffineTransform());
Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else {
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(); }
return getPreserveAspectRatioTransform(e, w, h, ctx); Element ancestorSVG = getClosestAncestorSVGElement(e); if (!(viewElement.getNamespaceURI().equals(SVG_NAMESPACE_URI) && viewElement.getLocalName().equals(SVG_VIEW_TAG))) { vb = parseViewBoxAttribute(elt, viewBoxStr, ctx); = getPreserveAspectRatioTransform(vb, align, meet, w, h); if (vh.hasTransform) { transform.concatenate(vh.getAffineTransform());
Px = ViewBox.getViewTransform(ref, root, width, height, ctx); } else if ((viewBox != null) && (viewBox.length() != 0)) { String aspectRatio = root.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Px = ViewBox.getPreserveAspectRatioTransform (root, viewBox, aspectRatio, width, height, ctx); } else {
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(); }
/** * Returns the transformation matrix to apply to initalize a viewport or * null if the specified viewBox disables the rendering of the element. * * @deprecated Replaced by {@link * #getPreserveAspectRatioTransform(Element,float,float,BridgeContext)}, * which has more accurate error reporting. * @param e the element with a viewbox * @param w the width of the effective viewport * @param h The height of the effective viewport */ public static AffineTransform getPreserveAspectRatioTransform(Element e, float w, float h) { return getPreserveAspectRatioTransform(e, w, h, null); }
return getPreserveAspectRatioTransform(e, w, h, ctx); Element ancestorSVG = getClosestAncestorSVGElement(e); if (!(viewElement.getNamespaceURI().equals(SVG_NAMESPACE_URI) && viewElement.getLocalName().equals(SVG_VIEW_TAG))) { vb = parseViewBoxAttribute(elt, viewBoxStr, ctx); = getPreserveAspectRatioTransform(vb, align, meet, w, h); if (vh.hasTransform) { transform.concatenate(vh.getAffineTransform());
return new AffineTransform(); float[] vb = parseViewBoxAttribute(e, viewBox, ctx); return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
protected AffineTransform calculateViewingTransform (String fragIdent, SVGSVGElement svgElt) { Dimension d = getSize(); if (d.width < 1) d.width = 1; if (d.height < 1) d.height = 1; return ViewBox.getViewTransform (fragIdent, svgElt, d.width, d.height, bridgeContext); }
String viewBox = svgElement.getAttributeNS (null, SVG_VIEW_BOX_ATTRIBUTE); vb = ViewBox.parseViewBoxAttribute(e, viewBox, ctx);
/** * Returns the transformation matrix to apply to initalize a viewport or * null if the specified viewBox disables the rendering of the element. * * @deprecated Replaced by {@link * #getPreserveAspectRatioTransform(Element,float,float,BridgeContext)}, * which has more accurate error reporting. * @param e the element with a viewbox * @param w the width of the effective viewport * @param h The height of the effective viewport */ public static AffineTransform getPreserveAspectRatioTransform(Element e, float w, float h) { return getPreserveAspectRatioTransform(e, w, h, null); }
return new AffineTransform(); float[] vb = parseViewBoxAttribute(e, viewBox, ctx); return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
protected AffineTransform calculateViewingTransform (String fragIdent, SVGSVGElement svgElt) { Dimension d = getSize(); if (d.width < 1) d.width = 1; if (d.height < 1) d.height = 1; return ViewBox.getViewTransform (fragIdent, svgElt, d.width, d.height, bridgeContext); }
String viewBox = svgElement.getAttributeNS (null, SVG_VIEW_BOX_ATTRIBUTE); vb = ViewBox.parseViewBoxAttribute(e, viewBox, ctx);
/** * Returns the transformation matrix to apply to initalize a viewport or * null if the specified viewBox disables the rendering of the element. * * @param e the element with a viewbox * @param w the width of the effective viewport * @param h The height of the effective viewport * @param ctx The BridgeContext to use for error information */ public static AffineTransform getPreserveAspectRatioTransform (Element e, float w, float h, BridgeContext ctx) { String viewBox = e.getAttributeNS(null, SVG_VIEW_BOX_ATTRIBUTE); String aspectRatio = e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); return getPreserveAspectRatioTransform(e, viewBox, aspectRatio, w, h, ctx); }
float[] vb = ViewBox.parseViewBoxAttribute(svgDocument.getRootElement(), svgDocument.getRootElement().getAttribute("viewBox"), bridgeContext); AffineTransform usr2dev = ViewBox.getPreserveAspectRatioTransform(vb, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE, true, widthPixel, heightPixel);