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


Java Graphics.clipRect方法代码示例

本文整理汇总了Java中org.eclipse.draw2d.Graphics.clipRect方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.clipRect方法的具体用法?Java Graphics.clipRect怎么用?Java Graphics.clipRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.draw2d.Graphics的用法示例。


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

示例1: printPages

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void printPages() {
    final Graphics graphics = getFreshPrinterGraphics();
    final IFigure figure = getPrintSource();
    setupPrinterGraphicsFor(graphics, figure);
    final Rectangle bounds = figure.getBounds();
    int x = bounds.x, y = bounds.y;
    final Rectangle clipRect = new Rectangle();
    while (y < bounds.y + bounds.height) {
        while (x < bounds.x + bounds.width) {
            graphics.pushState();
            getPrinter().startPage();
            graphics.translate(-x, -y);
            graphics.getClip(clipRect);
            clipRect.setLocation(x, y);
            graphics.clipRect(clipRect);
            figure.paint(graphics);
            getPrinter().endPage();
            graphics.popState();
            x += clipRect.width;
        }
        x = bounds.x;
        y += clipRect.height;
    }
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:29,代码来源:PrintERDiagramOperation.java

示例2: printPages

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void printPages() {
	Graphics graphics = getFreshPrinterGraphics();
	IFigure figure = getPrintSource();
	setupPrinterGraphicsFor(graphics, figure);
	Rectangle bounds = figure.getBounds();
	int x = bounds.x, y = bounds.y;
	Rectangle clipRect = new Rectangle();
	while (y < bounds.y + bounds.height) {
		while (x < bounds.x + bounds.width) {
			graphics.pushState();
			getPrinter().startPage();
			graphics.translate(-x, -y);
			graphics.getClip(clipRect);
			clipRect.setLocation(x, y);
			graphics.clipRect(clipRect);
			figure.paint(graphics);
			getPrinter().endPage();
			graphics.popState();
			x += clipRect.width;
		}
		x = bounds.x;
		y += clipRect.height;
	}
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:29,代码来源:PrintERDiagramOperation.java

示例3: paintHasImage

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintHasImage(Graphics graphics) {
	if (hasImage != null){
		Rectangle clientArea = getClientArea();
		clientArea.setLocation(getLocation());
		graphics.clipRect(clientArea);
		
		int dy = (clientArea.height - hasImageDimension.height) /2;
		Rectangle dest = new Rectangle(
				new Point(clientArea.right() - hasImageDimension.width - 10,
				clientArea.y + dy),
				hasImageDimension
				);
		
		Rectangle src = new Rectangle(0, 0,
				hasImage.getImageData().width, hasImage.getImageData().height);
		graphics.drawImage(hasImage, src, dest);
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:19,代码来源:TableViewRowFigure.java

示例4: paintRightImage

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintRightImage(Graphics graphics) {
	if (rightImage != null){
		Rectangle clientArea = getClientArea();
		clientArea.setLocation(getLocation());
		graphics.clipRect(clientArea);
		
		int dy = (clientArea.height - rightImageDimension.height) /2;
		Rectangle dest = new Rectangle(
				new Point(clientArea.right() - rightImageDimension.width - 10,
				clientArea.y + dy),
				rightImageDimension
				);
		
		Rectangle src = new Rectangle(0, 0,
				rightImage.getImageData().width, rightImage.getImageData().height);
		graphics.drawImage(rightImage, src, dest);
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:19,代码来源:PickerRowFigure.java

示例5: paintMessage

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintMessage(Graphics graphics, Rectangle parentRect) {
	String message = Utils.getString(this.message, "");
	List<String> text = SWTWordWrap.wrap(message, resolution.width - 24, graphics.getFont());
	if (text != null && text.size() > 0){
		int oneLineHeight = getMargin()
			+ FigureUtilities.getStringExtents("X", graphics.getFont()).height;
		graphics.pushState();
		graphics.clipRect(parentRect);

		int y = parentRect.y;
		for (int i = 0; y < parentRect.bottom() && i < text.size(); i++) {
			Rectangle lineRect = new Rectangle(parentRect.x, y, parentRect.width,
					oneLineHeight + getMargin());
			Drawer.drawString(graphics, text.get(i), lineRect, Alignments.left, Alignments.top, getMargin());
			y += oneLineHeight;
		}
		graphics.popState();
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:20,代码来源:EmailDialogFigure.java

示例6: paint

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
public void paint(IFigure figure, Graphics graphics, Insets insets) {
    if (!is3D()) {
        return;
    }
    graphics.setBackgroundColor(SHADOW_COLOR);
    Rectangle rec = getProportionalBounds().getTranslated(SHADOW_SIZE, SHADOW_SIZE);
    graphics.pushState();
    graphics.clipRect(rec);
    // graphics.setClip(new Rectangle(rec.x, rec.y + rec.height -
    // getShift(), rec.width, getShift()));
    fillShape(graphics, rec);
    graphics.popState();
    // graphics.setClip(new Rectangle(rec.x + rec.width - getShift(),
    // rec.y, getShift(), rec.height));
    // fillShape(graphics, rec);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:17,代码来源:ShadowShape.java

示例7: paintChildren

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * Override the original paintChildren to avoid to pain elements 
 * that are marked as not visible inside the model
 */
protected void paintChildren(Graphics graphics) {
	for (int i = 0; i < getChildren().size(); i++) {
		IFigure child = (IFigure) getChildren().get(i);
		if (child.isVisible() && isFigurevisible(child)) {
			// determine clipping areas for child
			Rectangle[] clipping = null;
			if (getClippingStrategy() != null) {
				clipping = getClippingStrategy().getClip(child);
			} else {
				// default clipping behavior is to clip at bounds
				clipping = new Rectangle[] { child.getBounds() };
			}
			// child may now paint inside the clipping areas
			for (int j = 0; j < clipping.length; j++) {
				if (clipping[j].intersects(graphics.getClip(Rectangle.SINGLETON))) {
					graphics.clipRect(clipping[j]);
					child.paint(graphics);
					graphics.restoreState();
				}
			}
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:28,代码来源:ContainerPageFigure.java

示例8: paintClientArea

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * No ScaledGraphics needed here, only setScale() on the passed graphics. Graphics state is preserved.
 * 
 * @param graphics
 *          the graphics
 * @see org.eclipse.draw2d.Figure#paintClientArea(org.eclipse.draw2d.Graphics)
 */
protected void paintClientArea(Graphics graphics) {
	if (getChildren().isEmpty())
		return;
	if (!(graphics instanceof J2DGraphics)) {
		super.paintClientArea(graphics);
	} else {
		double scale = getScale();
		if (Double.compare(scale, 1.0) == 0) {
			// Hopefully this will have the same effet
			// on the inherited code!
			super.paintClientArea(graphics);
		} else {
			boolean optimizeClip = getBorder() == null || getBorder().isOpaque();
			if (!optimizeClip)
				graphics.clipRect(getBounds().getCropped(getInsets()));
			graphics.pushState();
			graphics.scale(scale);
			paintChildren(graphics);
			graphics.popState();
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:30,代码来源:J2DScalableFreeformLayeredPane.java

示例9: printPages

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void printPages() {
    final Graphics graphics = getFreshPrinterGraphics();
    final IFigure figure = getPrintSource();
    setupPrinterGraphicsFor(graphics, figure);
    final Rectangle bounds = figure.getBounds();
    int x = bounds.x, y = bounds.y;
    final Rectangle clipRect = new Rectangle();
    while (y < bounds.y + bounds.height) {
        while (x < bounds.x + bounds.width) {
            graphics.pushState();
            getPrinter().startPage();
            graphics.translate(-x, -y);
            graphics.getClip(clipRect);
            clipRect.setLocation(x, y);
            graphics.clipRect(clipRect);
            figure.paint(graphics);
            getPrinter().endPage();
            graphics.popState();
            x += clipRect.width;
        }
        x = bounds.x;
        y += clipRect.height;
    }
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:26,代码来源:PrintERDiagramOperation.java

示例10: drawString

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
public static void drawString(Graphics graphics, String text, Rectangle parentRect,
		Alignments hAlign, Alignments vAlign, int textMargin) {
	if (text != null && text.length() > 0){
		graphics.pushState();
		Dimension textSize = FigureUtilities.getStringExtents(text, graphics.getFont());
		Point textLocation = getTextLocation(parentRect,
				textSize, hAlign, vAlign, textMargin);
		graphics.clipRect(parentRect);
		graphics.drawString(text, textLocation);
		graphics.popState();
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:13,代码来源:Drawer.java

示例11: paintClientArea

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintClientArea(Graphics graphics) {
	if (getChildren().isEmpty())
		return;

	graphics.translate(getBounds().x + getInsets().left, getBounds().y
			+ getInsets().top);

	graphics.clipRect(getFullArea());
	graphics.pushState();
	paintChildren(graphics);
	graphics.popState();
	graphics.restoreState();
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:14,代码来源:TableViewFigure.java

示例12: paintChildren

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * Override the original paintChildren to avoid to pain elements 
 * that are marked as not visible inside the model
 */
protected void paintChildren(Graphics graphics) {
	//if (!isMainEditor()) return;
		
	for (int i = 0; i < getChildren().size(); i++) {
		IFigure child = (IFigure) getChildren().get(i);
		boolean modelVisible = true;
		if (child instanceof FrameFigure){
			ANode model = ((FrameFigure)child).getModel();
			if (model != null) {
				modelVisible = model.isVisible();
				child.setVisible(modelVisible);
			}
		}
		if (child.isVisible() && modelVisible && isFigurevisible(child)) {
			// determine clipping areas for child
			Rectangle[] clipping = null;
			if (getClippingStrategy() != null) {
				clipping = getClippingStrategy().getClip(child);
			} else {
				// default clipping behavior is to clip at bounds
				clipping = new Rectangle[] { child.getBounds() };
			}
			// child may now paint inside the clipping areas
			for (int j = 0; j < clipping.length; j++) {
				if (clipping[j].intersects(graphics.getClip(Rectangle.SINGLETON))) {
					graphics.clipRect(clipping[j]);
					child.paint(graphics);
					graphics.restoreState();
				}
			}
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:38,代码来源:ReportPageFigure.java

示例13: paintChildren

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintChildren(Graphics graphics) {
	graphics.clipRect(getClientArea(new Rectangle()));
	super.paintChildren(graphics);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:6,代码来源:MobileScreenFigure.java

示例14: paintChildren

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
protected void paintChildren(Graphics graphics) {
	graphics.clipRect(getWindowRect());
	super.paintChildren(graphics);
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:5,代码来源:ScreenFigure.java


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