Package org.pentaho.di.ui.util
Class SwtSvgImageUtil
- java.lang.Object
-
- org.pentaho.di.ui.util.SwtSvgImageUtil
-
public class SwtSvgImageUtil extends Object
Class for loading images from SVG, PNG, or other bitmap formats. Logic is: if SVG is enabled, then SVG icon loaded if exist. Otherwise, class trying to change name into PNG and try to load. If initial name is PNG, then PNG icon will be loaded.
-
-
Constructor Summary
Constructors Constructor Description SwtSvgImageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.swt.graphics.Image
getImage(org.eclipse.swt.widgets.Display display, ClassLoader classLoader, String filename, int width, int height)
Get an image using the provided classLoader and path.static SwtUniversalImage
getImage(org.eclipse.swt.widgets.Display display, String location)
Load image from several sources.static SwtUniversalImage
getImageAsResource(org.eclipse.swt.widgets.Display display, String location)
Load image from several sources.static SwtUniversalImage
getMissingImage(org.eclipse.swt.widgets.Display display)
Get the image for when all other fallbacks have failed.static SwtUniversalImage
getUniversalImage(org.eclipse.swt.widgets.Display display, ClassLoader classLoader, String filename)
Load image from several sources.
-
-
-
Method Detail
-
getMissingImage
public static SwtUniversalImage getMissingImage(org.eclipse.swt.widgets.Display display)
Get the image for when all other fallbacks have failed. This is an image drawn on the canvas, a square with a red X.- Parameters:
display
- the device to render the image to- Returns:
- the missing image
-
getImageAsResource
public static SwtUniversalImage getImageAsResource(org.eclipse.swt.widgets.Display display, String location)
Load image from several sources.
-
getImage
public static org.eclipse.swt.graphics.Image getImage(org.eclipse.swt.widgets.Display display, ClassLoader classLoader, String filename, int width, int height)
Get an image using the provided classLoader and path. An attempt will be made to load the image with the classLoader first using SVG (regardless of extension), and falling back to PNG. If the image cannot be loaded with the provided classLoader, the search path will be expanded to include the file system (ui/images).- Parameters:
display
- the device to render the image toclassLoader
- the classLoader to use to load the image resourcefilename
- the path to the imagewidth
- the width to scale the image toheight
- the height to scale the image to- Returns:
- an swt Image with width/height dimensions
-
getUniversalImage
public static SwtUniversalImage getUniversalImage(org.eclipse.swt.widgets.Display display, ClassLoader classLoader, String filename)
Load image from several sources.
-
getImage
public static SwtUniversalImage getImage(org.eclipse.swt.widgets.Display display, String location)
Load image from several sources.
-
-