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


Java PPaintContext.pushClip方法代码示例

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


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

示例1: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint(PPaintContext paintContext) {
    Graphics2D g2 = paintContext.getGraphics();

    g2.setPaint(getPaint());
    g2.draw(getBoundsReference());
    g2.setFont(CalendarNode.DEFAULT_FONT);

    float y = (float) getY() + CalendarNode.TEXT_Y_OFFSET;
    paintContext.getGraphics().drawString(dayOfMonthString,
            (float) getX() + CalendarNode.TEXT_X_OFFSET, y);

    if (hasWidthFocus && hasHeightFocus) {
        paintContext.pushClip(getBoundsReference());
        for (int i = 0; i < lines.size(); i++) {
            y += 10;
            g2.drawString((String) lines.get(i),
                    (float) getX() + CalendarNode.TEXT_X_OFFSET, y);
        }
        paintContext.popClip(getBoundsReference());
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:DayNode.java

示例2: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint( PPaintContext paintContext ) {
    if ( !clipEnabled ) {
        super.paint( paintContext );
        return;
    }
    Paint p = getPaint();
    if ( p != null ) {
        Graphics2D g2 = paintContext.getGraphics();
        g2.setPaint( p );
        g2.fill( getPathReference() );
    }
    paintContext.pushClip( getPathReference() );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:TogglePClip.java

示例3: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint( PPaintContext paintContext ) {
    if ( clip != null ) {
        Shape origClip = paintContext.getGraphics().getClip();
        Area area = new Area( origClip );
        area.subtract( new Area( clip ) );
        paintContext.pushClip( area );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:ElectronNode.java

示例4: fullPaint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
public void fullPaint( PPaintContext paintContext ) {
    Shape origClip = paintContext.getLocalClip();
    //todo: works under a variety of conditions, not fully tested
    Rectangle rect = new Rectangle( 0, 0, (int) getFullBounds().getWidth(), (int) ( getFullBounds().getHeight() / 2 - getOffset().getY() + getDistanceFromParentOriginToOscillatorY() - image.getFullBounds().getHeight() / 2 ) );
    localToParent( rect );
    if ( clip ) {
        paintContext.pushClip( rect );
    }
    super.fullPaint( paintContext );
    if ( clip ) {
        paintContext.popClip( origClip );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:FaucetGraphic.java

示例5: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint( PPaintContext paintContext ) {

        Graphics2D g2 = paintContext.getGraphics();

        if ( _renderingHints != null ) {
            g2.setRenderingHints( _renderingHints );
        }

        // Clip to the data area.
        // Do NOT call g2.setClip, or really bad things happen
        // with drawing order on Macintosh (and possibly other platforms).
        paintContext.pushClip( _dataArea );

        // Render each of the plot's datasets, in the proper order...
        int numberOfDatasets = _plot.getDatasetCount();
        DatasetRenderingOrder renderingOrder = _plot.getDatasetRenderingOrder();
        if ( renderingOrder == DatasetRenderingOrder.FORWARD ) {
            for ( int i = 0; i < numberOfDatasets; i++ ) {
                _plot.render( g2, _dataArea, i, null, null );
            }
        }
        else { /* DatasetRenderingOrder.REVERSE */
            for ( int i = numberOfDatasets - 1; i >= 0; i-- ) {
                _plot.render( g2, _dataArea, i, null, null );
            }
        }

        // restore the clip
        paintContext.popClip( null );

        // optionally stroke the data area -- do this after restoring the clip
        if ( _dataAreaStroked ) {
            g2.setStroke( _plot.getOutlineStroke() );
            g2.setPaint( _plot.getOutlinePaint() );
            g2.draw( _dataArea );
        }
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:38,代码来源:XYPlotNode.java

示例6: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
/**
 * Paint's this node as a solid rectangle if paint is provided, clipping
 * appropriately.
 * 
 * @param paintContext context into which this node will be painted
 */
protected void paint(final PPaintContext paintContext) {
    final Paint p = getPaint();
    if (p != null) {
        final Graphics2D g2 = paintContext.getGraphics();
        g2.setPaint(p);
        g2.fill(getPathReference());
    }
    paintContext.pushClip(getPathReference());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:PClip.java

示例7: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
/**
 * Paint this camera and then paint this camera's view through its view
 * transform.
 * 
 * @param paintContext context in which painting occurs
 */
protected void paint(final PPaintContext paintContext) {
    super.paint(paintContext);

    paintContext.pushClip(getBoundsReference());
    paintContext.pushTransform(viewTransform);

    paintCameraView(paintContext);
    paintDebugInfo(paintContext);

    paintContext.popTransform(viewTransform);
    paintContext.popClip(getBoundsReference());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:PCamera.java

示例8: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint( PPaintContext paintContext ) {
    Shape origClip = paintContext.getGraphics().getClip();
    Area area = new Area( origClip );
    area.subtract( new Area( totalBulbComponentNode.getClipShape( this ) ) );
    paintContext.pushClip( area );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:FilamentNode.java

示例9: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
protected void paint( PPaintContext paintContext ) {
    GeneralPath lensPath = _lensNode.getPathReference();
    paintContext.pushClip( lensPath );
    super.paint( paintContext );
    paintContext.popClip( lensPath );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:BSMagnifyingGlass.java

示例10: paint

import edu.umd.cs.piccolo.util.PPaintContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * <p>
 * The HTML text is painted last, so it will appear on top of any child
 * nodes.
 * </p>
 */
protected void paint(final PPaintContext paintContext) {
    super.paint(paintContext);
    paintContext.pushClip(getBounds());
    final Graphics2D g2 = paintContext.getGraphics();
    htmlView.paint(g2, getBounds().getBounds());
    paintContext.popClip(getBounds());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:PHtmlView.java


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