Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| xmlgraphics-commons 2.0.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xmlgraphics.util
Class UnitConv

    java.lang.Object
      org.apache.xmlgraphics.util.UnitConv

    public final class UnitConv

extends Object

Utility class for unit conversions.

Field Summary
`static String` | `CM` Describes the unit centimeter.
`static float` | `IN2CM` conversion factory from centimeters to inches.
`static float` | `IN2MM` conversion factory from millimeters to inches.
`static int` | `IN2PT` conversion factory from inches to points.
`static String` | `INCH` Describes the unit inch.
`static String` | `MM` Describes the unit millimeter.
`static String` | `MPT` Describes the unit millipoint.
`static String` | `PICA` Describes the unit pica.
`static String` | `POINT` Describes the unit point.
`static String` | `PX` Describes the unit pixel.

Method Summary
`static int` | `convert(String value)` Convert the given unit length to a dimensionless integer representing a whole number of base units (milli-points).
`static double` | `in2mm(double in)` Converts inches (in) to millimeters (mm)
`static double` | `in2mpt(double in)` Converts inches (in) to millipoints (mpt)
`static double` | `in2pt(double in)` Converts inches (in) to points (pt)
`static double` | `mm2in(double mm)` Converts millimeters (mm) to inches (in)
`static double` | `mm2mpt(double mm)` Converts millimeters (mm) to millipoints (mpt)
`static double` | `mm2pt(double mm)` Converts millimeters (mm) to points (pt)
`static double` | `mm2px(double mm, int resolution)` Converts millimeters (mm) to pixels (px)
`static double` | `mpt2in(double mpt)` Converts millipoints (mpt) to inches (in)
`static double` | `mpt2px(double mpt, int resolution)` Converts millipoints (mpt) to pixels (px)
`static AffineTransform` | `mptToPt(AffineTransform at)` Converts a millipoint-based transformation matrix to points.
`static double` | `pt2mm(double pt)` Converts points (pt) to millimeters (mm)
`static AffineTransform` | `ptToMpt(AffineTransform at)` Converts a point-based transformation matrix to millipoints.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### IN2MM

    public static final float IN2MM

  conversion factory from millimeters to inches.

  See Also:
    Constant Field Values

### IN2CM

    public static final float IN2CM

  conversion factory from centimeters to inches.

  See Also:
    Constant Field Values

### IN2PT

    public static final int IN2PT

  conversion factory from inches to points.

  See Also:
    Constant Field Values

### PICA

    public static final String PICA

  Describes the unit pica.

  See Also:
    Constant Field Values

### POINT

    public static final String POINT

  Describes the unit point.

  See Also:
    Constant Field Values

### MM

    public static final String MM

  Describes the unit millimeter.

  See Also:
    Constant Field Values

### CM

    public static final String CM

  Describes the unit centimeter.

  See Also:
    Constant Field Values

### INCH

    public static final String INCH

  Describes the unit inch.

  See Also:
    Constant Field Values

### MPT

    public static final String MPT

  Describes the unit millipoint.

  See Also:
    Constant Field Values

### PX

    public static final String PX

  Describes the unit pixel.

  See Also:
    Constant Field Values

Method Detail

### mm2pt

    public static double mm2pt(double mm)

  Converts millimeters (mm) to points (pt)

  Parameters:
    `mm` - the value in mm
  Returns:
    the value in pt

### mm2mpt

    public static double mm2mpt(double mm)

  Converts millimeters (mm) to millipoints (mpt)

  Parameters:
    `mm` - the value in mm
  Returns:
    the value in mpt

### pt2mm

    public static double pt2mm(double pt)

  Converts points (pt) to millimeters (mm)

  Parameters:
    `pt` - the value in pt
  Returns:
    the value in mm

### mm2in

    public static double mm2in(double mm)

  Converts millimeters (mm) to inches (in)

  Parameters:
    `mm` - the value in mm
  Returns:
    the value in inches

### in2mm

    public static double in2mm(double in)

  Converts inches (in) to millimeters (mm)

  Parameters:
    `in` - the value in inches
  Returns:
    the value in mm

### in2mpt

    public static double in2mpt(double in)

  Converts inches (in) to millipoints (mpt)

  Parameters:
    `in` - the value in inches
  Returns:
    the value in mpt

### in2pt

    public static double in2pt(double in)

  Converts inches (in) to points (pt)

  Parameters:
    `in` - the value in inches
  Returns:
    the value in pt

### mpt2in

    public static double mpt2in(double mpt)

  Converts millipoints (mpt) to inches (in)

  Parameters:
    `mpt` - the value in mpt
  Returns:
    the value in inches

### mm2px

    public static double mm2px(double mm,
                               int resolution)

  Converts millimeters (mm) to pixels (px)

  Parameters:
    `mm` - the value in mm
    `resolution` - the resolution in dpi (dots per inch)
  Returns:
    the value in pixels

### mpt2px

    public static double mpt2px(double mpt,
                                int resolution)

  Converts millipoints (mpt) to pixels (px)

  Parameters:
    `mpt` - the value in mpt
    `resolution` - the resolution in dpi (dots per inch)
  Returns:
    the value in pixels

### mptToPt

    public static AffineTransform mptToPt(AffineTransform at)

  Converts a millipoint-based transformation matrix to points.

  Parameters:
    `at` - a millipoint-based transformation matrix
  Returns:
    a point-based transformation matrix

### ptToMpt

    public static AffineTransform ptToMpt(AffineTransform at)

  Converts a point-based transformation matrix to millipoints.

  Parameters:
    `at` - a point-based transformation matrix
  Returns:
    a millipoint-based transformation matrix

### convert

    public static int convert(String value)

  Convert the given unit length to a dimensionless integer representing a whole number of base units (milli-points).

  Parameters:
    `value` - input unit value
  Returns:
    int millipoints

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| xmlgraphics-commons 2.0.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1999-2015 The Apache Software Foundation. All Rights Reserved.