0

スクリーンショットを撮り、画像の 2 つのコピーを表示するために、Eclipse プラグインに次のコードがあります。将来的には、2 番目のコピーに変更を加える予定ですが、現時点では正確なコピーを表示するだけで十分です。ただし、2 番目のコピーは空白として表示されます。

screenshot.getImageData().data0 と -1 の配列のようです: [0, -1, -1, -1, 0, -1, -1, -1, ... ]

2番目の画像が空白になっている原因や、何を試してみるべきか考えていますか?

ありがとうございました

// Take a screenshot
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Shell shell = window.getShell();
Display display = shell.getDisplay();

Rectangle windowBounds = shell.getBounds();

GC gc = new GC(display);
Image screenshot = new Image(display, windowBounds);
gc.copyArea(screenshot, windowBounds.x, windowBounds.y);
gc.dispose();


// Display the images
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
container.setBackground(new Color(Display.getDefault(), 255, 255, 0));

new Label(container, SWT.NONE).setImage(screenshot);

// Copy of screenshot. To be scaled down at a later time
Image scaledSS = new Image(screenshot.getDevice(), screenshot.getImageData());

new Label(container, SWT.NONE).setImage(scaledSS);

ここに画像の説明を入力

4

0 に答える 0