将复合导出到图像,与屏幕分辨率无关

时间:2015-09-02 14:17:31

标签: java swt

SWT中是否有办法将复合材料导出到始终具有相同尺寸/分辨率的图像?问题是我们有一个仪表板,当在具有不同显示尺寸/分辨率的屏幕上打开时,它看起来总是不同。现在的问题是,我可以将仪表板导出到具有固定大小的图像,无论在哪个屏幕尺寸/分辨率上创建,它总是看起来相同吗?

暂时我们这样做,但正如所说,它取决于它的创建显示:

Image image = new Image(Display.getCurrent(), this.content.getBounds().width, this.content.getBounds().height);
ImageLoader loader = new ImageLoader();
FileOutputStream fileOutputStream = new FileOutputStream(file);

GC gc = new GC(image);
this.content.print(gc);

gc.dispose();

loader.data = new ImageData[] { image.getImageData() };
loader.save(fileOutputStream, imageFormat);
fileOutputStream.close();

是否有某种方法来创建具有特定分辨率的虚拟屏幕,该屏幕实际上并未显示且仅用于导出仪表板? 任何帮助或指示将不胜感激。

0 个答案:

没有答案