Class AbstractDpiConverter

    • Field Detail

      • dpi

        protected int dpi
      • scaleFactor

        protected float scaleFactor
        Since:
        2.0
    • Constructor Detail

      • AbstractDpiConverter

        public AbstractDpiConverter()
    • Method Detail

      • readDpiFromDisplay

        protected abstract void readDpiFromDisplay()
        Sets the value for the dpi member variable.

        IMPORTANT:
        Ensure the load operation is done in the UI thread!

      • getDpi

        public int getDpi()
        Description copied from interface: IDpiConverter
        Returns the dots per inch of the display.
        Specified by:
        getDpi in interface IDpiConverter
        Returns:
        the horizontal and vertical DPI
      • getCurrentDpiFactor

        public float getCurrentDpiFactor()
        Specified by:
        getCurrentDpiFactor in interface IDpiConverter
        Returns:
        The factor that will be used for the current DPI.
      • convertPixelToDpi

        public int convertPixelToDpi​(int pixel)
        Description copied from interface: IDpiConverter
        Converts the given amount of pixels to a DPI scaled value.
        Specified by:
        convertPixelToDpi in interface IDpiConverter
        Parameters:
        pixel - the amount of pixels to convert.
        Returns:
        The converted pixels.
      • convertDpiToPixel

        public int convertDpiToPixel​(int dpi)
        Description copied from interface: IDpiConverter
        Converts the given DPI scaled value to a pixel value.
        Specified by:
        convertDpiToPixel in interface IDpiConverter
        Parameters:
        dpi - the DPI value to convert.
        Returns:
        The pixel value related to the given DPI