本文整理汇总了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();
}