1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
private void paint(GC gc)
{
...
screenImage = new Image(getDisplay(), clientRect.width,
clientRect.height);
BufferedImage awtImage = new BufferedImage(clientRect.width,
clientRect.height, BufferedImage.TYPE_INT_ARGB);
Graphics g = awtImage.getGraphics();
g.setColor(new java.awt.Color(TRANSPARENT_COLOR));
g.fillRect(0, 0, clientRect.width, clientRect.height);
g.setClip(clientRect.x, clientRect.y, clientRect.width,
clientRect.height);
g.drawImage(ImageUtils.convertToAWT(sourceImage.getImageData()),
destRect.x, destRect.y, destRect.width, destRect.height,
imageRect.x, imageRect.y, imageRect.width,
imageRect.height, null);
try {
screenImage = new Image(getDisplay(),
ImageUtils.convertToSWT(awtImage));
// imgLabel.setImage(img);
} catch (Exception e) {
System.err
.println("Unable to convert BufferedImage to SWT image.");
e.printStackTrace();
}
gc.drawImage(screenImage, 0, 0); |
Partager