Java Code Examples for org.eclipse.swt.SWT#IMAGE_COPY

The following examples show how to use org.eclipse.swt.SWT#IMAGE_COPY . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void paintControl(PaintEvent event) {
    super.paintControl(event);

    Image image = Objects.requireNonNull((Image) fCanvas.getData(IMAGE_KEY));

    Image rangeRectangleImage = new Image(image.getDevice(), image, SWT.IMAGE_COPY);
    GC rangeWindowGC = new GC(rangeRectangleImage);

    if ((fScaledData != null) && (fRangeDuration != 0 || fDragState == DRAG_ZOOM)) {
        drawTimeRangeWindow(rangeWindowGC, fRangeStartTime, fRangeDuration);
    }

    // Draws the buffer image onto the canvas.
    event.gc.drawImage(rangeRectangleImage, 0, 0);

    rangeWindowGC.dispose();
    rangeRectangleImage.dispose();
}
 
Example 2
@Override
public void paintControl(PaintEvent event) {
    super.paintControl(event);

    if (fDragState == DRAG_ZOOM) {
        Image image = Objects.requireNonNull((Image) fCanvas.getData(IMAGE_KEY));

        Image rangeRectangleImage = new Image(image.getDevice(), image, SWT.IMAGE_COPY);
        GC rangeWindowGC = new GC(rangeRectangleImage);

        drawTimeRangeWindow(rangeWindowGC, fRangeStartTime, fRangeDuration);

        // Draws the buffer image onto the canvas.
        event.gc.drawImage(rangeRectangleImage, 0, 0);

        rangeWindowGC.dispose();
        rangeRectangleImage.dispose();
    }
}
 
Example 3
Source Project: hop   File: GuiResource.java    License: Apache License 2.0 5 votes vote down vote up
public Image loadAsResource( Display display, String location, int width, int height ) {
  SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location );
  int newWidth = (int) Math.round( width * zoomFactor );
  int newHeight = (int) Math.round( height * zoomFactor );
  Image image = new Image( display, img.getAsBitmapForSize( display, newWidth, newHeight ), SWT.IMAGE_COPY );
  img.dispose();
  return image;
}
 
Example 4
Source Project: pentaho-kettle   File: Splash.java    License: Apache License 2.0 4 votes vote down vote up
private Image loadAsResource( Display display, String location ) {
  SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location );
  Image image = new Image( display, img.getAsBitmap( display ), SWT.IMAGE_COPY );
  img.dispose();
  return image;
}