当前位置: 首页>>代码示例>>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;未经允许,请勿转载。