[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: High-res Customize icons
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: High-res Customize icons |
Date: |
Wed, 28 Oct 2020 10:22:46 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Gojō) APEL/10.8 EasyPG/1.0.0 Emacs/26.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
On Wed, 28 Oct 2020 04:17:37 +0900,
Yuan Fu wrote:
>
> I dug a bit further and it seems to do with Cocoa on Mac. On other engines
> the resolution is simply the resolution of the monitor, but Cocoa add an
> abstraction layer and the resolution an applications detects aren’t the
> actual physical resolution.
>
> So for high-res icons we want to simply use the @2x image on Linux and use
> @2x image but with :scale 0.5 on Cocoa. If we use normal image on high-res
> monitor, the image is too small on Linux, and if we are on Cocoa, the image
> is blurry.
>
> To detect high-res screens on other platforms, we currently have a function
> that measures the pixel height of a default line: if it’s greater than 15
> pixels, we consider the screen high-res and find-image will scale the
> returned image by :scale 2.
>
> Cocoa provides an API for querying the scaling factor, if it is 2, we should
> load the @2x image and add :scale 0.5.
>
> It’s kind of a mess. What do you think?
>
> How about exposing that Cocoa API to lisp and handle accordingly in
> find-image? Some thing like:
>
> (let (img)
> (if (eq (window-system) 'ns)
> ;; Cocoa
> (let ((pixel-scaling-factor (ns-scaling-factor)))
> (if (> pixel-scaling-factor 1.0)
> (append (find-2x-image) '(:scale 0.5))
> (find-normal-image)))
> ;; Other
> (let ((image-scaling-factor (image-compute-scaling-factor
> image-scaling-factor)))
> (if (> image-scaling-factor 2)
> (append (find-2x-image) '(:scale 2))
> (find-normal-image)))))
The Mac port (not the NS port) has supported @2x images since 2012 at
the C level as opposed to the Lisp level. It also automatically
re-renders images in resolution-independent formats such as SVG or PDF
in reaction to the frame movement from a Retina display to a
non-Retina one, for example. You might want to look at the
corresponding part of the Info document for the Mac port:
https://bitbucket.org/mituharu/emacs-mac/src/dfb5869abf8f6892e928042e9f8221f8435a0dcb/doc/emacs/macport.texi#lines-446
Althogh the backing scale factor information is not necessary at the
Lisp level for the automatic bitmap selection for the Mac port, it is
available via display-monitor-attributes-list (or
frame-monitor-attributes if you want to specify the frame to be
examined) as it is considered as a monitor-specific property.
(pp (display-monitor-attributes-list))
(((geometry 0 0 2560 1440)
(workarea 0 23 2560 1337)
(mm-size 599 340)
(frames #<frame Emacs@YAMAMOTO-no-iMac-5K.local 0x7faa96927200>)
(name . "iMac")
(metal-device-name . "AMD Radeon R9 M380")
(backing-scale-factor . 2))
((geometry 2560 0 1920 1200)
(workarea 2560 23 1920 1177)
(mm-size 493 311)
(frames)
(name . "Cinema HD")
(metal-device-name . "AMD Radeon R9 M380")
(backing-scale-factor . 1)))
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
- Re: High-res Customize icons, Yuan Fu, 2020/10/22
- Re: High-res Customize icons, Yuan Fu, 2020/10/23
- Re: High-res Customize icons, Eli Zaretskii, 2020/10/23
- Re: High-res Customize icons, Yuan Fu, 2020/10/27
- Re: High-res Customize icons, Eli Zaretskii, 2020/10/27
- Re: High-res Customize icons, Alan Third, 2020/10/27
- Re: High-res Customize icons, Yuan Fu, 2020/10/27
- Re: High-res Customize icons, Alan Third, 2020/10/27
- Re: High-res Customize icons,
YAMAMOTO Mitsuharu <=
- Re: High-res Customize icons, Yuan Fu, 2020/10/29