Add support for multiple DPI images, fixes #541.

This commit is contained in:
Cheng Zhao 2014-08-06 11:20:00 +08:00
parent a76ae8cd35
commit dfe111b95a
2 changed files with 114 additions and 22 deletions

View file

@ -7,7 +7,7 @@ For example when creating tray or setting window's icon, you can pass image's
file path as `String` to represent an image:
```javascript
var appIcon = new Tray('/Users/somebody/images/icon@2x.png');
var appIcon = new Tray('/Users/somebody/images/icon.png');
var window = new BrowserWindow({icon: '/Users/somebody/images/window.png'});
```
@ -23,3 +23,32 @@ file name's base name to mark it as a high resolution image.
For example if `icon.png` is a normal image that has standard resolution, the
`icon@2x.png` would be treated as a high resolution image that has double DPI
dense.
If you want to support displays with different DPI denses at the same time, you
can put images with different sizes in the same folder, and use the filename
without DPI suffixes, like this:
```text
images/
├── icon.png
├── icon@2x.png
└── icon@3x.png
```
```javascript
var appIcon = new Tray('/Users/somebody/images/icon.png');
```
Following suffixes as DPI denses are also supported:
* `@1x`
* `@1.25x`
* `@1.33x`
* `@1.4x`
* `@1.5x`
* `@1.8x`
* `@2x`
* `@2.5x`
* `@3x`