Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 403993

Summary: Provide means to specify double-sized graphics for HiDPI mode on OS X
Product: [Eclipse Project] Platform Reporter: Thomas Singer <eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: arunkumar.thondapu, bjoern.pollex, bsd, busta03200, christoph.wulf, derekbixler, elreydetodo, gunnar, justin, kaloyan, lorenzo.bettini, lshanmug, markus.kell.r, martin.platter, ntsarb, peter, srscode, theronni, tomiak.marcin
Version: 4.3   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Bug Depends on:    
Bug Blocks: 479614    
Attachments:
Description Flags
Screenshot of Eclipse in 192 DPI mode under Windows 7 none

Description Thomas Singer CLA 2013-03-21 05:04:11 EDT
When I run our SWT application with HiDPI mode (see <http://stackoverflow.com/questions/12124576/>), the texts and everything directly drawn looks nice, but all images look ugly. Provide means to provide controls, e.g. the toolbar, with double-sized images which are not automatically double-scaled.
Comment 1 Marcin Tomiak CLA 2013-09-20 10:17:25 EDT
Created attachment 235665 [details]
Screenshot of Eclipse in 192 DPI mode under Windows 7
Comment 2 Marcin Tomiak CLA 2013-09-20 10:17:40 EDT
I'd like to point out that this isn't OS X specific problem. 

I use my MacBook Pro Retina with Windows 7 and I run Eclipse on this platform in HiDPI mode i.e. I use native 2560x1600 resolution with 192 DPI (200% of standard). Visual experience is gorgeous. The text is extremely sharp and eyes are less trobuled by work. 

However there is a problem with icons under Eclipse.

As you can see on the attached to this comment screenshot, every icon is 2x smaller than it should be and thus everything looks funny. If only icons were with proper size...
Comment 3 Brian de Alwis CLA 2013-09-20 11:01:01 EDT
I think there's a couple of ways Eclipse could provide support for this.

One approach would be to extend SWT to support loading images from PDF and/or SVG.  SWT would generate an appropriately detailed image given the device resolution.  This doesn't seem to fit well in with the current Image/ImageData split though, since ImageData is not actually tied to a particular device.

A different approach would be to instead add support to JFace's ImageDescriptor for checking for a high-resolution image based on the display device support.  The ImageDescriptor could transparently look for a FILE@2x.EXT if the display is > 92dpi or something.  The implementation's not so clean as there are many different ImageDescriptor implementations and they don't all pass through the device in their loading.  Handling multiple resolutions is problematic though (what should happen with a 600DPI device?).  I suppose we could make the media mapping pluggable.

I suppose we could also look at something like the CSS image-set specifications too.

    http://dev.w3.org/csswg/css-images/#image-set-notation

We could extend the Eclipse CSS support to allow overriding icons for particular commands, combined with media queries to select the appropriate icon.  Unfortunately Apache Batik, the underlying CSS engine, only supports to CSS 2.1, and Batik seems to be dormant/dead.
Comment 4 Thomas Singer CLA 2013-09-20 15:15:11 EDT
IIRC, the problem on OS X is that the graphics are scaled at double-size automatically, so the ratio of text to image is preserved. It would be sufficient to tell SWT not to scale, so our code could just provide quad-size images and they would be draw as-is.
Comment 5 Marcin Tomiak CLA 2013-09-20 15:42:55 EDT
Yes you're right. On Mac icons are just awfuly blurry but in correct ratio. It is far better than what I'm observing on Windows with 192 DPI. Should there be separate bug for the issue which I presented?
Comment 6 Thomas Singer CLA 2013-09-21 02:46:54 EDT
I don't agree with you. I'd prefer to have it look on OS X as on Windows, because then I could solve it myself by using larger icons.
Comment 7 Marcin Tomiak CLA 2013-11-10 09:56:03 EST
It is correct that in case which I presented you can do it yourself by using 2x larger icons. 

The problem is that I often plug in my MacBook to external monitor. If I used 2x larger icons I wouldn't be able to use the same Eclipse both on laptop and external monitor. This is obviously a huge drawback, because when you need to install a new plugin you have to do it on both eclipses (with regular icons and 2x icons).
Comment 8 Nikos Tsarmpopoulos CLA 2014-01-10 22:04:40 EST
I think Marcin is right, Eclipse would benefit from a mechanism that allows it to adapt to different screen DPIs. 

In theory, for existing plugins icons could be upscaled automatically by Eclipse to fit the current screen's DPI; for future proofing the platform, it would make sense allowing for the developers to choose between vector graphics (hence automatically upscalable without loss of clarity) or multiple icons at different resolutions.

I recently purchased a rMBP, installed Windows 8.1 Pro and can't work with such small icons. I had the impression that Windows APIs were already taking care of these issues... and I found this is not the case.
Comment 9 Thomas Singer CLA 2014-01-11 02:30:42 EST
(In reply to Nikos Tsarmpopoulos from comment #8)
> I think Marcin is right, Eclipse would benefit from a mechanism that allows
> it to adapt to different screen DPIs. 

I think, there are two layers involved, SWT and the using application, e.g. Eclipse. IMHO, for OS X SWT needs a way to NOT scale the images itself.

> I recently purchased a rMBP, installed Windows 8.1 Pro and can't work with
> such small icons. I had the impression that Windows APIs were already taking
> care of these issues... and I found this is not the case.

This can be handled by the SWT using application if and only if SWT provides a way to NOT scale images.

Of course, it would be more elegant, if SWT could handle different-sized images or vector graphics automatically, but a) this would require SWT to NOT automatically scale and b) would be much more effort.
Comment 10 Markus Keller CLA 2014-04-19 17:31:28 EDT
SWT should not try to implement resolution-independent images itself, but it should reuse / offer APIs for what's already offered by the operating systems.

Added dependency on bug 382972, but IMO, this bug should just be marked as a dup of that one.
Comment 11 open source CLA 2014-06-27 06:04:56 EDT
SWT apps looks really bad on retina. Any progress on the icon scaling issue?
Comment 12 Thomas Singer CLA 2014-06-27 07:43:23 EDT
(In reply to open source from comment #11)
> SWT apps looks really bad on retina. Any progress on the icon scaling issue?

Well, Eclipse itself looks bad on OS X even without retina display. But this is at least caused by not using the shell's toolbar.
Comment 13 Derek Bixler CLA 2014-11-02 09:06:52 EST
Any progress made on this? It's been a while now and those icons are just painful to look at and I'm tired of using JetBrains products.
Comment 14 Arun Thondapu CLA 2015-01-08 07:46:01 EST
This issue is being addressed for the 4.5 release via bugs 382972 and 421383.

*** This bug has been marked as a duplicate of bug 382972 ***
Comment 15 Thomas Singer CLA 2015-10-28 11:34:28 EDT
I reckon, when the user changes the resolution (e.g. from Full-HD to 960x540HiDPI) on OS X, images created with an appropriate ImageDataProvider will automatically use the zoom=200 level images. But is there a listener available that is triggered for such events, so other stuff like distances between controls are adapted correctly, too?