Example usage for com.itextpdf.text Utilities pointsToMillimeters

List of usage examples for com.itextpdf.text Utilities pointsToMillimeters

Introduction

In this page you can find the example usage for com.itextpdf.text Utilities pointsToMillimeters.

Prototype

public static final float pointsToMillimeters(final float value) 

Source Link

Document

Measurement conversion from points to millimeters.

Usage

From source file:net.sf.mzmine.util.DimensionUnitUtil.java

License:Open Source License

/**
 * Converts a pixel size to the given unit
 * /*from  w w  w  .ja v a2  s.co m*/
 * @param val
 * @param unit
 * @return Float.NaN if the no conversion was defined for this unit
 */
public static float getSizeInUnit(float value, DimUnit unit) {
    switch (unit) {
    case CM:
        return Utilities.pointsToMillimeters(value / 10.f);
    case MM:
        return Utilities.pointsToMillimeters(value);
    case INCH:
        return Utilities.pointsToInches(value);
    case PX:
    case PT:
        return value;
    }
    return Float.NaN;
}