您如何利用SWT的Hi-DPI支持图标? [英] How do you utilize SWT's Hi-DPI support for icons?
问题描述
根据 Eclipse项目霓虹灯-新的和值得注意的,SWT支持Hi-DPI监视器的自动缩放. SWT是否仅支持自动缩放",还是提供其他功能,例如为各种DPI或缩放级别定义不同的图像?如果是这样,我需要研究哪些课程?
According to Eclipse Project Neon - New and Noteworthy, SWT supports auto-scaling for Hi-DPI monitors. Does SWT only support "auto-scaling", or does it provide additional features such as defining different images for various DPIs or zoom levels? If so, what are the classes I need to be looking into?
推荐答案
SWT的Image
具有一个新的构造函数,该构造函数接受ImageDataProvider
以便为不同的缩放级别提供图像数据.如果将应用程序移动到具有不同DPI的监视器,或者更改了缩放级别,则会要求提供程序返回新缩放级别(例如150或200)的图像.
SWT's Image
has a new constructor that accepts an ImageDataProvider
in order to provide image data for different zoom levels. if the application is moved to a monitor with different DPI or the zoom level is changed, the provider will be asked to return an image for the new zoom level (e.g. 150 or 200).
为了完整起见,还有一个ImageFileNameProvider
.它的作用类似于ImageDataProvider
,但返回文件名.
For the sake of completeness, there is also an ImageFileNameProvider
. It works similar to the ImageDataProvider
but returns file names instead.
这篇关于您如何利用SWT的Hi-DPI支持图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!