FOLLOW ME Twitter Facebook Вконтакте LinkedIn RSS Feed
Browsing articles tagged with " retina"

Retina support in Oracle JDK 1.7.0_40 and above

Jun 23, 2013
Category: Java

Hi everyone!

A few days ago I installed Oracle JDK (version 1.7.0_40) built especially for early access purposes. So, it’s not the final release. The build contains tons of bug fixes and backports from JDK 8 for AWT/Swing and that was the main point why I started to play with it. As you might have heard, Retina support was one of the major issues in all 1.7.* releases. I’d say there was no Retina support before the build 1.7.0_40. I’m going to show you some differences of Retina support in Apple and Oracle JDKs.
 

1. isRetina() method

That’s funny, but there is no public API for it in Oracle JDK 7. Here is how we (IntelliJ IDEA team) do it under Apple JDK:

class IsRetina {
  public static final boolean isRetina = isRetina();

  private static boolean isRetina() {
    try {
      final boolean[] isRetina = new boolean[1];
      new apple.awt.CImage.HiDPIScaledImage(1,1,BufferedImage.TYPE_INT_ARGB) {
        @Override
        public void drawIntoImage(BufferedImage image, float v) {
          isRetina[0] = v > 1;
        }
      };
      return isRetina[0];
    } catch (Throwable e) { 
      e.printStackTrace();
      return false;
    }
  }
}

Continue reading »


How to make favicon.ico for Retina

Jan 23, 2013
Category: Design

If you read this, you probably have a web-site or a personal blog. Anyway, you know what is a favicon. A favicon is an icon representing your web-site in bookmarks, address bar, etc. In 99% it’s 16×16 px ico file and in 99% it looks ugly on a Retina device. This is how my Bookmarks bar looks in Chrome.

Bookmarks bar in Chrome

Icons on the left are made with retina quality, and icons on the right are not. To fix it, we need 32×32 px version of the icon. Once you’ve made it, you need an ico file containing both 16x16px and 32x32px icons. I’d recommend to use X-Icon Editor – a web-based tool doing all dirty job for you. All you need is:

  1. Upload 32x32px PNG icon
  2. Leave 16×16 and 32×32 options checked and uncheck others
  3. Click OK and download ICO file
  4. Rename it to favicon.ico and upload it to yours web-site document root. So it’s available at http://mydomain.com/favicon.ico

Enjoy

P.S. to make your icon looks perfect on mobile devices such as iPads, iPhones, etc I’d recommend to read Mathias Bynens’ awesome post about it