当前位置: 首页>>代码示例>>Java>>正文


Java ImageTransfer类代码示例

本文整理汇总了Java中org.eclipse.swt.dnd.ImageTransfer的典型用法代码示例。如果您正苦于以下问题:Java ImageTransfer类的具体用法?Java ImageTransfer怎么用?Java ImageTransfer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageTransfer类属于org.eclipse.swt.dnd包,在下文中一共展示了ImageTransfer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTransferType

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
Transfer getTransferType(String mime) {
    if (mime.equals("text/plain")) {
      return TextTransfer.getInstance();
    }
    if (mime.equals("text/rtf")) {
      return RTFTransfer.getInstance();
    }
    if (mime.equals("text/html")) {
      return HTMLTransfer.getInstance();
    }
    if (mime.equals("text/uri-list")) {
      return URLTransfer.getInstance();
    }
    if (mime.equals("application/x-java-rawimage")) {
      return ImageTransfer.getInstance();
    }
    if (mime.equals("application/x-java-file-list") || mime.equals("java.file-list")) {
        return FileTransfer.getInstance();
    }
    return getCustomTransfer(mime);
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:22,代码来源:OldFXCanvas.java

示例2: getMime

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
String getMime(Transfer transfer) {
    if (transfer.equals(TextTransfer.getInstance())) {
      return "text/plain";
    }
    if (transfer.equals(RTFTransfer.getInstance())) {
      return "text/rtf";
    } ;
    if (transfer.equals( HTMLTransfer.getInstance())) {
      return "text/html";
    }
    if (transfer.equals(URLTransfer.getInstance())) {
      return "text/uri-list";
    }
    if (transfer.equals( ImageTransfer.getInstance())) {
      return "application/x-java-rawimage";
    }
    if (transfer.equals(FileTransfer.getInstance())) {
      return "application/x-java-file-list";
    }
    if (transfer instanceof CustomTransfer) {
      return ((CustomTransfer)transfer).getMime();
    }
    return null;
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:25,代码来源:OldFXCanvas.java

示例3: setContents

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
/**
 * Sets the contents of the clipboard. This will erase the previous contents of this as well as the system clipboard. The provided contents will not be
 * garbage-collected until some other contents are set using this method.
 * 
 * @param contents
 *            the new contents
 */
public void setContents(Object contents, ImageData image) {
    org.eclipse.swt.dnd.Clipboard cb = new org.eclipse.swt.dnd.Clipboard(null);
    String contentString = null;

    // TODO: Improve it so that it supports a better textual representation, if we feel that is important.
    if (contents != null && contents instanceof Object[]) {
        Object[] arr = (Object[]) contents;
        if (arr.length == 4 && arr[2] != null) {
            contentString = arr[2].toString();
        } else
            contentString = contents.toString();
    }

    // if have text in here, it has higher priority than image in ms word.

    // disabled image transfer until CruiseControl runs on 3.4+
    if (image != null)
        cb.setContents(new Object[] { contents, image }, new Transfer[] { TRANSFER, ImageTransfer.getInstance() });
    else
        cb.setContents(new Object[] { contents, contentString }, new Transfer[] { TRANSFER, TextTransfer.getInstance() });
    cb.dispose();
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:30,代码来源:Clipboard.java

示例4: saveToImageFile

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的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();
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:12,代码来源:RuntimeViewer.java

示例5: copy

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
/**
 * Copies the content of {@link #mImageLabel} to the clipboard.
 */
private void copy() {
    mClipboard.setContents(
            new Object[] {
                    mImageLabel.getImage().getImageData()
            }, new Transfer[] {
                    ImageTransfer.getInstance()
            });
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:12,代码来源:ScreenShotDialog.java

示例6: run

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
public void run(IAction action) {
    Image image = view.getViewer().getImage();
    ImageData imageData = image.getImageData();
    ImageTransfer imageTransfer = ImageTransfer.getInstance();
    Clipboard clipboard = new Clipboard(Display.getCurrent());
    clipboard.setContents(new Object[] { imageData }, new Transfer[] { imageTransfer });
}
 
开发者ID:abstratt,项目名称:eclipsegraphviz,代码行数:8,代码来源:CopyToClipboardAction.java

示例7: getTransferType

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
Transfer getTransferType(String mime) {
    if (mime.equals("text/plain")) return TextTransfer.getInstance();
    if (mime.equals("text/rtf")) return RTFTransfer.getInstance();
    if (mime.equals("text/html")) return HTMLTransfer.getInstance();
    if (mime.equals("text/uri-list")) return URLTransfer.getInstance();
    if (mime.equals("application/x-java-rawimage")) return ImageTransfer.getInstance();
    if (mime.equals("application/x-java-file-list") || mime.equals("java.file-list")) {
        return FileTransfer.getInstance();
    }
    return getCustomTransfer(mime);
}
 
开发者ID:SkyLandTW,项目名称:JXTN,代码行数:12,代码来源:FXCanvas.java

示例8: getMime

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
String getMime(Transfer transfer) {
    if (transfer.equals(TextTransfer.getInstance())) return "text/plain";
    if (transfer.equals(RTFTransfer.getInstance())) return "text/rtf"; ;
    if (transfer.equals( HTMLTransfer.getInstance())) return "text/html";
    if (transfer.equals(URLTransfer.getInstance())) return "text/uri-list";
    if (transfer.equals( ImageTransfer.getInstance())) return "application/x-java-rawimage";
    if (transfer.equals(FileTransfer.getInstance())) return "application/x-java-file-list";
    if (transfer instanceof CustomTransfer) return ((CustomTransfer)transfer).getMime();
    return null;
}
 
开发者ID:SkyLandTW,项目名称:JXTN,代码行数:11,代码来源:FXCanvas.java

示例9: addDropSupport

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
/** This method adds drop (drag & drop) support to a given SWT widget 
 * @param widget an SWT widget such as a label or a composite */
private void addDropSupport(final Widget widget) {
	int ops = DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
	final FileTransfer fTransfer = FileTransfer.getInstance();
	final ImageTransfer iTransfer = ImageTransfer.getInstance();
	Transfer[] transfers = new Transfer[] { fTransfer, iTransfer };
	

	DropTarget target = new DropTarget((Control) widget, ops);
	target.setTransfer(transfers);
	target.addDropListener(this);
}
 
开发者ID:jeromewagener,项目名称:Sammelbox,代码行数:14,代码来源:ImageDropAndManagementComposite.java

示例10: copyTransformationImage

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
public void copyTransformationImage( TransMeta transMeta ) {
  TransGraph transGraph = delegates.trans.findTransGraphOfTransformation( transMeta );
  if ( transGraph == null ) {
    return;
  }

  Clipboard clipboard = GUIResource.getInstance().getNewClipboard();

  Point area = transMeta.getMaximum();
  Image image = transGraph.getTransformationImage( Display.getCurrent(), area.x, area.y, 1.0f );
  clipboard.setContents(
    new Object[] { image.getImageData() }, new Transfer[] { ImageTransfer.getInstance() } );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:Spoon.java

示例11: copyToClipBoard

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
void copyToClipBoard() {
	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();
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:12,代码来源:RuntimeViewer.java

示例12: copyToClipBoard

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
void copyToClipBoard() {
	Composite item = viewer;
	Point p = viewer.computeSize(SWT.DEFAULT, SWT.DEFAULT);

	Rectangle size = item.getClientArea();

	System.out.println(p +  "    " + size);
	//			compositeViewer.setBackground(Constants.HIGHLIGHT_COLOR);
	GC gc = new GC(item);
	//			Rectangle clipping2 = gc.getClipping();
	//			Image img = new Image(Display.getDefault(), size.width, size.height);
	//			gc.copyArea(img, 0, 0);
	//			ImageData imageData = img.getImageData();

	RGB[] rgb = new RGB[256];
	// build grey scale palette: 256 different grey values are generated. 
	for (int i = 0; i < 256; i++) {
		rgb[i] = new RGB(i, i, i);
	}

	// Construct a new indexed palette given an array of RGB values.
	PaletteData palette = new PaletteData(rgb);
	Image img2 = new Image(Display.getDefault(), new ImageData(size.width, size.height, 8, palette));
	//			gc.setClipping(0, 0, p.x, p.y);
	gc.copyArea(img2, 0, 0);
	Shell popup = new Shell(Display.getDefault());
	popup.setText("Image");
	popup.setBounds(50, 50, 200, 200);
	Canvas canvas = new Canvas(popup, SWT.NONE);
	canvas.setBounds(img2.getBounds());
	canvas.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent e) {
			e.gc.drawImage(img2, 0, 0);
		}
	});
	popup.open();
	Clipboard clipboard = new Clipboard(Display.getDefault());
	clipboard.setContents(new Object[]{img2.getImageData()}, new Transfer[]{ ImageTransfer.getInstance()}); 
	img2.dispose();
	gc.dispose();
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:42,代码来源:FrameView.java

示例13: copy

import org.eclipse.swt.dnd.ImageTransfer; //导入依赖的package包/类
/**
 * Copies the content of {@link #mImageLabel} to the clipboard.
 */
private void copy() {
    mClipboard.setContents(new Object[] { mImageLabel.getImage().getImageData() },
            new Transfer[] { ImageTransfer.getInstance() });
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:8,代码来源:ScreenShotDialog.java


注:本文中的org.eclipse.swt.dnd.ImageTransfer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。