Exemplo n.º 1
0
 public void drawImage(FSImage image, int x, int y) {
   Image img = ((SWTFSImage) image).getImage();
   if (img == null) {
     int width = image.getWidth();
     int height = image.getHeight();
     Color oldBG = _gc.getBackground();
     Color oldFG = _gc.getForeground();
     _gc.setBackground(_gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
     _gc.setForeground(_gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
     _gc.fillRectangle(x, y, width, height);
     _gc.drawRectangle(x, y, width, height);
     _gc.drawLine(x, y, x + width - 1, y + height - 1);
     _gc.drawLine(x, y + height - 1, x + width - 1, y);
     _gc.setBackground(oldBG);
     _gc.setForeground(oldFG);
   } else {
     Rectangle bounds = img.getBounds();
     _gc.drawImage(
         img, 0, 0, bounds.width, bounds.height, x, y, image.getWidth(), image.getHeight());
   }
 }