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


Java Graphics.scale方法代码示例

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


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

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

示例2: setupPrinterGraphicsFor

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void setupPrinterGraphicsFor(final Graphics graphics, final IFigure figure) {
    final ERDiagram diagram = getDiagram();
    final PageSetting pageSetting = diagram.getPageSetting();

    final double dpiScale = (double) getPrinter().getDPI().x / Display.getCurrent().getDPI().x * pageSetting.getScale() / 100;

    final Rectangle printRegion = getPrintRegion();
    // put the print region in display coordinates
    printRegion.width /= dpiScale;
    printRegion.height /= dpiScale;

    final Rectangle bounds = figure.getBounds();
    final double xScale = (double) printRegion.width / bounds.width;
    final double yScale = (double) printRegion.height / bounds.height;
    switch (getPrintMode()) {
        case FIT_PAGE:
            graphics.scale(Math.min(xScale, yScale) * dpiScale);
            break;
        case FIT_WIDTH:
            graphics.scale(xScale * dpiScale);
            break;
        case FIT_HEIGHT:
            graphics.scale(yScale * dpiScale);
            break;
        default:
            graphics.scale(dpiScale);
    }
    graphics.setForegroundColor(figure.getForegroundColor());
    graphics.setBackgroundColor(figure.getBackgroundColor());
    graphics.setFont(figure.getFont());
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:36,代码来源:PrintERDiagramOperation.java

示例3: setupPrinterGraphicsFor

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void setupPrinterGraphicsFor(Graphics graphics, IFigure figure) {
	ERDiagram diagram = this.getDiagram();
	PageSetting pageSetting = diagram.getPageSetting();

	double dpiScale = (double) getPrinter().getDPI().x
			/ Display.getCurrent().getDPI().x * pageSetting.getScale()
			/ 100;

	Rectangle printRegion = getPrintRegion();
	// put the print region in display coordinates
	printRegion.width /= dpiScale;
	printRegion.height /= dpiScale;

	Rectangle bounds = figure.getBounds();
	double xScale = (double) printRegion.width / bounds.width;
	double yScale = (double) printRegion.height / bounds.height;
	switch (getPrintMode()) {
	case FIT_PAGE:
		graphics.scale(Math.min(xScale, yScale) * dpiScale);
		break;
	case FIT_WIDTH:
		graphics.scale(xScale * dpiScale);
		break;
	case FIT_HEIGHT:
		graphics.scale(yScale * dpiScale);
		break;
	default:
		graphics.scale(dpiScale);
	}
	graphics.setForegroundColor(figure.getForegroundColor());
	graphics.setBackgroundColor(figure.getBackgroundColor());
	graphics.setFont(figure.getFont());
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:38,代码来源:PrintERDiagramOperation.java

示例4: setupPrinterGraphicsFor

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
/**
     * @see org.eclipse.draw2d.PrintFigureOperation#setupPrinterGraphicsFor(org.eclipse.draw2d.Graphics, org.eclipse.draw2d.IFigure)
     */
    protected void setupPrinterGraphicsFor(Graphics graphics, IFigure figure) {
        double dpiScale = (double)getPrinter().getDPI().x / Display.getCurrent().getDPI().x;
        
        Rectangle printRegion = getPrintRegion();
        // put the print region in display coordinates
        printRegion.width /= dpiScale;
        printRegion.height /= dpiScale;
        
        
//        Rectangle bounds = figure.getBounds();
        double xScale = (double)printRegion.width / previewBounds.width;
        double yScale = (double)printRegion.height / previewBounds.height;
        switch (getPrintMode()) {
            case FIT_PAGE:
                graphics.scale(Math.min(xScale, yScale) * dpiScale);
                break;
            case FIT_WIDTH:
                graphics.scale(xScale * dpiScale);
                break;
            case FIT_HEIGHT:
                graphics.scale(yScale * dpiScale);
                break;
            default:
                graphics.scale(dpiScale);
        }
        graphics.setForegroundColor(figure.getForegroundColor());
        graphics.setBackgroundColor(figure.getBackgroundColor());
        graphics.setFont(figure.getFont());
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:33,代码来源:PrintGraphicalViewerOperation.java

示例5: setupPrinterGraphicsFor

import org.eclipse.draw2d.Graphics; //导入方法依赖的package包/类
@Override
protected void setupPrinterGraphicsFor(Graphics graphics, IFigure figure) {
    final ERDiagram diagram = getDiagram();
    final PageSettings pageSetting = diagram.getPageSetting();

    final double dpiScale = (double) getPrinter().getDPI().x / Display.getCurrent().getDPI().x * pageSetting.getScale() / 100;

    final Rectangle printRegion = getPrintRegion();
    // put the print region in display coordinates
    printRegion.width /= dpiScale;
    printRegion.height /= dpiScale;

    final Rectangle bounds = figure.getBounds();
    final double xScale = (double) printRegion.width / bounds.width;
    final double yScale = (double) printRegion.height / bounds.height;
    switch (getPrintMode()) {
    case FIT_PAGE:
        graphics.scale(Math.min(xScale, yScale) * dpiScale);
        break;
    case FIT_WIDTH:
        graphics.scale(xScale * dpiScale);
        break;
    case FIT_HEIGHT:
        graphics.scale(yScale * dpiScale);
        break;
    default:
        graphics.scale(dpiScale);
    }
    graphics.setForegroundColor(figure.getForegroundColor());
    graphics.setBackgroundColor(figure.getBackgroundColor());
    graphics.setFont(figure.getFont());
}
 
开发者ID:dbflute-session,项目名称:erflute,代码行数:33,代码来源:PrintERDiagramOperation.java


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