Class ScalingHelper


  • public final class ScalingHelper
    extends java.lang.Object
    Helper class to handle display scaling.
    Since:
    1.4
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ScalingHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int convertHorizontalDpiToPixel​(int dpi)
      Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.
      static int convertHorizontalPixelToDpi​(int pixel)
      Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.
      static int convertVerticalDpiToPixel​(int dpi)
      Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.
      static int convertVerticalPixelToDpi​(int pixel)
      Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.
      static float getDpiFactor​(int dpi)
      Returns the factor for scaling calculations of pixels regarding the DPI.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScalingHelper

        private ScalingHelper()
    • Method Detail

      • getDpiFactor

        public static float getDpiFactor​(int dpi)
        Returns the factor for scaling calculations of pixels regarding the DPI.
        Parameters:
        dpi - The DPI for which the factor is requested.
        Returns:
        The factor for dpi scaling calculations.
      • convertHorizontalPixelToDpi

        public static int convertHorizontalPixelToDpi​(int pixel)
        Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.
        Parameters:
        pixel - the amount of pixels to convert.
        Returns:
        The converted pixels.
      • convertHorizontalDpiToPixel

        public static int convertHorizontalDpiToPixel​(int dpi)
        Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.
        Parameters:
        dpi - the DPI value to convert.
        Returns:
        The pixel value related to the given DPI
      • convertVerticalPixelToDpi

        public static int convertVerticalPixelToDpi​(int pixel)
        Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.
        Parameters:
        pixel - the amount of pixels to convert.
        Returns:
        The converted pixels.
      • convertVerticalDpiToPixel

        public static int convertVerticalDpiToPixel​(int dpi)
        Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.
        Parameters:
        dpi - the DPI value to convert.
        Returns:
        The pixel value related to the given DPI