Class ViewBox

    • Constructor Detail

      • ViewBox

        protected ViewBox()
        No instance of this class is required.
    • Method Detail

      • getViewTransform

        public static java.awt.geom.AffineTransform getViewTransform​(java.lang.String ref,
                                                                     org.w3c.dom.Element e,
                                                                     float w,
                                                                     float h,
                                                                     BridgeContext ctx)
        Parses the specified reference (from a URI) and returns the appropriate transform.
        Parameters:
        ref - the reference of the URI that may specify additional attribute values such as the viewBox, preserveAspectRatio or a transform
        e - the element interested in its view transform
        w - the width of the effective viewport
        h - The height of the effective viewport
        ctx - The BridgeContext to use for error information
        Throws:
        BridgeException - if an error occured while computing the preserveAspectRatio transform
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    float w,
                                                                                    float h)
        Deprecated.
        Replaced by getPreserveAspectRatioTransform(Element,float,float,BridgeContext), which has more accurate error reporting.
        Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        w - the width of the effective viewport
        h - The height of the effective viewport
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    float w,
                                                                                    float h,
                                                                                    BridgeContext ctx)
        Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        w - the width of the effective viewport
        h - The height of the effective viewport
        ctx - The BridgeContext to use for error information
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    java.lang.String viewBox,
                                                                                    java.lang.String aspectRatio,
                                                                                    float w,
                                                                                    float h,
                                                                                    BridgeContext ctx)
        Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        viewBox - the viewBox definition
        w - the width of the effective viewport
        h - The height of the effective viewport
        ctx - The BridgeContext to use for error information
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    float[] vb,
                                                                                    float w,
                                                                                    float h,
                                                                                    BridgeContext ctx)
        Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        vb - the viewBox definition as float
        w - the width of the effective viewport
        h - The height of the effective viewport
        ctx - The BridgeContext to use for error information
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    float[] vb,
                                                                                    float w,
                                                                                    float h,
                                                                                    org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio aPAR,
                                                                                    BridgeContext ctx)
        Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        vb - the viewBox definition as float
        w - the width of the effective viewport
        h - The height of the effective viewport
        aPAR - The animated preserveAspectRatio value
        ctx - The BridgeContext to use for error information
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(org.w3c.dom.Element e,
                                                                                    org.w3c.dom.svg.SVGAnimatedRect aViewBox,
                                                                                    org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio aPAR,
                                                                                    float w,
                                                                                    float h,
                                                                                    BridgeContext ctx)
        Returns the transformation matrix to apply to initialize a viewport or null if the specified viewBox disables the rendering of the element.
        Parameters:
        e - the element with a viewbox
        aViewBox - the viewBox definition
        aPAR - the preserveAspectRatio definition
        w - the width of the effective viewport
        h - the height of the effective viewport
        ctx - the BridgeContext to use for error information
      • parseViewBoxAttribute

        public static float[] parseViewBoxAttribute​(org.w3c.dom.Element e,
                                                    java.lang.String value,
                                                    BridgeContext ctx)
        Parses a viewBox attribute.
        Parameters:
        e - the element whose viewBox attribute value is being parsed
        value - the viewBox
        ctx - the BridgeContext to use for error information
        Returns:
        The 4 viewbox components or null.
      • getPreserveAspectRatioTransform

        public static java.awt.geom.AffineTransform getPreserveAspectRatioTransform​(float[] vb,
                                                                                    short align,
                                                                                    boolean meet,
                                                                                    float w,
                                                                                    float h)
        Returns the preserveAspectRatio transform according to the specified parameters.
        Parameters:
        vb - the viewBox definition
        align - the alignment definition
        meet - true means 'meet', false means 'slice'
        w - the width of the region in which the document has to fit into
        h - the height of the region in which the document has to fit into