本文整理匯總了Java中org.eclipse.swt.graphics.Image.dispose方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.dispose方法的具體用法?Java Image.dispose怎麽用?Java Image.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.graphics.Image
的用法示例。
在下文中一共展示了Image.dispose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawShadowImage
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
public static void drawShadowImage(GC gc, Image image, int x, int y,
int alpha) {
Display display = Display.getCurrent();
Point imageSize = new Point(image.getBounds().width,
image.getBounds().height);
//
ImageData imgData = new ImageData(imageSize.x, imageSize.y, 24,
new PaletteData(255, 255, 255));
imgData.alpha = alpha;
Image img = new Image(display, imgData);
GC imgGC = new GC(img);
imgGC.drawImage(image, 0, 0);
gc.drawImage(img, x, y);
imgGC.dispose();
img.dispose();
}
示例2: dispose
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
@Override
public void dispose(TableCell cell) {
// only dispose of image here, this method is reused in other methods
Graphic graphic = cell.getGraphic();
if (graphic instanceof UISWTGraphic)
{
final Image img = ((UISWTGraphic) graphic).getImage();
if (img != null && !img.isDisposed()){
img.dispose();
// see http://forum.vuze.com/thread.jspa?threadID=117243
// could it be that it isn't being marked as disposed after disposal and
// being double-disposed?
((UISWTGraphic) graphic).setImage( null );
}
}
}
示例3: resizeImage
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
private Image resizeImage(Image image, int width, int height) {
Image scaled = new Image(Display.getDefault(), width, height);
GC gc = new GC(scaled);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);
gc.drawImage(image, 0, 0,image.getBounds().width, image.getBounds().height, 0, 0, width, height);
gc.dispose();
image.dispose();
return scaled;
}
示例4: dispose
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
public void dispose() {
for (Image cachedImage : imagesCache.values()) {
cachedImage.dispose();
}
eLabelProvider.dispose();
}
示例5: dispose
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
@Override
public void dispose() {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
breakpointEnabled.dispose();
breakpointDisabled.dispose();
for (Image cachedImage : imagesCache.values()) {
cachedImage.dispose();
}
super.dispose();
}
示例6: clearCoverArt
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
private void clearCoverArt() {
Image i = imageLabel.getImage();
if (i != null && i != cover) {
imageLabel.setImage(null);
i.dispose();
}
imageLabel.setImage(cover);
}
示例7: dispose
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
@Override
public void dispose() {
super.dispose();
for (Image image : icons.values()) {
if (image != null)
image.dispose();
}
icons.clear();
if (handCursor != null)
handCursor.dispose();
}
示例8: disposeImages
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
private void disposeImages() {
for (Image beanIcon : icons.values()) {
if (beanIcon != null)
beanIcon.dispose();
}
icons.clear();
}
示例9: saveEditorContentsAsImage
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
private static void saveEditorContentsAsImage(IEditorPart editorPart, GraphicalViewer viewer, String saveFilePath, int format) {
ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer.getEditPartRegistry().get(LayerManager.ID);
IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);// rootEditPart.getFigure();
Rectangle rootFigureBounds = rootFigure.getBounds();
Control figureCanvas = viewer.getControl();
GC figureCanvasGC = new GC(figureCanvas);
Image img = new Image(null, rootFigureBounds.width, rootFigureBounds.height);
GC imageGC = new GC(img);
imageGC.setBackground(figureCanvasGC.getBackground());
imageGC.setForeground(figureCanvasGC.getForeground());
imageGC.setFont(figureCanvasGC.getFont());
imageGC.setLineStyle(figureCanvasGC.getLineStyle());
imageGC.setLineWidth(figureCanvasGC.getLineWidth());
imageGC.setXORMode(figureCanvasGC.getXORMode());
Graphics imgGraphics = new SWTGraphics(imageGC);
rootFigure.paint(imgGraphics);
ImageData[] imgData = new ImageData[1];
imgData[0] = img.getImageData();
ImageLoader imgLoader = new ImageLoader();
imgLoader.data = imgData;
imgLoader.save(saveFilePath, format);
figureCanvasGC.dispose();
imageGC.dispose();
img.dispose();
}
示例10: paintFigure
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
@Override
protected void paintFigure(Graphics g) {
Rectangle r = getBounds();
if(valid) {
ImageData data = getImageData();
Image img = new Image(Display.getDefault(), data);
g.drawImage(img, 0, 0, width, height, r.x+1, r.y+1, width, height);
img.dispose();
}
else {
g.drawText("Invalid matrix", r.getLocation().translate(5, 15));
}
}
示例11: saveToImageFile
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
void saveToImageFile() {
Dimension size = rootFig.getPreferredSize();
Image image = new Image(Display.getDefault(), size.width, size.height);
GC gc = new GC(image);
SWTGraphics graphics = new SWTGraphics(gc);
rootFig.paint(graphics);
Clipboard clipboard = new Clipboard(Display.getDefault());
clipboard.setContents(new Object[]{image.getImageData()}, new Transfer[]{ ImageTransfer.getInstance()});
image.dispose();
gc.dispose();
}
示例12: dispose
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
/**
* Dispose of resources.
*/
public void dispose() {
for (int i=0; i<imageNames.length; i++) {
String imageName = imageNames[i];
Image image = (Image) images.get(imageName);
image.dispose();
images.remove(imageName);
}
}
示例13: resize
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
private Image resize(Image image, int width, int height) {
Image scaled = new Image(display, width, height);
GC gc = new GC(scaled);
gc.setAntialias(SWT.ON);
gc.setInterpolation(SWT.HIGH);
gc.drawImage(image, 0, 0, image.getBounds().width, image.getBounds().height,
0, 0, width, height);
gc.dispose();
image.dispose();
return scaled;
}
示例14: close
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
public boolean close() {
// dispose all images
for (int i = 0; i < images.size(); ++i) {
Image image = (Image) images.get(i);
image.dispose();
}
return super.close();
}
示例15: stop
import org.eclipse.swt.graphics.Image; //導入方法依賴的package包/類
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
for(Image img:imageMap.values()){
img.dispose();
}
imageMap.clear();
}