Package org.docx4j
Class UnitsOfMeasurement
java.lang.Object
org.docx4j.UnitsOfMeasurement
public class UnitsOfMeasurement
extends java.lang.Object
- Author:
- jharrop, azerolo
-
Field Summary
-
Constructor Summary
Constructors Constructor Description UnitsOfMeasurement() -
Method Summary
Modifier and Type Method Description static intcombineColors(int fgColor, int bgColor, int pctFg)static intinchToTwip(float inch)static doubleinchToTwipDouble(double inch)Convert an inches value to twips and return as a double.static intmmToTwip(float mm)static intpointToTwip(float point)static intpxToTwip(float px)static doublepxToTwipDouble(double px)Convert a pixel value to twips and return as a double.static java.lang.StringrgbTripleToHex(float red, float green, float blue)static java.lang.StringtoHexColor(int color)static java.lang.StringtwipToBest(int leftL)1440 twip = 1 inch;Try to guess whether inches or mm looks nicerstatic longtwipToEMU(double twips)static floattwipToInch(int twip)static floattwipToMm(int twip)static floattwipToPoint(int twip)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
format2DP
public static final java.text.DecimalFormat format2DP -
DPI
public static final int DPI
-
-
Constructor Details
-
UnitsOfMeasurement
public UnitsOfMeasurement()
-
-
Method Details
-
twipToEMU
public static long twipToEMU(double twips) -
inchToTwip
public static int inchToTwip(float inch) -
twipToInch
public static float twipToInch(int twip) -
twipToMm
public static float twipToMm(int twip)- Since:
- 3.0.0
-
mmToTwip
public static int mmToTwip(float mm) -
twipToPoint
public static float twipToPoint(int twip)- Since:
- 3.0.0
-
pointToTwip
public static int pointToTwip(float point)- Since:
- 3.0.0
-
pxToTwip
public static int pxToTwip(float px)- Since:
- 3.0.0
-
inchToTwipDouble
public static double inchToTwipDouble(double inch)Convert an inches value to twips and return as a double. -
pxToTwipDouble
public static double pxToTwipDouble(double px)Convert a pixel value to twips and return as a double. This may be useful where the returned value will then be converted to another unit, and we don't want to lose precision due to rounding. -
twipToBest
public static java.lang.String twipToBest(int leftL)1440 twip = 1 inch;Try to guess whether inches or mm looks nicer- Parameters:
left-- Returns:
-
rgbTripleToHex
public static java.lang.String rgbTripleToHex(float red, float green, float blue) -
toHexColor
public static java.lang.String toHexColor(int color)- Since:
- 3.0.0
-
combineColors
public static int combineColors(int fgColor, int bgColor, int pctFg)- Since:
- 3.0.0
-