Search in sources :

Example 1 with SwtUniversalImageBitmap

use of org.apache.hop.core.SwtUniversalImageBitmap in project hop by apache.

the class SwtSvgImageUtil method getMissingImage.

/**
 * Get the image for when all other fallbacks have failed. This is an image drawn on the canvas, a
 * square with a red X.
 *
 * @param display the device to render the image to
 * @return the missing image
 */
public static SwtUniversalImage getMissingImage(Display display) {
    Image img = new Image(display, ConstUi.ICON_SIZE, ConstUi.ICON_SIZE);
    // RAP only allows painting on the Canvas widget
    if (!EnvironmentUtils.getInstance().isWeb()) {
        GC gc = new GC(img);
        gc.setForeground(new Color(display, PropsUi.getInstance().contrastColor(0, 0, 0)));
        gc.drawRectangle(4, 4, ConstUi.ICON_SIZE - 8, ConstUi.ICON_SIZE - 8);
        gc.setForeground(new Color(display, PropsUi.getInstance().contrastColor(255, 0, 0)));
        gc.drawLine(4, 4, ConstUi.ICON_SIZE - 4, ConstUi.ICON_SIZE - 4);
        gc.drawLine(ConstUi.ICON_SIZE - 4, 4, 4, ConstUi.ICON_SIZE - 4);
        gc.dispose();
    }
    return new SwtUniversalImageBitmap(img, zoomFactor);
}
Also used : Color(org.eclipse.swt.graphics.Color) SwtUniversalImage(org.apache.hop.core.SwtUniversalImage) Image(org.eclipse.swt.graphics.Image) GC(org.eclipse.swt.graphics.GC) SwtUniversalImageBitmap(org.apache.hop.core.SwtUniversalImageBitmap)

Aggregations

SwtUniversalImage (org.apache.hop.core.SwtUniversalImage)1 SwtUniversalImageBitmap (org.apache.hop.core.SwtUniversalImageBitmap)1 Color (org.eclipse.swt.graphics.Color)1 GC (org.eclipse.swt.graphics.GC)1 Image (org.eclipse.swt.graphics.Image)1