ALL black Pixels with SWT since Windows 10 Update 1809 and gc.print() / gc.copyArea(

白昼怎懂夜的黑 提交于 2019-12-11 05:44:53

问题


I have this piece of code that worked throug the ages (kepler to oxygen) for the last 4 Years,

Since the Windows 10 1809 update this results in an all black picture. This happens on several PCs.

public static Image renderToImage(Control control) {
    Shell imgShell = new Shell(control.getDisplay(), SWT.NO_TRIM);
    Composite oldParent = control.getParent();
    Point size = control.getSize();
    imgShell.setSize(size);
    control.setParent(imgShell);
    Image image = new Image(control.getShell().getDisplay(), size.x, size.y);
    GC gc = new GC(image);

    //gc.setForeground(imgShell.getDisplay().getSystemColor(SWT.COLOR_RED));
    //gc.drawString("Image",size.x/2, size.y/2, true);
    control.print(gc);
    gc.dispose();
    control.setParent(oldParent);

    return image;
  }

I updated my application from oxygen to eclipse-rcp-1903 and this problem persists.

The gc.drawString line works and will write the words "Image" onto the Image.

The following screenshot shows the problem. The black area is supposed to be an Image that was copied from a shell that looks like the one below it.

来源:https://stackoverflow.com/questions/56460951/all-black-pixels-with-swt-since-windows-10-update-1809-and-gc-print-gc-copya

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!