Class LengthUtil

java.lang.Object
net.sf.jasperreports.engine.export.LengthUtil

public final class LengthUtil extends Object
Author:
Teodor Danciu (teodord@users.sourceforge.net)
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    emu(float pixels, int dpi)
    Convert an int value from pixels to EMU
    static int
    halfPoint(float pixels, int dpi)
     
    static double
    inch(double pixels, int dpi)
    Converts pixels to inches without decimal truncation.
    static double
    inchFloor2Dec(double pixels, int dpi)
     
    static double
    inchFloor4Dec(double pixels, int dpi)
     
    static double
    inchRound2Dec(double pixels, int dpi)
     
    static double
    inchRound4Dec(double pixels, int dpi)
     
    static int
    pixel(float points, int dpi)
    Converts points back to pixels, the inverse of point(float, int).
    static float
    point(float pixels, int dpi)
    Converts pixels to points, for output formats that only offer a fixed set of line thicknesses and thus need the value expressed in physical units.
    static int
    twip(float pixels, int dpi)
    Convert a float value to twips

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • inch

      public static double inch(double pixels, int dpi)
      Converts pixels to inches without decimal truncation.
    • inchFloor2Dec

      public static double inchFloor2Dec(double pixels, int dpi)
    • inchFloor4Dec

      public static double inchFloor4Dec(double pixels, int dpi)
    • inchRound2Dec

      public static double inchRound2Dec(double pixels, int dpi)
    • inchRound4Dec

      public static double inchRound4Dec(double pixels, int dpi)
    • twip

      public static int twip(float pixels, int dpi)
      Convert a float value to twips
      Parameters:
      pixels - value that need to be converted
      Returns:
      converted value in twips
    • emu

      public static int emu(float pixels, int dpi)
      Convert an int value from pixels to EMU
      Parameters:
      pixels - value that needs to be converted
      Returns:
      converted value in EMU
    • halfPoint

      public static int halfPoint(float pixels, int dpi)
    • point

      public static float point(float pixels, int dpi)
      Converts pixels to points, for output formats that only offer a fixed set of line thicknesses and thus need the value expressed in physical units.
      Parameters:
      pixels - value that needs to be converted
      Returns:
      converted value in points
    • pixel

      public static int pixel(float points, int dpi)
      Converts points back to pixels, the inverse of point(float, int).
      Parameters:
      points - value that needs to be converted
      Returns:
      converted value in pixels