希望我能回答这个问题,但是极客构建API并没有提供基本的必需品,并且有时抽象的东西太多了。
顺便说一句,我拥有40年的UI和软件设计设计经验,并且自从“ VESA”驱动程序问世以来就一直致力于实现这一目标。
对于触摸屏,我有一个叫做“ fingerSize()”的东西,它的像素数为1cm(非常接近手指的平均触摸区域的直径),但根数为“ dpcm”。
您想要显示的另一件事是“视角”。用于查看和触摸功能的显示设备的类型几乎定义了查看距离。
(Not code but I wanted fixed width font)
Hand held - Phone/Tablet 25cm
Touch screen / Desktop Monitor 40cm ( seated or standing at a counter
with partially extended arm )
"Personal" Touch kiosk 50cm -> 80cm ( a bit further away standing
extended arms and standing back
to view )
Presentation Screen. any distance ( angle of view derived from pixel
width of device. An ideal conventional cinema
seat (as opposed to imax or immersive)
you want about 50 degrees
between edges of the screen. from viewer POV )
So what you want universally available is:
device usage type.
finger size in pixels (dots per CM)
pixel dimensions of display.
Then internally, when laying out and drawing you want the size/shape of a pixel
for the current transform.
这就是我们试图在API中提供的内容,但是在许多情况下很难做到。