/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
public void render(Graphics2D grx, Rectangle2D rectangle) throws JRException { ensureSvg(); AffineTransform transform = ViewBox.getPreserveAspectRatioTransform( new float[]{0, 0, (float) documentSize.getWidth(), (float) documentSize.getHeight()}, SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE, true, (float) rectangle.getWidth(), (float) rectangle.getHeight()); Graphics2D graphics = (Graphics2D) grx.create(); graphics.translate(rectangle.getX(), rectangle.getY()); graphics.transform(transform); // CompositeGraphicsNode not thread safe synchronized (rootNode) { rootNode.paint(graphics); } }
/** * 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 vb the viewBox definition as float * @param w the width of the effective viewport * @param h The height of the effective viewport * @param aPAR The animated preserveAspectRatio value * @param ctx The BridgeContext to use for error information */ public static AffineTransform getPreserveAspectRatioTransform (Element e, float[] vb, float w, float h, SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) { // 'preserveAspectRatio' attribute try { SVGPreserveAspectRatio pAR = aPAR.getAnimVal(); short align = pAR.getAlign(); boolean meet = pAR.getMeetOrSlice() == SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; return getPreserveAspectRatioTransform(vb, align, meet, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
/** * 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 vb the viewBox definition as float * @param w the width of the effective viewport * @param h The height of the effective viewport * @param aPAR The animated preserveAspectRatio value * @param ctx The BridgeContext to use for error information */ public static AffineTransform getPreserveAspectRatioTransform (Element e, float[] vb, float w, float h, SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) { // 'preserveAspectRatio' attribute try { SVGPreserveAspectRatio pAR = aPAR.getAnimVal(); short align = pAR.getAlign(); boolean meet = pAR.getMeetOrSlice() == SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; return getPreserveAspectRatioTransform(vb, align, meet, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
/** * 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 vb the viewBox definition as float * @param w the width of the effective viewport * @param h The height of the effective viewport * @param aPAR The animated preserveAspectRatio value * @param ctx The BridgeContext to use for error information */ public static AffineTransform getPreserveAspectRatioTransform (Element e, float[] vb, float w, float h, SVGAnimatedPreserveAspectRatio aPAR, BridgeContext ctx) { // 'preserveAspectRatio' attribute try { SVGPreserveAspectRatio pAR = aPAR.getAnimVal(); short align = pAR.getAlign(); boolean meet = pAR.getMeetOrSlice() == SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET; return getPreserveAspectRatioTransform(vb, align, meet, w, h); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex); } }
/** * Returns the transformation matrix to apply to initialize a viewport or * null if the specified viewBox disables the rendering of the element. * * @param e the element with a viewbox * @param aViewBox the viewBox definition * @param aPAR the preserveAspectRatio definition * @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, SVGAnimatedRect aViewBox, SVGAnimatedPreserveAspectRatio aPAR, float w, float h, BridgeContext ctx) { if (!((SVGOMAnimatedRect) aViewBox).isSpecified()) { // no viewBox specified return new AffineTransform(); } SVGRect viewBox = aViewBox.getAnimVal(); float[] vb = new float[] { viewBox.getX(), viewBox.getY(), viewBox.getWidth(), viewBox.getHeight() }; return getPreserveAspectRatioTransform(e, vb, w, h, aPAR, ctx); }
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
/** * Returns the transformation matrix to apply to initialize a viewport or * null if the specified viewBox disables the rendering of the element. * * @param e the element with a viewbox * @param aViewBox the viewBox definition * @param aPAR the preserveAspectRatio definition * @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, SVGAnimatedRect aViewBox, SVGAnimatedPreserveAspectRatio aPAR, float w, float h, BridgeContext ctx) { if (!((SVGOMAnimatedRect) aViewBox).isSpecified()) { // no viewBox specified return new AffineTransform(); } SVGRect viewBox = aViewBox.getAnimVal(); float[] vb = new float[] { viewBox.getX(), viewBox.getY(), viewBox.getWidth(), viewBox.getHeight() }; return getPreserveAspectRatioTransform(e, vb, w, h, aPAR, ctx); }
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
/** * Returns the transformation matrix to apply to initialize a viewport or * null if the specified viewBox disables the rendering of the element. * * @param e the element with a viewbox * @param aViewBox the viewBox definition * @param aPAR the preserveAspectRatio definition * @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, SVGAnimatedRect aViewBox, SVGAnimatedPreserveAspectRatio aPAR, float w, float h, BridgeContext ctx) { if (!((SVGOMAnimatedRect) aViewBox).isSpecified()) { // no viewBox specified return new AffineTransform(); } SVGRect viewBox = aViewBox.getAnimVal(); float[] vb = new float[] { viewBox.getX(), viewBox.getY(), viewBox.getWidth(), viewBox.getHeight() }; return getPreserveAspectRatioTransform(e, vb, w, h, aPAR, ctx); }
String aspectRatio = elt.getAttributeNS (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); Tx = ViewBox.getPreserveAspectRatioTransform (elt, viewBox, aspectRatio, dim.width, dim.height, null); } else {