public enum PaperUnit extends Enum<PaperUnit> implements Serializable
| Enum Constant and Description |
|---|
CENTIMETER
Unit representing centimeter.
|
INCH
Unit representing inch.
|
METER
Unit representing meter.
|
MILLIMETER
Unit representing millimeter.
|
PICA
Unit representing pica.
|
PIXEL
Unit representing pixel.
|
POINT
Unit representing point.
|
TWIP
Unit representing twip.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DPI
The default DPI (Dots Per Inch).
|
| Modifier and Type | Method and Description |
|---|---|
static double |
calculateConversionFactor(PaperUnit fromUnit,
PaperUnit toUnit,
Integer dotsPerInch)
Returns the conversion factor used toUnit convert something in the specified fromUnit PaperUnit toUnit the specified toUnit PaperUnit.
|
static double |
convert(double length,
PaperUnit fromUnit,
PaperUnit toUnit,
Integer dotsPerInch)
Returns the conversion of the specified length in the specified PaperUnit to the specified PaperUnit.
|
double |
getPointsPerUnit()
Returns the number of points per unit of this measurement.
|
static PaperUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PaperUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PaperUnit INCH
public static final PaperUnit POINT
public static final PaperUnit PICA
public static final PaperUnit TWIP
public static final PaperUnit MILLIMETER
public static final PaperUnit CENTIMETER
public static final PaperUnit PIXEL
public static final PaperUnit METER
public static final int DEFAULT_DPI
public static PaperUnit[] values()
for (PaperUnit c : PaperUnit.values()) System.out.println(c);
public static PaperUnit valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic double getPointsPerUnit()
public static double convert(double length,
PaperUnit fromUnit,
PaperUnit toUnit,
Integer dotsPerInch)
length - The length to convert.fromUnit - The units of the length to convert.toUnit - The unit to convert the length to.dotsPerInch - The dots per inch. It's required only when PaperUnit.PIXEL is involved.public static double calculateConversionFactor(PaperUnit fromUnit, PaperUnit toUnit, Integer dotsPerInch)
fromUnit - The PaperUnit toUnit convert fromUnit.toUnit - The PaperUnit toUnit convert toUnit.dotsPerInch - The dots per inch. It's required only when PaperUnit.PIXEL is involved.