|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.batik.bridge.SVGUtilities
A collection of utility methods for SVG.
| Field Summary | |
static short |
OBJECT_BOUNDING_BOX
The objectBoundingBox coordinate system constants. |
static short |
STROKE_WIDTH
The strokeWidth coordinate system constants. |
static short |
USER_SPACE_ON_USE
The userSpaceOnUse coordinate system constants. |
| Fields inherited from interface org.apache.batik.bridge.ErrorConstants |
ERR_ATTRIBUTE_MISSING, ERR_ATTRIBUTE_VALUE_MALFORMED, ERR_CSS_LENGTH_NEGATIVE, ERR_CSS_URI_BAD_TARGET, ERR_LENGTH_NEGATIVE, ERR_URI_BAD_TARGET, ERR_URI_IMAGE_INVALID, ERR_URI_IO, ERR_URI_MALFORMED, ERR_URI_REFERENCE_A_DOCUMENT, ERR_URI_UNSECURE, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, MSG_BROKEN_LINK_TITLE |
| Constructor Summary | |
protected |
SVGUtilities()
No instance of this class is required. |
| Method Summary | |
static void |
bridgeChildren(BridgeContext ctx,
Element elt)
Scans the children of the input e element and invokes any registered bridge found for the children. |
static java.awt.geom.Rectangle2D |
convertFilterChainRegion(Element filterElement,
Element filteredElement,
GraphicsNode filteredNode,
BridgeContext ctx)
Returns the filter region according to the x, y, width, height, and filterUnits attributes. |
static java.awt.geom.Rectangle2D |
convertFilterPrimitiveRegion(Element filterPrimitiveElement,
Element filteredElement,
GraphicsNode filteredNode,
java.awt.geom.Rectangle2D defaultRegion,
java.awt.geom.Rectangle2D filterRegion,
BridgeContext ctx)
Returns the filter primitive region according to the x, y, width, height, and filterUnits attributes. |
static float[] |
convertFilterRes(Element filterElement,
BridgeContext ctx)
Returns an array of 2 float numbers that describes the filter resolution of the specified filter element. |
static float |
convertLength(java.lang.String length,
java.lang.String attr,
short unitsType,
UnitProcessor.Context uctx)
Returns a float in user units according to the specified parameters. |
static java.awt.geom.Rectangle2D |
convertMaskRegion(Element maskElement,
Element maskedElement,
GraphicsNode maskedNode,
BridgeContext ctx)
Returns the mask region according to the x, y, width, height, and maskUnits attributes. |
static java.awt.geom.Rectangle2D |
convertPatternRegion(Element patternElement,
Element paintedElement,
GraphicsNode paintedNode,
BridgeContext ctx)
Returns the pattern region according to the x, y, width, height, and patternUnits attributes. |
static java.awt.geom.Point2D |
convertPoint(java.lang.String xStr,
java.lang.String xAttr,
java.lang.String yStr,
java.lang.String yAttr,
short unitsType,
UnitProcessor.Context uctx)
Returns a Point2D in user units according to the specified parameters. |
static float |
convertRatio(java.lang.String v)
Converts the specified ratio to float number. |
protected static java.awt.geom.Rectangle2D |
convertRegion(java.lang.String xStr,
java.lang.String yStr,
java.lang.String wStr,
java.lang.String hStr,
short unitsType,
GraphicsNode targetNode,
UnitProcessor.Context uctx)
Returns a rectangle that represents the region defined by the specified coordinates. |
static int |
convertSVGInteger(java.lang.String s)
Converts a string into an integer. |
static float |
convertSVGNumber(java.lang.String s)
Converts a string into a float. |
static float[] |
convertSVGNumberList(SVGNumberList l)
Converts an SVGNumberList into a float array. |
static java.awt.geom.AffineTransform |
convertTransform(Element e,
java.lang.String attr,
java.lang.String transform)
Returns an AffineTransform according to the specified parameters. |
static java.lang.String |
getChainableAttributeNS(Element element,
java.lang.String namespaceURI,
java.lang.String attrName,
BridgeContext ctx)
Returns the value of the specified attribute specified on the specified element or one of its ancestor. |
static java.lang.String |
getDescription(SVGElement elt)
Returns the content of the 'desc' child of the given element. |
static Node |
getImportedChild(Node n)
Returns the node imported by the given node, or null. |
static Element |
getParentElement(Element elt)
Returns the logical parent element of the given element. |
static boolean |
matchUserAgent(Element elt,
UserAgent ua)
Tests whether or not the given element match a specified user agent. |
protected static boolean |
matchUserLanguage(java.lang.String s,
java.lang.String userLanguages)
Tests whether or not the specified language specification matches the user preferences. |
static short |
parseCoordinateSystem(Element e,
java.lang.String attr,
java.lang.String coordinateSystem)
Parses the specified coordinate system defined by the specified element. |
static short |
parseMarkerCoordinateSystem(Element e,
java.lang.String attr,
java.lang.String coordinateSystem)
Parses the specified coordinate system defined by the specified marker element. |
static java.awt.geom.AffineTransform |
toObjectBBox(java.awt.geom.AffineTransform Tx,
GraphicsNode node)
Returns an AffineTransform to move to the objectBoundingBox coordinate system. |
static java.awt.geom.Rectangle2D |
toObjectBBox(java.awt.geom.Rectangle2D r,
GraphicsNode node)
Returns the specified a Rectangle2D move to the objectBoundingBox coordinate system of the specified graphics node. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final short USER_SPACE_ON_USE
public static final short OBJECT_BOUNDING_BOX
public static final short STROKE_WIDTH
| Constructor Detail |
protected SVGUtilities()
| Method Detail |
public static Node getImportedChild(Node n)
public static Element getParentElement(Element elt)
public static float[] convertSVGNumberList(SVGNumberList l)
l - the list to convertpublic static float convertSVGNumber(java.lang.String s)
s - the float representation to convertpublic static int convertSVGInteger(java.lang.String s)
s - the integer representation to convertpublic static float convertRatio(java.lang.String v)
v - the ratio value to convertjava.lang.NumberFormatException - if the ratio is not a valid
number or percentagepublic static java.lang.String getDescription(SVGElement elt)
public static boolean matchUserAgent(Element elt,
UserAgent ua)
elt - the element to checkua - the user agent
protected static boolean matchUserLanguage(java.lang.String s,
java.lang.String userLanguages)
s - the langage to checkuserLanguages - the user langages
public static java.lang.String getChainableAttributeNS(Element element,
java.lang.String namespaceURI,
java.lang.String attrName,
BridgeContext ctx)
element - the element to start withnamespaceURI - the namespace URI of the attribute to returnattrName - the name of the attribute to searchctx - the bridge context
public static java.awt.geom.Point2D convertPoint(java.lang.String xStr,
java.lang.String xAttr,
java.lang.String yStr,
java.lang.String yAttr,
short unitsType,
UnitProcessor.Context uctx)
xStr - the x coordinatexAttr - the name of the attribute that represents the x coordinateyStr - the y coordinateyAttr - the name of the attribute that represents the y coordinateunitsType - the coordinate system (OBJECT_BOUNDING_BOX |
USER_SPACE_ON_USE)uctx - the unit processor context
public static float convertLength(java.lang.String length,
java.lang.String attr,
short unitsType,
UnitProcessor.Context uctx)
length - the lengthattr - the name of the attribute that represents the lengthunitsType - the coordinate system (OBJECT_BOUNDING_BOX |
USER_SPACE_ON_USE)uctx - the unit processor context
public static java.awt.geom.Rectangle2D convertMaskRegion(Element maskElement,
Element maskedElement,
GraphicsNode maskedNode,
BridgeContext ctx)
maskElement - the mask element that defines the various attributesmaskedElement - the element referencing the maskmaskedNode - the graphics node to mask (objectBoundingBox)ctx - the bridge context
public static java.awt.geom.Rectangle2D convertPatternRegion(Element patternElement,
Element paintedElement,
GraphicsNode paintedNode,
BridgeContext ctx)
patternElement - the pattern element that defines the attributespaintedElement - the element referencing the patternpaintedNode - the graphics node to paint (objectBoundingBox)ctx - the bridge context
public static float[] convertFilterRes(Element filterElement,
BridgeContext ctx)
filterElement - the filter elementctx - the bridge context
public static java.awt.geom.Rectangle2D convertFilterChainRegion(Element filterElement,
Element filteredElement,
GraphicsNode filteredNode,
BridgeContext ctx)
filterElement - the filter element that defines the attributesfilteredElement - the element referencing the filterfilteredNode - the graphics node to filter (objectBoundingBox)uctx - the unit processor context (userSpaceOnUse)ctx - the bridge context
public static java.awt.geom.Rectangle2D convertFilterPrimitiveRegion(Element filterPrimitiveElement,
Element filteredElement,
GraphicsNode filteredNode,
java.awt.geom.Rectangle2D defaultRegion,
java.awt.geom.Rectangle2D filterRegion,
BridgeContext ctx)
filterPrimitiveElement - the filter primitive elementfilteredElement - the element referencing the filterfilteredNode - the graphics node to use (objectBoundingBox)defaultRegion - the default region to filterfilterRegion - the filter chain regionctx - the bridge context
public static short parseCoordinateSystem(Element e,
java.lang.String attr,
java.lang.String coordinateSystem)
e - the element that defines the coordinate systemattr - the attribute which contains the coordinate systemcoordinateSystem - the coordinate system to parse
public static short parseMarkerCoordinateSystem(Element e,
java.lang.String attr,
java.lang.String coordinateSystem)
e - the element that defines the coordinate systemattr - the attribute which contains the coordinate systemcoordinateSystem - the coordinate system to parse
protected static java.awt.geom.Rectangle2D convertRegion(java.lang.String xStr,
java.lang.String yStr,
java.lang.String wStr,
java.lang.String hStr,
short unitsType,
GraphicsNode targetNode,
UnitProcessor.Context uctx)
xStr - the x coordinate of the regionyStr - the y coordinate of the regionwStr - the width of the regionhStr - the height of the regiontargetNode - the graphics node (needed for objectBoundingBox)uctx - the unit processor context (needed for userSpaceOnUse)rc - the graphics node render context
public static java.awt.geom.AffineTransform convertTransform(Element e,
java.lang.String attr,
java.lang.String transform)
e - the element that defines the transformattr - the name of the attribute that represents the transformtransform - the transform to parse
public static java.awt.geom.AffineTransform toObjectBBox(java.awt.geom.AffineTransform Tx,
GraphicsNode node)
Tx - the original transformationnode - the graphics node that defines the coordinate
system to move intorc - the graphics node render context
public static java.awt.geom.Rectangle2D toObjectBBox(java.awt.geom.Rectangle2D r,
GraphicsNode node)
r - the original Rectangle2Dnode - the graphics node that defines the coordinate
system to move intorc - the graphics node render context
public static void bridgeChildren(BridgeContext ctx,
Element elt)
ctx - active BridgeContexte - element to be scanned
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||