org.apache.batik.bridge

Class SVGImageElementBridge

public class SVGImageElementBridge extends AbstractGraphicsNodeBridge

Bridge class for the <image> element.
Nested Class Summary
protected static classSVGImageElementBridge.ForwardEventListener
A simple DOM listener to forward events from the SVG image document to the original document.
static classSVGImageElementBridge.ProtectedStream
Next see if it's an XML document.
Field Summary
protected booleanhitCheckChildren
protected SVGDocumentimgDocument
protected EventListenerlistener
protected BridgeContextsubCtx
Constructor Summary
SVGImageElementBridge()
Constructs a new bridge for the <image> element.
Method Summary
protected GraphicsNodebuildImageGraphicsNode(BridgeContext ctx, Element e)
Create a Graphics node according to the resource pointed by the href : RasterImageNode for bitmaps, CompositeGraphicsNode for svg files.
GraphicsNodecreateGraphicsNode(BridgeContext ctx, Element e)
Creates a graphics node using the specified BridgeContext and for the specified element.
protected GraphicsNodecreateImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl)
protected GraphicsNodecreateRasterImageNode(BridgeContext ctx, Element e, Filter img, ParsedURL purl)
Returns a GraphicsNode that represents an raster image in JPEG or PNG format.
protected GraphicsNodecreateSVGImageNode(BridgeContext ctx, Element e, SVGDocument imgDocument)
Returns a GraphicsNode that represents a svg document as an image.
voiddispose()
protected static ICCColorSpaceExtextractColorSpace(Element element, BridgeContext ctx)
Analyzes the color-profile property and builds an ICCColorSpaceExt object from it.
protected static Rectangle2DgetImageBounds(BridgeContext ctx, Element element)
Returns the bounds of the specified image element.
BridgegetInstance()
Returns a new instance of this bridge.
StringgetLocalName()
Returns 'image'.
voidhandleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animatable attribute has changed.
protected voidhandleCSSPropertyChanged(int property)
Invoked for each CSS property that has changed.
protected voidinitializeDynamicSupport(BridgeContext ctx, Element e, GraphicsNode node)
This method is invoked during the build phase if the document is dynamic.
protected static voidinitializeViewport(BridgeContext ctx, Element e, GraphicsNode node, float[] vb, Rectangle2D bounds)
Initializes according to the specified element, the specified graphics node with the specified bounds.
protected GraphicsNodeinstantiateGraphicsNode()
Creates an ImageNode.
booleanisComposite()
Returns false as image is not a container.
protected SVGImageElementBridge.ProtectedStreamopenStream(Element e, ParsedURL purl)
protected voidrebuildImageNode()
protected voidupdateImageBounds()

Field Detail

hitCheckChildren

protected boolean hitCheckChildren

imgDocument

protected SVGDocument imgDocument

listener

protected EventListener listener

subCtx

protected BridgeContext subCtx

Constructor Detail

SVGImageElementBridge

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

Method Detail

buildImageGraphicsNode

protected GraphicsNode buildImageGraphicsNode(BridgeContext ctx, 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

createGraphicsNode

public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e)
Creates a graphics node using the specified BridgeContext and for the specified element.

Parameters: ctx the bridge context to use e the element that describes the graphics node to build

Returns: a graphics node that represents the specified element

createImageGraphicsNode

protected GraphicsNode createImageGraphicsNode(BridgeContext ctx, Element e, ParsedURL purl)

createRasterImageNode

protected GraphicsNode createRasterImageNode(BridgeContext ctx, 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, Element e, 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

dispose

public void dispose()

extractColorSpace

protected static ICCColorSpaceExt extractColorSpace(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 Rectangle2D getImageBounds(BridgeContext ctx, Element element)
Returns the bounds of the specified image element.

Parameters: ctx the bridge context element the image element

getInstance

public Bridge getInstance()
Returns a new instance of this bridge.

getLocalName

public String getLocalName()
Returns 'image'.

handleAnimatedAttributeChanged

public void handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animatable attribute has changed.

handleCSSPropertyChanged

protected void handleCSSPropertyChanged(int property)
Invoked for each CSS property that has changed.

initializeDynamicSupport

protected void initializeDynamicSupport(BridgeContext ctx, 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.

initializeViewport

protected static void initializeViewport(BridgeContext ctx, Element e, GraphicsNode node, float[] vb, 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

instantiateGraphicsNode

protected GraphicsNode instantiateGraphicsNode()
Creates an ImageNode.

isComposite

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

openStream

protected SVGImageElementBridge.ProtectedStream openStream(Element e, ParsedURL purl)

rebuildImageNode

protected void rebuildImageNode()

updateImageBounds

protected void updateImageBounds()
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.