DisplayUnitsConverter

Inheritance: java.lang.Object

public final class DisplayUnitsConverter

The class contains the methods for converting values.

Methods

MethodDescription
pointToPixel(float points, float dpi)Converts points to pixels at the specified pixel resolution.
pixelToPoint(int pixels, float dpi)Converts pixels to points at the specified pixel resolution.
inchToPoint(float inches)Converts inches to points.
pointToInch(float points)Converts points to inches.
millimeterToInch(float mm)Converts millimeters to inches.
millimeterToPoint(float mm)Converts millimeters to points.

pointToPixel(float points, float dpi)

public static int pointToPixel(float points, float dpi)

Converts points to pixels at the specified pixel resolution.

Parameters:

ParameterTypeDescription
pointsfloatThe value to convert in points.
dpifloatScreen resolution.

Returns: int - The int .

pixelToPoint(int pixels, float dpi)

public static float pixelToPoint(int pixels, float dpi)

Converts pixels to points at the specified pixel resolution.

Parameters:

ParameterTypeDescription
pixelsintThe value to convert in pixels.
dpifloatScreen resolution.

Returns: float - The int .

inchToPoint(float inches)

public static float inchToPoint(float inches)

Converts inches to points.

Parameters:

ParameterTypeDescription
inchesfloatThe value to convert in inches.

Returns: float - The float .

pointToInch(float points)

public static float pointToInch(float points)

Converts points to inches.

Parameters:

ParameterTypeDescription
pointsfloatThe value to convert in points.

Returns: float - The float .

millimeterToInch(float mm)

public static float millimeterToInch(float mm)

Converts millimeters to inches.

Parameters:

ParameterTypeDescription
mmfloatThe value to convert in millimeters.

Returns: float - The float .

millimeterToPoint(float mm)

public static float millimeterToPoint(float mm)

Converts millimeters to points.

Parameters:

ParameterTypeDescription
mmfloatThe value to convert in millimeters.

Returns: float - The float .