private void disposeUniversalImages( Collection<SwtUniversalImage> c ) { for ( SwtUniversalImage image : c ) { image.dispose(); } }
@Override public synchronized void dispose() { super.dispose(); if ( !bitmap.isDisposed() ) { bitmap.dispose(); } }
/** * Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important * to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application * ends. * * @param location the location of the image resource to load * @param width The height to resize the image to * @param height The width to resize the image to * @return the loaded image */ public Image getImage( String location, int width, int height ) { Image image = imageMap.get( location ); if ( image == null ) { SwtUniversalImage svg = SwtSvgImageUtil.getImage( display, location ); image = new Image( display, svg.getAsBitmapForSize( display, width, height ), SWT.IMAGE_COPY ); svg.dispose(); imageMap.put( location, image ); } return image; }
/** * Loads an image from a location once. The second time, the image comes from a cache. Because of this, it's important * to never dispose of the image you get from here. (easy!) The images are automatically disposed when the application * ends. * * @param location the location of the image resource to load * @param classLoader the ClassLoader to use to locate resources * @param width The height to resize the image to * @param height The width to resize the image to * @return the loaded image */ public Image getImage( String location, ClassLoader classLoader, int width, int height ) { Image image = imageMap.get( location ); if ( image == null ) { SwtUniversalImage svg = SwtSvgImageUtil.getUniversalImage( display, classLoader, location ); image = new Image( display, svg.getAsBitmapForSize( display, width, height ), SWT.IMAGE_COPY ); svg.dispose(); imageMap.put( location, image ); } return image; }
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; }
loader.save( out, SWT.IMAGE_PNG ); image.dispose();
imageHop.dispose(); imageDisabledHop.dispose(); imageConnection.dispose(); imageConnectionTree.dispose(); imageAdd.dispose(); imageTable.dispose(); imagePreview.dispose(); imageSchema.dispose(); imageSynonym.dispose(); imageExploreDbSmall.dispose(); imageView.dispose(); imageLogoSmall.dispose(); imageKettleLogo.dispose(); imageBanner.dispose(); imageBol.dispose(); imageCalendar.dispose(); imageCluster.dispose(); imageSlave.dispose(); imageSlaveTree.dispose(); imageArrow.dispose(); imageFolder.dispose(); imageTransRepo.dispose(); imageJobRepo.dispose(); imageWizard.dispose(); imageCredits.dispose(); imageStart.dispose(); imageDummy.dispose(); imageMissing.dispose();
private Image loadAsResource( Display display, String location, int size ) { SwtUniversalImage img = SwtSvgImageUtil.getImageAsResource( display, location ); Image image; if ( size > 0 ) { image = new Image( display, img.getAsBitmapForSize( display, size, size ), SWT.IMAGE_COPY ); } else { image = new Image( display, img.getAsBitmap( display ), SWT.IMAGE_COPY ); } img.dispose(); return image; }
public void handleEvent( Event event ) { swtImage.dispose(); } } );
private Image getHadoopClusterImage( Display display ) { final SwtUniversalImage swtImage = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), "hadoop_clusters.svg" ); Image image = swtImage.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE ); display.addListener( SWT.Dispose, event -> swtImage.dispose() ); return image; } }