Example usage for com.itextpdf.text Utilities pointsToInches

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

Introduction

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

Prototype

public static final float pointsToInches(final float value) 

Source Link

Document

Measurement conversion from points to inches.

Usage

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

License:Open Source License

/**
 * Converts a pixel size to the given unit
 * /*from   ww  w . j a  v a  2  s  .  c o  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;
}