public void dispose() { gc.dispose(); if ( transform != null && transform.isDisposed() == false ) { transform.dispose(); } for ( Color color : colors ) { color.dispose(); } for ( Font font : fonts ) { font.dispose(); } }
public void setTransform( float translationX, float translationY, int shadowsize, float magnification ) { if ( transform != null ) { // dispose of previous to prevent leaking of handles transform.dispose(); } transform = new Transform( gc.getDevice() ); transform.translate( translationX + shadowsize * magnification, translationY + shadowsize * magnification ); transform.scale( magnification, magnification ); gc.setTransform( transform ); currentMagnification = magnification; }
@Override protected Image renderSimple( Device device, int width, int height ) { int xsize = bitmap.getBounds().width; int ysize = bitmap.getBounds().height; Image result = new Image( device, width, height ); GC gc = new GC( result ); gc.drawImage( bitmap, 0, 0, xsize, ysize, 0, 0, width, height ); gc.dispose(); return result; }
public static Image makeImageTransparent( Display display, Image tempImage, RGB transparentColor ) { ImageData imageData = tempImage.getImageData(); int pixelIndex = imageData.palette.getPixel( transparentColor ); imageData.transparentPixel = pixelIndex; Image image = new Image( display, imageData ); tempImage.dispose(); return image; }
private Rectangle getAndNotSize( GC gc ) { Point p = gc.textExtent( Condition.operators[Condition.OPERATOR_AND_NOT] ); return new Rectangle( 0, 0, p.x, p.y ); }
public void paintControl( PaintEvent event ) { if ( image != null && !image.isDisposed() ) { event.gc.drawImage( image, 0, 0 ); } } } );
private void drawMarker( GC gc, int x, int maxy ) { int[] triangle = new int[] { LEFT + MARGIN + x * fontwidth + offset.x, TOP - 4, LEFT + MARGIN + x * fontwidth + offset.x + 3, TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x - 3, TOP + 1 }; gc.fillPolygon( triangle ); gc.drawPolygon( triangle ); gc .drawLine( LEFT + MARGIN + x * fontwidth + offset.x, TOP + 1, LEFT + MARGIN + x * fontwidth + offset.x, maxy ); }
/** * Free the managed resource if it hasn't already been done and if this is not a system color * */ public void dispose() { // System color and already disposed off colors don't need to be disposed! if ( !systemColor && !color.isDisposed() ) { color.dispose(); } }
/** * Create a new managed color by using the Red Green & Blue values. * * @param display * @param rgb */ public ManagedColor( Display display, RGB rgb ) { this.color = new Color( display, rgb ); this.systemColor = false; }
/** * Create a new managed font by using fontdata * * @param display * the display to use * @param fontData * The fontdata to create the font with. */ public ManagedFont( Display display, FontData fontData ) { this.font = new Font( display, fontData ); this.systemFont = false; }
public void dispose() { gc.dispose(); if ( transform != null && transform.isDisposed() == false ) { transform.dispose(); } for ( Color color : colors ) { color.dispose(); } for ( Font font : fonts ) { font.dispose(); } }
private Rectangle getUpSize( GC gc ) { Point p = gc.textExtent( STRING_UP ); return new Rectangle( size_not.x + size_not.width + 40, size_not.y, p.x + 20, size_not.height ); }
public void setTransform( float translationX, float translationY, int shadowsize, float magnification ) { if ( transform != null ) { // dispose of previous to prevent leaking of handles transform.dispose(); } transform = new Transform( gc.getDevice() ); transform.translate( translationX + shadowsize * magnification, translationY + shadowsize * magnification ); transform.scale( magnification, magnification ); gc.setTransform( transform ); currentMagnification = magnification; }
void disposeColors() { for ( int i = 0; i < colors.length; i++ ) { colors[i].dispose(); } }
private void disposeColors( Collection<Color> colors ) { for ( Color color : colors ) { color.dispose(); } }