public abstract class UnitProcessor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
UnitProcessor.Context
Holds the informations needed to compute the units.
|
static class |
UnitProcessor.UnitResolver
A LengthHandler that convert units.
|
| Modifier and Type | Field and Description |
|---|---|
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.
|
| Modifier | Constructor and Description |
|---|---|
protected |
UnitProcessor()
No instance of this class is required.
|
| Modifier and Type | Method and Description |
|---|---|
protected static float |
emsToPixels(float v,
short d,
UnitProcessor.Context ctx)
Converts ems units to user units.
|
protected static float |
exsToPixels(float v,
short d,
UnitProcessor.Context ctx)
Converts exs units to user units.
|
protected static float |
percentagesToPixels(float v,
short d,
UnitProcessor.Context ctx)
Converts percentages to user units.
|
protected static float |
pixelsToEms(float v,
short d,
UnitProcessor.Context ctx)
Converts user units to ems units.
|
protected static float |
pixelsToExs(float v,
short d,
UnitProcessor.Context ctx)
Converts user units to exs units.
|
protected static float |
pixelsToPercentages(float v,
short d,
UnitProcessor.Context ctx)
Converts user units to percentages relative to the viewport.
|
static float |
svgToObjectBoundingBox(float value,
short type,
short d,
UnitProcessor.Context ctx)
Returns the specified value with the specified direction in
objectBoundingBox units.
|
static float |
svgToObjectBoundingBox(java.lang.String s,
java.lang.String attr,
short d,
UnitProcessor.Context ctx)
Returns the specified value with the specified direction in
objectBoundingBox units.
|
static float |
svgToUserSpace(float v,
short type,
short d,
UnitProcessor.Context ctx)
Converts the specified value of the specified type and
direction to user units.
|
static float |
svgToUserSpace(java.lang.String s,
java.lang.String attr,
short d,
UnitProcessor.Context ctx)
Returns the specified coordinate with the specified direction
in user units.
|
static float |
userSpaceToSVG(float v,
short type,
short d,
UnitProcessor.Context ctx)
Converts the specified value of the specified type and
direction to SVG units.
|
public static final short HORIZONTAL_LENGTH
public static final short VERTICAL_LENGTH
public static final short OTHER_LENGTH
public static float svgToObjectBoundingBox(java.lang.String s,
java.lang.String attr,
short d,
UnitProcessor.Context ctx)
throws ParseException
s - the valueattr - the attribute name that represents the valued - the direction of the valuectx - the context used to resolve relative valueParseExceptionpublic static float svgToObjectBoundingBox(float value,
short type,
short d,
UnitProcessor.Context ctx)
value - the valuetype - the type of the valued - the direction of the valuectx - the context used to resolve relative valuepublic static float svgToUserSpace(java.lang.String s,
java.lang.String attr,
short d,
UnitProcessor.Context ctx)
throws ParseException
s - the 'other' coordinateattr - the attribute name that represents the lengthd - the direction of the coordinatectx - the context used to resolve relative valueParseExceptionpublic static float svgToUserSpace(float v,
short type,
short d,
UnitProcessor.Context ctx)
v - the value to converttype - the type of the valued - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the context used to resolve relative valuepublic static float userSpaceToSVG(float v,
short type,
short d,
UnitProcessor.Context ctx)
v - the value to converttype - the type of the valued - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the context used to resolve relative valueprotected static float percentagesToPixels(float v,
short d,
UnitProcessor.Context ctx)
v - the percentage to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextprotected static float pixelsToPercentages(float v,
short d,
UnitProcessor.Context ctx)
v - the value to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextprotected static float pixelsToEms(float v,
short d,
UnitProcessor.Context ctx)
v - the value to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextprotected static float emsToPixels(float v,
short d,
UnitProcessor.Context ctx)
v - the value to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextprotected static float pixelsToExs(float v,
short d,
UnitProcessor.Context ctx)
v - the value to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextprotected static float exsToPixels(float v,
short d,
UnitProcessor.Context ctx)
v - the value to convertd - HORIZONTAL_LENGTH, VERTICAL_LENGTH, or OTHER_LENGTHctx - the contextCopyright © 2022 Apache Software Foundation. All Rights Reserved.