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


Java Graphics.pushState方法代码示例

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


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

示例1: paintFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintFigure(Graphics graphics) {
	super.paintFigure(graphics);
	graphics.pushState();
	if(axis.isShowMajorGrid()){
		graphics.setLineStyle(axis.isDashGridLine()? SWTConstants.LINE_DASH : SWTConstants.LINE_SOLID);
		graphics.setForegroundColor(axis.getMajorGridColor());
		graphics.setLineWidth(1);
		for(int pos: axis.getScaleTickLabels().getTickLabelPositions()){
			if(axis.isHorizontal())
				graphics.drawLine(axis.getBounds().x + pos, bounds.y + bounds.height,
						axis.getBounds().x + pos, bounds.y);
			else
				graphics.drawLine(bounds.x, axis.getBounds().y + axis.getBounds().height - pos, bounds.x + bounds.width,
						axis.getBounds().y + axis.getBounds().height - pos);
		}
	}
	graphics.popState();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:20,代码来源:Grid.java

示例2: 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

示例3: drawShadowLayer

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void drawShadowLayer(Rectangle rectangle, Graphics graphics,
		int offset, Color color) {

	// Save the state of the graphics object
	graphics.pushState();
	graphics.setLineWidth(0);
	graphics.setBackgroundColor(color);
	Rectangle shadowLayer = new Rectangle(rectangle);
	shadowLayer.x += offset;
	shadowLayer.y += offset;

	Dimension cornerDimensions = getCornerDimensions();
	graphics.fillRoundRectangle(shadowLayer, cornerDimensions.width,
			cornerDimensions.height);
	// Restore the start of the graphics object
	graphics.popState();
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:18,代码来源:DropShadowRectangle.java

示例4: 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

示例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: 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

示例7: 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

示例8: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see org.eclipse.draw2d.Ellipse#outlineShape(org.eclipse.draw2d.Graphics)
 */
@Override
protected void outlineShape(Graphics graphics) {
	graphics.pushState();
	graphics.setForegroundColor(getBackgroundColor());
	super.outlineShape(graphics);
	// draw the 'H' letter
	graphics.setForegroundColor(getForegroundColor());
	graphics.setBackgroundColor(getBackgroundColor());
	graphics.drawLine(
			bounds.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), (int) (-bounds.height * HEIGHT_RATIO)), bounds
					.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), (int) (bounds.height * HEIGHT_RATIO)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (bounds.width * WIDTH_RATIO), (int) (-bounds.height * HEIGHT_RATIO)),
			bounds.getCenter().getTranslated((int) (bounds.width * WIDTH_RATIO), (int) (bounds.height * HEIGHT_RATIO)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), 0), bounds.getCenter()
			.getTranslated((int) (bounds.width * WIDTH_RATIO), 0));
	graphics.popState();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:21,代码来源:ShallowHistoryFigure.java

示例9: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void outlineShape(Graphics graphics) {
	graphics.pushState();
	//Outline with foreground
	graphics.setForegroundColor(getBackgroundColor());
	super.outlineShape(graphics);
	// draw the 'H' letter
	graphics.setForegroundColor(getForegroundColor());
	graphics.setBackgroundColor(getBackgroundColor());
	graphics.drawLine(
			bounds.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), (int) (-bounds.height * HEIGHT_RATIO)), bounds
					.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), (int) (bounds.height * HEIGHT_RATIO)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (bounds.width * OFFSET), (int) (-bounds.height * HEIGHT_RATIO)),
			bounds.getCenter().getTranslated((int) (bounds.width * OFFSET), (int) (bounds.height * HEIGHT_RATIO)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (-bounds.width * WIDTH_RATIO), 0), bounds.getCenter()
			.getTranslated((int) (bounds.width * OFFSET), 0));

	// draw the '*' character
	graphics.drawLine(bounds.getCenter().getTranslated((int) (bounds.width * WIDTH_RATIO), (int) (-bounds.height * HEIGHT_RATIO)),
			bounds.getCenter().getTranslated((int) (bounds.width * WIDTH_RATIO), (int) (-bounds.height * OFFSET)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (bounds.width * 0.15), (int) (-bounds.height * 0.20)),
			bounds.getCenter().getTranslated((int) (bounds.width * 0.35), (int) (-bounds.height * 0.10)));
	graphics.drawLine(bounds.getCenter().getTranslated((int) (bounds.width * 0.35), (int) (-bounds.height * 0.20)),
			bounds.getCenter().getTranslated((int) (bounds.width * 0.15), (int) (-bounds.height * 0.10)));
	graphics.popState();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:27,代码来源:DeepHistoryFigure.java

示例10: outlineShape

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
 */
