Class UnitConverter
Converts between common measurement units used by LM-Kit: pixels, device-independent pixels (DIP), points, inches, millimeters, and centimeters.
public static class UnitConverter
- Inheritance
-
UnitConverter
- Inherited Members
Remarks
Conversions involving pixels depend on the effective DPI of the render target. LM-Kit normalizes layout to a 96 DPI “view space”, so 1 DIP equals 1 pixel at 96 DPI.
Definitions: 1 in = 72 pt = 96 DIP = 25.4 mm = 2.54 cm.
Fields
- CentimetersPerInch
Centimeters per inch.
- DipPerInch
Device-independent pixels (DIP) per inch.
- MillimetersPerInch
Millimeters per inch.
- PointsPerInch
Points per inch.
Methods
- Convert(double, UnitMode, UnitMode, double)
Converts a numeric value from one UnitMode to another.
- FromPixels(double, UnitMode, double)
Converts a pixel value to the specified
tounit.
- PixelsToPoints(double, double)
Converts pixels to points (1/72 in) at the given DPI.
- PointsToPixels(double, double)
Converts points (1/72 in) to pixels at the given DPI.
- ToPixels(double, UnitMode, double)
Converts a value in
fromunits to pixels.
- ToPixelsRounded(double, UnitMode, double, MidpointRounding)
Converts a value to pixels and rounds to the nearest integer using the specified midpoint strategy.