You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnitConv.java 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.util;
  19. import java.awt.geom.AffineTransform;
  20. /**
  21. * Utility class for unit conversions.
  22. * @deprecated use org.apache.xmlgraphics.util.UnitConv instead.
  23. */
  24. public final class UnitConv {
  25. private UnitConv() {
  26. }
  27. /**
  28. * conversion factory from millimeters to inches.
  29. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2MM instead.
  30. */
  31. public static final float IN2MM = org.apache.xmlgraphics.util.UnitConv.IN2MM;
  32. /**
  33. * conversion factory from centimeters to inches.
  34. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2CM instead.
  35. */
  36. public static final float IN2CM = org.apache.xmlgraphics.util.UnitConv.IN2CM;
  37. /**
  38. * conversion factory from inches to points.
  39. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2PT instead.
  40. */
  41. public static final int IN2PT = org.apache.xmlgraphics.util.UnitConv.IN2PT;
  42. /**
  43. * Converts millimeters (mm) to points (pt)
  44. * @param mm the value in mm
  45. * @return the value in pt
  46. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2pt(mm) instead.
  47. */
  48. public static double mm2pt(double mm) {
  49. return org.apache.xmlgraphics.util.UnitConv.mm2pt(mm);
  50. }
  51. /**
  52. * Converts millimeters (mm) to millipoints (mpt)
  53. * @param mm the value in mm
  54. * @return the value in mpt
  55. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2mpt(mm) instead.
  56. */
  57. public static double mm2mpt(double mm) {
  58. return org.apache.xmlgraphics.util.UnitConv.mm2mpt(mm);
  59. }
  60. /**
  61. * Converts points (pt) to millimeters (mm)
  62. * @param pt the value in pt
  63. * @return the value in mm
  64. * @deprecated use org.apache.xmlgraphics.util.UnitConv.pt2mm(pt) instead.
  65. */
  66. public static double pt2mm(double pt) {
  67. return org.apache.xmlgraphics.util.UnitConv.pt2mm(pt);
  68. }
  69. /**
  70. * Converts millimeters (mm) to inches (in)
  71. * @param mm the value in mm
  72. * @return the value in inches
  73. * @deprecated use org.apache.xmlgraphics.util.UnitConv.pt2mm(pt) instead.
  74. */
  75. public static double mm2in(double mm) {
  76. return org.apache.xmlgraphics.util.UnitConv.mm2in(mm);
  77. }
  78. /**
  79. * Converts inches (in) to millimeters (mm)
  80. * @param in the value in inches
  81. * @return the value in mm
  82. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2mm(in) instead.
  83. */
  84. public static double in2mm(double in) {
  85. return org.apache.xmlgraphics.util.UnitConv.in2mm(in);
  86. }
  87. /**
  88. * Converts inches (in) to millipoints (mpt)
  89. * @param in the value in inches
  90. * @return the value in mpt
  91. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2mpt(in) instead.
  92. */
  93. public static double in2mpt(double in) {
  94. return org.apache.xmlgraphics.util.UnitConv.in2mpt(in);
  95. }
  96. /**
  97. * Converts inches (in) to points (pt)
  98. * @param in the value in inches
  99. * @return the value in pt
  100. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2pt(in) instead.
  101. */
  102. public static double in2pt(double in) {
  103. return org.apache.xmlgraphics.util.UnitConv.in2pt(in);
  104. }
  105. /**
  106. * Converts millipoints (mpt) to inches (in)
  107. * @param mpt the value in mpt
  108. * @return the value in inches
  109. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mpt2in(mpt) instead.
  110. */
  111. public static double mpt2in(double mpt) {
  112. return org.apache.xmlgraphics.util.UnitConv.mpt2in(mpt);
  113. }
  114. /**
  115. * Converts millimeters (mm) to pixels (px)
  116. * @param mm the value in mm
  117. * @param resolution the resolution in dpi (dots per inch)
  118. * @return the value in pixels
  119. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2px(mm, resolution) instead.
  120. */
  121. public static double mm2px(double mm, int resolution) {
  122. return org.apache.xmlgraphics.util.UnitConv.mm2px(mm, resolution);
  123. }
  124. /**
  125. * Converts millipoints (mpt) to pixels (px)
  126. * @param mpt the value in mpt
  127. * @param resolution the resolution in dpi (dots per inch)
  128. * @return the value in pixels
  129. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mpt2px(mpt, resolution) instead.
  130. */
  131. public static double mpt2px(double mpt, int resolution) {
  132. return org.apache.xmlgraphics.util.UnitConv.mpt2px(mpt, resolution);
  133. }
  134. /**
  135. * Converts a millipoint-based transformation matrix to points.
  136. * @param at a millipoint-based transformation matrix
  137. * @return a point-based transformation matrix
  138. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mptToPt(at) instead.
  139. */
  140. public static AffineTransform mptToPt(AffineTransform at) {
  141. return org.apache.xmlgraphics.util.UnitConv.mptToPt(at);
  142. }
  143. /**
  144. * Converts a point-based transformation matrix to millipoints.
  145. * @param at a point-based transformation matrix
  146. * @return a millipoint-based transformation matrix
  147. * @deprecated use org.apache.xmlgraphics.util.UnitConv.ptToMpt(at) instead.
  148. */
  149. public static AffineTransform ptToMpt(AffineTransform at) {
  150. return org.apache.xmlgraphics.util.UnitConv.ptToMpt(at);
  151. }
  152. }