1 17 18 19 20 package org.apache.fop.util; 21 22 25 public final class UnitConv { 26 27 28 public static final float IN2MM = 25.4f; 29 30 31 public static final float IN2CM = 2.54f; 32 33 34 public static final int IN2PT = 72; 35 36 41 public static double mm2pt(double mm) { 42 return mm * IN2PT / IN2MM; 43 } 44 45 50 public static double mm2mpt(double mm) { 51 return mm * 1000 * IN2PT / IN2MM; 52 } 53 54 59 public static double pt2mm(double pt) { 60 return pt * IN2MM / IN2PT; 61 } 62 63 68 public static double mm2in(double mm) { 69 return mm / IN2MM; 70 } 71 72 77 public static double in2mm(double in) { 78 return in * IN2MM; 79 } 80 81 86 public static double in2mpt(double in) { 87 return in * IN2PT * 1000; 88 } 89 90 95 public static double mpt2in(double mpt) { 96 return mpt / IN2PT / 1000; 97 } 98 99 105 public static double mm2px(double mm, int resolution) { 106 return mm2in(mm) * resolution; 107 } 108 109 115 public static double mpt2px(double mpt, int resolution) { 116 return mpt2in(mpt) * resolution; 117 } 118 119 } 120 | Popular Tags |