Class SVGImageElementBridge

    • Field Detail

      • imgDocument

        protected org.w3c.dom.svg.SVGDocument imgDocument
      • listener

        protected org.w3c.dom.events.EventListener listener
      • hitCheckChildren

        protected boolean hitCheckChildren
    • Constructor Detail

      • SVGImageElementBridge

        public SVGImageElementBridge()
        Constructs a new bridge for the <image> element.
    • Method Detail

      • getLocalName

        public java.lang.String getLocalName()
        Returns 'image'.
      • buildImageGraphicsNode

        protected GraphicsNode buildImageGraphicsNode​(BridgeContext ctx,
                                                      org.w3c.dom.Element e)
        Create a Graphics node according to the resource pointed by the href : RasterImageNode for bitmaps, CompositeGraphicsNode for svg files.
        Parameters:
        ctx - : the bridge context to use
        e - the element that describes the graphics node to build
        Returns:
        the graphic node that represent the resource pointed by the reference
      • checkLoadExternalResource

        private void checkLoadExternalResource​(BridgeContext ctx,
                                               org.w3c.dom.Element e,
                                               ParsedURL purl)
      • isComposite

        public boolean isComposite()
        Returns false as image is not a container.
      • initializeDynamicSupport

        protected void initializeDynamicSupport​(BridgeContext ctx,
                                                org.w3c.dom.Element e,
                                                GraphicsNode node)
        This method is invoked during the build phase if the document is dynamic. The responsability of this method is to ensure that any dynamic modifications of the element this bridge is dedicated to, happen on its associated GVT product.
        Overrides:
        initializeDynamicSupport in class AbstractGraphicsNodeBridge
      • updateImageBounds

        protected void updateImageBounds()
      • rebuildImageNode

        protected void rebuildImageNode()
      • createRasterImageNode

        protected GraphicsNode createRasterImageNode​(BridgeContext ctx,
                                                     org.w3c.dom.Element e,
                                                     Filter img,
                                                     ParsedURL purl)
        Returns a GraphicsNode that represents an raster image in JPEG or PNG format.
        Parameters:
        ctx - the bridge context
        e - the image element
        img - the image to use in creating the graphics node
      • createSVGImageNode

        protected GraphicsNode createSVGImageNode​(BridgeContext ctx,
                                                  org.w3c.dom.Element e,
                                                  org.w3c.dom.svg.SVGDocument imgDocument)
        Returns a GraphicsNode that represents a svg document as an image.
        Parameters:
        ctx - the bridge context
        e - the image element
        imgDocument - the SVG document that represents the image
      • initializeViewport

        protected static void initializeViewport​(BridgeContext ctx,
                                                 org.w3c.dom.Element e,
                                                 GraphicsNode node,
                                                 float[] vb,
                                                 java.awt.geom.Rectangle2D bounds)
        Initializes according to the specified element, the specified graphics node with the specified bounds. This method takes into account the 'viewBox', 'preserveAspectRatio', and 'clip' properties. According to those properties, a AffineTransform and a clip is set.
        Parameters:
        ctx - the bridge context
        e - the image element that defines the properties
        node - the graphics node
        vb - the implicit viewBox definition
        bounds - the bounds of the image element
      • extractColorSpace

        protected static org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent extractColorSpace​(org.w3c.dom.Element element,
                                                                                                       BridgeContext ctx)
        Analyzes the color-profile property and builds an ICCColorSpaceExt object from it.
        Parameters:
        element - the element with the color-profile property
        ctx - the bridge context
      • getImageBounds

        protected static java.awt.geom.Rectangle2D getImageBounds​(BridgeContext ctx,
                                                                  org.w3c.dom.Element element)
        Returns the bounds of the specified image element.
        Parameters:
        ctx - the bridge context
        element - the image element
      • createBrokenImageNode

        GraphicsNode createBrokenImageNode​(BridgeContext ctx,
                                           org.w3c.dom.Element e,
                                           java.lang.String uri,
                                           java.lang.String message)