@Override
protected void outlineShape(Graphics graphics) {
	graphics.pushState();
	graphics.setForegroundColor(getForegroundColor());
	graphics.setBackgroundColor(getBackgroundColor());
	Rectangle f = Rectangle.SINGLETON;
	Rectangle r = getBounds();
	f.x = r.x + getLineWidth() / 2;
	f.y = r.y + getLineWidth() / 2;
	f.width = r.width - getLineWidth() - 1;
	f.height = r.height - getLineWidth() - 1;

	PointList pl = new PointList();
	pl.addPoint(f.getTop());
	pl.addPoint(f.getRight());
	pl.addPoint(f.getBottom());
	pl.addPoint(f.getLeft());

	graphics.drawPolygon(pl);
	graphics.popState();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:25,代码来源:ChoiceFigure.java

示例11: drawPolyline

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
	 * Draw polyline with the line style and line width of the trace.
	 * 
 * @param graphics
 * @param pl
 */
private void drawPolyline(Graphics graphics, PointList pl) {
	graphics.pushState();
	graphics.setLineWidth(lineWidth);
	switch(traceType) {
	case SOLID_LINE:
	case STEP_HORIZONTALLY:
	case STEP_VERTICALLY:
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawPolyline(pl);
		break;
	case DASH_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DASH);
		graphics.drawPolyline(pl);
		break;
	default:
		break;
	}
	graphics.popState();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:Trace.java

示例12: drawShadowLayer

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
private void drawShadowLayer(final Rectangle rectangle, final Graphics graphics, final int offset, final Color color) {

        // Save the state of the graphics object
        graphics.pushState();
        graphics.setLineWidth(0);
        graphics.setBackgroundColor(color);
        final Rectangle shadowLayer = new Rectangle(rectangle);
        shadowLayer.x += offset;
        shadowLayer.y += offset;

        final Dimension cornerDimensions = getCornerDimensions();
        graphics.fillRoundRectangle(shadowLayer, cornerDimensions.width, cornerDimensions.height);
        // Restore the start of the graphics object
        graphics.popState();
    }
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:16,代码来源:DropShadowRectangle.java

示例13: paintTitle

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
public void paintTitle(Graphics graphics) {
	if (Utils.isNotEmpty(getText())){
		graphics.pushState();
		Color bgColor = graphics.getBackgroundColor(); 
		graphics.setBackgroundColor(ColorConstants.white);
		int titleHeight = FigureUtilities.getStringExtents(getText(), titleFont).height;
		Rectangle titleRect = getTextHolderRectangle();
		Rectangle imRect = new Rectangle(titleRect.x + getMargin(),
				titleRect.y + getMargin(), titleHeight,	titleHeight);
		graphics.fillArc(imRect, 0, 360);
		
		graphics.setBackgroundColor(bgColor);
		imRect.shrink(4, 4);
		graphics.fillArc(imRect, 0, 360);
		
		graphics.setBackgroundColor(ColorConstants.white);
		graphics.fillPolygon(new int[]{imRect.x + imRect.width / 6,
				imRect.y + imRect.width / 3,
				imRect.x + imRect.width - imRect.width/ 6,
				imRect.y + imRect.width / 3,
				imRect.x + imRect.width/ 2,
				imRect.y + imRect.width});
		
		graphics.setBackgroundColor(ColorConstants.gray);
		graphics.drawLine(titleRect.x + 50, titleRect.y + titleHeight + getMargin() + 1,
				titleRect.right() - 50, titleRect.y + titleHeight + getMargin() + 1);
		graphics.popState();
		titleRect.x += titleHeight + getMargin()*2;
		titleRect.width -= titleHeight + getMargin()*3;
		paintString(graphics, getText(), titleRect);
		
	}
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:35,代码来源:AndroidAlertDialogFigure.java

示例14: paintTitaniumFigure

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void paintTitaniumFigure(Graphics graphics) {
	titleFont = createTitleFont();
	graphics.pushState();
	graphics.setFont(titleFont);
	paintTitle(graphics);
	graphics.popState();
	paintLines(graphics, getLines(), getLinesHolderRectangle());
	Rectangle expRect = getTextHolderRectangle();
	if (explanation != null && explanation.length() > 0){
		int titleHeight = getMargin()*2;
		if (getText() != null && getText().length() > 0){
			titleHeight += FigureUtilities.getStringExtents(getText(), titleFont).height;
		}
		expRect.height -= titleHeight;
		expRect.y += titleHeight;
		paintString(graphics, explanation, expRect);
	}
	if (okButton.getText() != null){
		graphics.setFont(okButton.getFont_());
		Dimension p = FigureUtilities.getStringExtents(okButton.getText(), okButton.getFont_());
		p.expand(20, 4);
		p.width = Math.min(p.width, expRect.width);
		p.height = 40;
		okButton.setBounds(new Rectangle(expRect.getBottomLeft().getTranslated(
				(expRect.width - p.width) / 2, -2 - p.height), p));
		okButton.paint(graphics);
	}
	titleFont.dispose();
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:31,代码来源:AlertDialogFigure.java

示例15: 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


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