Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.GC.copyArea()


      Rectangle bounds = display.getBounds();
      int width = bounds.width;
      int height = bounds.height;

      Image image = new Image(display, width, height);
      gc.copyArea(image, 0, 0);
      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(fileName, SWT.IMAGE_PNG);
      return true;
    } catch (Exception e) {
View Full Code Here


      Rectangle bounds = display.getBounds();
      int width = bounds.width;
      int height = bounds.height;

      Image image = new Image(display, width, height);
      gc.copyArea(image, 0, 0);
      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(fileName, SWT.IMAGE_PNG);
      return true;
    } catch (Exception e) {
View Full Code Here

      parentDir.mkdirs();
    try {
      log.debug(MessageFormat.format("Capturing screenshot ''{0}''", fileName)); //$NON-NLS-1$

      image = new Image(display, bounds.width, bounds.height);
      gc.copyArea(image, bounds.x, bounds.y);
      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(fileName, new ImageFormatConverter().imageTypeOf(fileName.substring(fileName.lastIndexOf('.') + 1)));
      return true;
    } catch (Exception e) {
View Full Code Here

    int buttonX = cSize.x / 4;
    Image[] images = new Image[4];

    for (int i = 0; i < 4; i++) {
      Image image = new Image(display, buttonX, cSize.y);
      gc.copyArea(image, buttonX * i, 0);
      images[i] = getImage(resourceManager, gray, image);
    }

    canvas.dispose();
    gc.dispose();
View Full Code Here

      parentDir.mkdirs();
    try {
      log.debug(MessageFormat.format("Capturing screenshot ''{0}''", fileName)); //$NON-NLS-1$

      image = new Image(display, bounds.width, bounds.height);
      gc.copyArea(image, bounds.x, bounds.y);
      ImageLoader imageLoader = new ImageLoader();
      imageLoader.data = new ImageData[] { image.getImageData() };
      imageLoader.save(fileName, new ImageFormatConverter().imageTypeOf(fileName.substring(fileName.lastIndexOf('.') + 1)));
      return true;
    } catch (Exception e) {
View Full Code Here

      tmpParentShell.setSize(bounds.width, bounds.height);
      org.eclipse.swt.widgets.Canvas screenshotCanvas = new org.eclipse.swt.widgets.Canvas(tmpParentShell, SWT.NO_BACKGROUND);
      screenshotCanvas.setSize(bounds.width, bounds.height);
      GC displayGC = new GC(display);
      final Image screenshot = new Image(display, bounds.width, bounds.height);
      displayGC.copyArea(screenshot, location.x, location.y);
      displayGC.dispose();
      PaintListener paintListener = new PaintListener() {
        public void paintControl(PaintEvent e) {
          e.gc.drawImage(screenshot, 0, 0);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.