Package org.docx4j
Class UnitsOfMeasurement
java.lang.Object
org.docx4j.UnitsOfMeasurement
- Author:
- jharrop, azerolo
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 StringrgbTripleToHex(float red, float green, float blue) static StringtoHexColor(int color) static 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)
-
Field Details
-
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
1440 twip = 1 inch;Try to guess whether inches or mm looks nicer- Parameters:
left-- Returns:
-
rgbTripleToHex
-
toHexColor
- Since:
- 3.0.0
-
combineColors
public static int combineColors(int fgColor, int bgColor, int pctFg) - Since:
- 3.0.0
-