Search in sources :

Example 81 with ImageData

use of org.eclipse.swt.graphics.ImageData in project dbeaver by serge-rider.

the class OverlayImageDescriptor method drawBottomLeft.

protected void drawBottomLeft(ImageDescriptor[] overlays) {
    if (overlays == null)
        return;
    int length = overlays.length;
    int x = 0;
    for (int i = 0; i < 3; i++) {
        if (i < length && overlays[i] != null) {
            ImageData id = overlays[i].getImageData();
            drawImage(id, x, getSize().y - id.height);
            x += id.width;
        }
    }
}
Also used : ImageData(org.eclipse.swt.graphics.ImageData) Point(org.eclipse.swt.graphics.Point)

Example 82 with ImageData

use of org.eclipse.swt.graphics.ImageData in project dbeaver by serge-rider.

the class OverlayImageDescriptor method drawTopRight.

protected void drawTopRight(ImageDescriptor[] overlays) {
    if (overlays == null)
        return;
    int length = overlays.length;
    int x = getSize().x;
    for (int i = 2; i >= 0; i--) {
        if (i < length && overlays[i] != null) {
            ImageData id = overlays[i].getImageData();
            x -= id.width;
            drawImage(id, x, 0);
        }
    }
}
Also used : ImageData(org.eclipse.swt.graphics.ImageData) Point(org.eclipse.swt.graphics.Point)

Example 83 with ImageData

use of org.eclipse.swt.graphics.ImageData in project dbeaver by serge-rider.

the class OverlayImageDescriptor method drawCompositeImage.

@Override
protected void drawCompositeImage(int width, int height) {
    ImageData base = baseImageData;
    drawImage(base, 0, 0);
    if (topRight != null)
        drawTopRight(topRight);
    if (bottomRight != null)
        drawBottomRight(bottomRight);
    if (bottomLeft != null)
        drawBottomLeft(bottomLeft);
    if (topLeft != null)
        drawTopLeft(topLeft);
}
Also used : ImageData(org.eclipse.swt.graphics.ImageData)

Example 84 with ImageData

use of org.eclipse.swt.graphics.ImageData in project otertool by wuntee.

the class SWTResourceManager method getImage.

/**
	 * Returns an {@link Image} encoded by the specified {@link InputStream}.
	 * 
	 * @param stream
	 *            the {@link InputStream} encoding the image data
	 * @return the {@link Image} encoded by the specified input stream
	 */
protected static Image getImage(InputStream stream) throws IOException {
    try {
        Display display = Display.getCurrent();
        ImageData data = new ImageData(stream);
        if (data.transparentPixel > 0) {
            return new Image(display, data, data.getTransparencyMask());
        }
        return new Image(display, data);
    } finally {
        stream.close();
    }
}
Also used : ImageData(org.eclipse.swt.graphics.ImageData) Image(org.eclipse.swt.graphics.Image) Display(org.eclipse.swt.widgets.Display)

Example 85 with ImageData

use of org.eclipse.swt.graphics.ImageData in project cubrid-manager by CUBRID.

the class DecoratedImage method drawCompositeImage.

protected void drawCompositeImage(int width, int height) {
    // Draw the base image
    drawImage(baseImage.getImageData(), 0, 0);
    // Draw on the top left corner
    if (topLeft != null && topLeftKey != null) {
        ImageData imageData = topLeft.getImageData();
        drawImage(imageData, 0, 0);
    }
    // Draw on top right corner 
    if (topRight != null && topRightKey != null) {
        ImageData imageData = topRight.getImageData();
        drawImage(imageData, sizeOfImage.x - imageData.width, 0);
    }
    // Draw on bottom left  
    if (bottomLeft != null && bottomLeftKey != null) {
        ImageData imageData = bottomLeft.getImageData();
        drawImage(imageData, sizeOfImage.x - imageData.width, 0);
    }
    // Draw on bottom right corner  
    if (bottomRight != null && bottomRightKey != null) {
        ImageData imageData = bottomRight.getImageData();
        drawImage(imageData, sizeOfImage.x - imageData.width, sizeOfImage.y - imageData.height);
    }
}
Also used : ImageData(org.eclipse.swt.graphics.ImageData)

Aggregations

ImageData (org.eclipse.swt.graphics.ImageData)132 Image (org.eclipse.swt.graphics.Image)78 PaletteData (org.eclipse.swt.graphics.PaletteData)38 RGB (org.eclipse.swt.graphics.RGB)33 Point (org.eclipse.swt.graphics.Point)32 Test (org.junit.Test)26 InputStream (java.io.InputStream)24 GC (org.eclipse.swt.graphics.GC)19 IOException (java.io.IOException)18 SWTException (org.eclipse.swt.SWTException)14 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)13 Rectangle (org.eclipse.swt.graphics.Rectangle)12 Color (org.eclipse.swt.graphics.Color)11 ImageLoader (org.eclipse.swt.graphics.ImageLoader)11 Display (org.eclipse.swt.widgets.Display)11 ByteArrayInputStream (java.io.ByteArrayInputStream)7 Cursor (org.eclipse.swt.graphics.Cursor)7 Composite (org.eclipse.swt.widgets.Composite)7 GradientPaint (java.awt.GradientPaint)5 URL (java.net.URL)5