Class ScalingHelper

java.lang.Object
org.eclipse.nebula.widgets.richtext.ScalingHelper

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

    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
  • Method Details

    • 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