當前位置: 首頁>>代碼示例>>Java>>正文


Java IFigure.getBounds方法代碼示例

本文整理匯總了Java中org.eclipse.draw2d.IFigure.getBounds方法的典型用法代碼示例。如果您正苦於以下問題:Java IFigure.getBounds方法的具體用法?Java IFigure.getBounds怎麽用?Java IFigure.getBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.draw2d.IFigure的用法示例。


在下文中一共展示了IFigure.getBounds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveEditorContentsAsImage

import org.eclipse.draw2d.IFigure; //導入方法依賴的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();
	}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:33,代碼來源:ImageSaveUtil.java

示例2: paint

import org.eclipse.draw2d.IFigure; //導入方法依賴的package包/類
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	graphics.setForegroundColor(PandionJConstants.Colors.ROLE_ANNOTATIONS);
	Rectangle r = figure.getBounds();
	int startY = direction == Direction.FORWARD ? 2 : 1 + (PandionJConstants.POSITION_WIDTH/3)*2;
	Point from = r.getLocation().getTranslated(r.width-6, startY);
	Point to = from.getTranslated(0, PandionJConstants.POSITION_WIDTH / 4);
	if(direction == Direction.FORWARD) {
		Point t = from;
		from = to;
		to = t;
	}
	drawArrow(graphics, from, to); 
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:15,代碼來源:ValueFigure.java


注:本文中的org.eclipse.draw2d.IFigure.getBounds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。