Class HiDPIUtils


  • public class HiDPIUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      HiDPIUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static double normalize​(double value)  
      static void paintAtScale1x​(java.awt.Graphics2D g, int x, int y, int width, int height, RadianceCommonCortex.PainterScale1X painterScale1X)
      Paint at system scale factor 1x to avoid rounding issues at 125%, 150% and 175% scaling.
      static void paintAtScale1x​(java.awt.Graphics2D g, javax.swing.JComponent c, RadianceCommonCortex.PainterScale1X painterScale1X)  
      private static java.awt.geom.Rectangle2D.Double scale​(double scaleX, double scaleY, java.awt.geom.AffineTransform t, int x, int y, int width, int height)
      Scales a rectangle in the same way as the JRE does in sun.java2d.pipe.PixelToParallelogramConverter.fillRectangle(), which is used by Graphics.fillRect().
      • Methods inherited from class java.lang.Object

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

      • HiDPIUtils

        public HiDPIUtils()
    • Method Detail

      • paintAtScale1x

        public static void paintAtScale1x​(java.awt.Graphics2D g,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          RadianceCommonCortex.PainterScale1X painterScale1X)
        Paint at system scale factor 1x to avoid rounding issues at 125%, 150% and 175% scaling.

        Scales the given Graphics2D down to 100% and invokes the given painter passing scaled x, y, width and height.

        Uses the same scaling calculation as the JRE uses.

      • scale

        private static java.awt.geom.Rectangle2D.Double scale​(double scaleX,
                                                              double scaleY,
                                                              java.awt.geom.AffineTransform t,
                                                              int x,
                                                              int y,
                                                              int width,
                                                              int height)
        Scales a rectangle in the same way as the JRE does in sun.java2d.pipe.PixelToParallelogramConverter.fillRectangle(), which is used by Graphics.fillRect().
      • normalize

        private static double normalize​(double value)