|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.batik.util.UnitProcessor
This class contains utility methods for processing the SVG and CSS units.
Inner Class Summary | |
static interface |
UnitProcessor.Context
Holds the informations needed to compute the units. |
static class |
UnitProcessor.UnitResolver
A simple class that can convert units. |
Field Summary | |
static short |
HORIZONTAL_LENGTH
This constant represents horizontal lengths. |
static short |
OTHER_LENGTH
This constant represents other lengths. |
static short |
VERTICAL_LENGTH
This constant represents vertical lengths. |
Constructor Summary | |
protected |
UnitProcessor()
This class does not need to be instantiated. |
Method Summary | |
static float |
cssToUserSpace(short t,
float v,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts a SVG length value to screen pixels. |
protected static float |
emsToPixels(float v,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts ems units to pixels units. |
protected static float |
exsToPixels(float v,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts exs units to pixels units. |
static CSSPrimitiveValue |
getFontSize(SVGElement e,
CSSStyleDeclaration d)
An utility method to implement Context.getFontSize(SVGElement e). |
protected static float |
percentagesToPixels(float v,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts percentages units to pixels units. |
static float |
svgToUserSpace(short t,
float v,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts a SVG length value to screen pixels. |
static float |
svgToUserSpace(java.lang.String value,
SVGElement e,
short d,
UnitProcessor.Context c)
Converts a SVG length value to screen pixels. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short HORIZONTAL_LENGTH
public static final short VERTICAL_LENGTH
public static final short OTHER_LENGTH
Constructor Detail |
protected UnitProcessor()
Method Detail |
public static float cssToUserSpace(short t, float v, SVGElement e, short d, UnitProcessor.Context c) throws java.lang.RuntimeException
t
- the unit type like specified in the CSSPrimitiveType interface.v
- the length value.e
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.public static float svgToUserSpace(short t, float v, SVGElement e, short d, UnitProcessor.Context c) throws java.lang.RuntimeException
t
- the unit type like specified in the SVGLength interface.v
- the length value.e
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.protected static float emsToPixels(float v, SVGElement e, short d, UnitProcessor.Context c)
v
- the length value.e
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.protected static float exsToPixels(float v, SVGElement e, short d, UnitProcessor.Context c)
v
- the length value.e
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.protected static float percentagesToPixels(float v, SVGElement e, short d, UnitProcessor.Context c)
v
- the length value.e
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.public static CSSPrimitiveValue getFontSize(SVGElement e, CSSStyleDeclaration d)
public static float svgToUserSpace(java.lang.String value, SVGElement e, short d, UnitProcessor.Context c)
value
- the length valuee
- the element.d
- HORIZONTAL_LENGTH, VERTICAL_LENGTH or OTHER_LENGTH.c
- The context.java.lang.RuntimeException
- If an invalid unit type is specified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |