org.apache.batik.bridge

Class ViewBox

public abstract class ViewBox extends Object implements SVGConstants, ErrorConstants

This class provides convenient methods to handle viewport.
Nested Class Summary
protected static classViewBox.ViewHandler
This class can be used to store the value of the attribute viewBox or can also be used to store the various attribute value that can be specified on a SVG URI fragments.
Constructor Summary
protected ViewBox()
No instance of this class is required.
Method Summary
static AffineTransformgetPreserveAspectRatioTransform(Element e, float w, float h)
Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element.
static AffineTransformgetPreserveAspectRatioTransform(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.
static AffineTransformgetPreserveAspectRatioTransform(Element e, String viewBox, 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.
static AffineTransformgetPreserveAspectRatioTransform(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.
static AffineTransformgetPreserveAspectRatioTransform(Element e, float[] vb, float w, float h, 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.
static AffineTransformgetPreserveAspectRatioTransform(float[] vb, short align, boolean meet, float w, float h)
Returns the preserveAspectRatio transform according to the specified parameters.
static AffineTransformgetViewTransform(String ref, Element e, float w, float h, BridgeContext ctx)
Parses the specified reference (from a URI) and returns the appropriate transform.
static float[]parseViewBoxAttribute(Element e, String value, BridgeContext ctx)
Parses a viewBox attribute.

Constructor Detail

ViewBox

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

Method Detail

getPreserveAspectRatioTransform

public static AffineTransform getPreserveAspectRatioTransform(Element e, float w, float h)

Deprecated: Replaced by {@link #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 AffineTransform getPreserveAspectRatioTransform(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 AffineTransform getPreserveAspectRatioTransform(Element e, String viewBox, 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 AffineTransform getPreserveAspectRatioTransform(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 AffineTransform getPreserveAspectRatioTransform(Element e, float[] vb, float w, float h, 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 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

getViewTransform

public static AffineTransform getViewTransform(String ref, 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

parseViewBoxAttribute

public static float[] parseViewBoxAttribute(Element e, 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.

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.