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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. /**
  26. * conversion factory from millimeters to inches.
  27. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2MM instead.
  28. */
  29. public static final float IN2MM = org.apache.xmlgraphics.util.UnitConv.IN2MM;
  30. /**
  31. * conversion factory from centimeters to inches.
  32. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2CM instead.
  33. */
  34. public static final float IN2CM = org.apache.xmlgraphics.util.UnitConv.IN2CM;
  35. /**
  36. * conversion factory from inches to points.
  37. * @deprecated use org.apache.xmlgraphics.util.UnitConv.IN2PT instead.
  38. */
  39. public static final int IN2PT = org.apache.xmlgraphics.util.UnitConv.IN2PT;
  40. /**
  41. * Converts millimeters (mm) to points (pt)
  42. * @param mm the value in mm
  43. * @return the value in pt
  44. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2pt(mm) instead.
  45. */
  46. public static double mm2pt(double mm) {
  47. return org.apache.xmlgraphics.util.UnitConv.mm2pt(mm);
  48. }
  49. /**
  50. * Converts millimeters (mm) to millipoints (mpt)
  51. * @param mm the value in mm
  52. * @return the value in mpt
  53. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2mpt(mm) instead.
  54. */
  55. public static double mm2mpt(double mm) {
  56. return org.apache.xmlgraphics.util.UnitConv.mm2mpt(mm);
  57. }
  58. /**
  59. * Converts points (pt) to millimeters (mm)
  60. * @param pt the value in pt
  61. * @return the value in mm
  62. * @deprecated use org.apache.xmlgraphics.util.UnitConv.pt2mm(pt) instead.
  63. */
  64. public static double pt2mm(double pt) {
  65. return org.apache.xmlgraphics.util.UnitConv.pt2mm(pt);
  66. }
  67. /**
  68. * Converts millimeters (mm) to inches (in)
  69. * @param mm the value in mm
  70. * @return the value in inches
  71. * @deprecated use org.apache.xmlgraphics.util.UnitConv.pt2mm(pt) instead.
  72. */
  73. public static double mm2in(double mm) {
  74. return org.apache.xmlgraphics.util.UnitConv.mm2in(mm);
  75. }
  76. /**
  77. * Converts inches (in) to millimeters (mm)
  78. * @param in the value in inches
  79. * @return the value in mm
  80. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2mm(in) instead.
  81. */
  82. public static double in2mm(double in) {
  83. return org.apache.xmlgraphics.util.UnitConv.in2mm(in);
  84. }
  85. /**
  86. * Converts inches (in) to millipoints (mpt)
  87. * @param in the value in inches
  88. * @return the value in mpt
  89. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2mpt(in) instead.
  90. */
  91. public static double in2mpt(double in) {
  92. return org.apache.xmlgraphics.util.UnitConv.in2mpt(in);
  93. }
  94. /**
  95. * Converts inches (in) to points (pt)
  96. * @param in the value in inches
  97. * @return the value in pt
  98. * @deprecated use org.apache.xmlgraphics.util.UnitConv.in2pt(in) instead.
  99. */
  100. public static double in2pt(double in) {
  101. return org.apache.xmlgraphics.util.UnitConv.in2pt(in);
  102. }
  103. /**
  104. * Converts millipoints (mpt) to inches (in)
  105. * @param mpt the value in mpt
  106. * @return the value in inches
  107. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mpt2in(mpt) instead.
  108. */
  109. public static double mpt2in(double mpt) {
  110. return org.apache.xmlgraphics.util.UnitConv.mpt2in(mpt);
  111. }
  112. /**
  113. * Converts millimeters (mm) to pixels (px)
  114. * @param mm the value in mm
  115. * @param resolution the resolution in dpi (dots per inch)
  116. * @return the value in pixels
  117. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mm2px(mm, resolution) instead.
  118. */
  119. public static double mm2px(double mm, int resolution) {
  120. return org.apache.xmlgraphics.util.UnitConv.mm2px(mm, resolution);
  121. }
  122. /**
  123. * Converts millipoints (mpt) to pixels (px)
  124. * @param mpt the value in mpt
  125. * @param resolution the resolution in dpi (dots per inch)
  126. * @return the value in pixels
  127. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mpt2px(mpt, resolution) instead.
  128. */
  129. public static double mpt2px(double mpt, int resolution) {
  130. return org.apache.xmlgraphics.util.UnitConv.mpt2px(mpt, resolution);
  131. }
  132. /**
  133. * Converts a millipoint-based transformation matrix to points.
  134. * @param at a millipoint-based transformation matrix
  135. * @return a point-based transformation matrix
  136. * @deprecated use org.apache.xmlgraphics.util.UnitConv.mptToPt(at) instead.
  137. */
  138. public static AffineTransform mptToPt(AffineTransform at) {
  139. return org.apache.xmlgraphics.util.UnitConv.mptToPt(at);
  140. }
  141. /**
  142. * Converts a point-based transformation matrix to millipoints.
  143. * @param at a point-based transformation matrix
  144. * @return a millipoint-based transformation matrix
  145. * @deprecated use org.apache.xmlgraphics.util.UnitConv.ptToMpt(at) instead.
  146. */
  147. public static AffineTransform ptToMpt(AffineTransform at) {
  148. return org.apache.xmlgraphics.util.UnitConv.ptToMpt(at);
  149. }
  150. }