Interface IDpiConverter
- All Known Implementing Classes:
AbstractDpiConverter
,DefaultHorizontalDpiConverter
,DefaultVerticalDpiConverter
,FixedScalingDpiConverter
,NoScalingDpiConverter
public interface IDpiConverter
Interface to add support for scaling.
This interface is inspired by Riena and the corresponding talk at EclipseCon 2014 Scaling SWT on high-resolution screens
-
Method Summary
Modifier and TypeMethodDescriptionint
convertDpiToPixel
(int dpi) Converts the given DPI scaled value to a pixel value.int
convertPixelToDpi
(int pixel) Converts the given amount of pixels to a DPI scaled value.float
int
getDpi()
Returns the dots per inch of the display.
-
Method Details
-
getDpi
int getDpi()Returns the dots per inch of the display.- Returns:
- the horizontal and vertical DPI
-
getCurrentDpiFactor
float getCurrentDpiFactor()- Returns:
- The factor that will be used for the current DPI.
-
convertPixelToDpi
int convertPixelToDpi(int pixel) Converts the given amount of pixels to a DPI scaled value.- Parameters:
pixel
- the amount of pixels to convert.- Returns:
- The converted pixels.
-
convertDpiToPixel
int convertDpiToPixel(int dpi) Converts the given DPI scaled value to a pixel value.- Parameters:
dpi
- the DPI value to convert.- Returns:
- The pixel value related to the given DPI
-