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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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).
For the sake of completeness, there is also an ImageFileNameProvider
. It works similar to the ImageDataProvider
but returns file names instead.
回答2:
The JFace ImageDescriptor
createFromFile
and createFromURL
methods look for additional image files with the name ending in @2x
or @1.5x
and will use these with an SWT image data provider when creating images.