Class UnitProcessor
java.lang.Object
org.apache.batik.parser.UnitProcessor
org.apache.batik.bridge.UnitProcessor
This class provides methods to convert SVG length and coordinate to
float in user units.
- Version:
- $Id$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class is the default context for a particular element.Nested classes/interfaces inherited from class UnitProcessor
UnitProcessor.Context, UnitProcessor.UnitResolver -
Field Summary
Fields inherited from class UnitProcessor
HORIZONTAL_LENGTH, OTHER_LENGTH, VERTICAL_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UnitProcessor.ContextcreateContext(BridgeContext ctx, Element e) Creates a context for the specified element.protected static BridgeContextReturns theBridgeContextfrom the givenUnitProcessor.Contextif it is aUnitProcessor.DefaultContext, or null otherwise.static floatReturns the specified horizontal coordinate in object bounding box coordinate system.static floatsvgHorizontalCoordinateToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal coordinate in user units.static floatReturns the specified horizontal length in object bounding box coordinate system.static floatsvgHorizontalLengthToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal length in user units.static floatsvgLengthToObjectBoundingBox(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified length with the specified direction in user units.static floatsvgLengthToUserSpace(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified length with the specified direction in user units.static floatReturns the specified 'other' coordinate in object bounding box coordinate system.static floatsvgOtherCoordinateToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified 'other' coordinate in user units.static floatsvgOtherLengthToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified 'other' length in object bounding box coordinate system.static floatsvgOtherLengthToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified 'other' length in user units.static floatsvgToObjectBoundingBox(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified value with the specified direction in objectBoundingBox units.static floatsvgToUserSpace(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified coordinate with the specified direction in user units.static floatReturns the specified vertical coordinate in object bounding box coordinate system.static floatsvgVerticalCoordinateToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified vertical coordinate in user units.static floatReturns the specified vertical length in object bounding box coordinate system.static floatsvgVerticalLengthToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified vertical length in user units.Methods inherited from class UnitProcessor
emsToPixels, exsToPixels, percentagesToPixels, pixelsToEms, pixelsToExs, pixelsToPercentages, svgToObjectBoundingBox, svgToUserSpace, userSpaceToSVG
-
Constructor Details
-
UnitProcessor
public UnitProcessor()
-
-
Method Details
-
createContext
Creates a context for the specified element.- Parameters:
ctx- the bridge context that contains the user agent and viewport definitione- the element interested in its context
-
svgHorizontalCoordinateToObjectBoundingBox
public static float svgHorizontalCoordinateToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal coordinate in object bounding box coordinate system.- Parameters:
s- the horizontal coordinateattr- the attribute name that represents the coordinatectx- the context used to resolve relative value
-
svgVerticalCoordinateToObjectBoundingBox
public static float svgVerticalCoordinateToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified vertical coordinate in object bounding box coordinate system.- Parameters:
s- the vertical coordinateattr- the attribute name that represents the coordinatectx- the context used to resolve relative value
-
svgOtherCoordinateToObjectBoundingBox
public static float svgOtherCoordinateToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified 'other' coordinate in object bounding box coordinate system.- Parameters:
s- the 'other' coordinateattr- the attribute name that represents the coordinatectx- the context used to resolve relative value
-
svgHorizontalLengthToObjectBoundingBox
public static float svgHorizontalLengthToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal length in object bounding box coordinate system. A length must be greater than 0.- Parameters:
s- the 'other' lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgVerticalLengthToObjectBoundingBox
public static float svgVerticalLengthToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified vertical length in object bounding box coordinate system. A length must be greater than 0.- Parameters:
s- the vertical lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgOtherLengthToObjectBoundingBox
public static float svgOtherLengthToObjectBoundingBox(String s, String attr, UnitProcessor.Context ctx) Returns the specified 'other' length in object bounding box coordinate system. A length must be greater than 0.- Parameters:
s- the 'other' lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgLengthToObjectBoundingBox
public static float svgLengthToObjectBoundingBox(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified length with the specified direction in user units. A length must be greater than 0.- Parameters:
s- the lengthattr- the attribute name that represents the lengthd- the direction of the lengthctx- the context used to resolve relative value
-
svgToObjectBoundingBox
public static float svgToObjectBoundingBox(String s, String attr, short d, UnitProcessor.Context ctx) Returns the specified value with the specified direction in objectBoundingBox units.- Parameters:
s- the valueattr- the attribute name that represents the valued- the direction of the valuectx- the context used to resolve relative value
-
svgHorizontalLengthToUserSpace
public static float svgHorizontalLengthToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal length in user units. A length must be greater than 0.- Parameters:
s- the horizontal lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgVerticalLengthToUserSpace
Returns the specified vertical length in user units. A length must be greater than 0.- Parameters:
s- the vertical lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgOtherLengthToUserSpace
Returns the specified 'other' length in user units. A length must be greater than 0.- Parameters:
s- the 'other' lengthattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgHorizontalCoordinateToUserSpace
public static float svgHorizontalCoordinateToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified horizontal coordinate in user units.- Parameters:
s- the horizontal coordinateattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgVerticalCoordinateToUserSpace
public static float svgVerticalCoordinateToUserSpace(String s, String attr, UnitProcessor.Context ctx) Returns the specified vertical coordinate in user units.- Parameters:
s- the vertical coordinateattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgOtherCoordinateToUserSpace
Returns the specified 'other' coordinate in user units.- Parameters:
s- the 'other' coordinateattr- the attribute name that represents the lengthctx- the context used to resolve relative value
-
svgLengthToUserSpace
Returns the specified length with the specified direction in user units. A length must be greater than 0.- Parameters:
s- the 'other' coordinateattr- the attribute name that represents the lengthd- the direction of the lengthctx- the context used to resolve relative value
-
svgToUserSpace
Returns the specified coordinate with the specified direction in user units.- Parameters:
s- the 'other' coordinateattr- the attribute name that represents the lengthd- the direction of the coordinatectx- the context used to resolve relative value
-
getBridgeContext
Returns theBridgeContextfrom the givenUnitProcessor.Contextif it is aUnitProcessor.DefaultContext, or null otherwise.
-