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


Java PathConsumer2D.moveTo方法代码示例

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


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

示例1: feedConsumer

import sun.awt.geom.PathConsumer2D; //导入方法依赖的package包/类
/**
 * Utility method to feed a {@link PathConsumer2D} object from a
 * given {@link PathIterator}.
 * This method deals with the details of running the iterator and
 * feeding the consumer a segment at a time.
 */
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer) {
    float coords[] = new float[6];
    while (!pi.isDone()) {
        switch (pi.currentSegment(coords)) {
        case PathIterator.SEG_MOVETO:
            consumer.moveTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_LINETO:
            consumer.lineTo(coords[0], coords[1]);
            break;
        case PathIterator.SEG_QUADTO:
            consumer.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
            break;
        case PathIterator.SEG_CUBICTO:
            consumer.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
            break;
        case PathIterator.SEG_CLOSE:
            consumer.closePath();
            break;
        }
        pi.next();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:RenderingEngine.java

示例2: pathTo

import sun.awt.geom.PathConsumer2D; //导入方法依赖的package包/类
private static void pathTo(final RendererContext rdrCtx, final PathIterator pi,
                           final PathConsumer2D pc2d)
{
    // mark context as DIRTY:
    rdrCtx.dirty = true;

    final float[] coords = rdrCtx.float6;

    for (; !pi.isDone(); pi.next()) {
        switch (pi.currentSegment(coords)) {
            case PathIterator.SEG_MOVETO:
                pc2d.moveTo(coords[0], coords[1]);
                continue;
            case PathIterator.SEG_LINETO:
                pc2d.lineTo(coords[0], coords[1]);
                continue;
            case PathIterator.SEG_QUADTO:
                pc2d.quadTo(coords[0], coords[1],
                            coords[2], coords[3]);
                continue;
            case PathIterator.SEG_CUBICTO:
                pc2d.curveTo(coords[0], coords[1],
                             coords[2], coords[3],
                             coords[4], coords[5]);
                continue;
            case PathIterator.SEG_CLOSE:
                pc2d.closePath();
                continue;
            default:
        }
    }
    pc2d.pathDone();

    // mark context as CLEAN:
    rdrCtx.dirty = false;
}
 
开发者ID:bourgesl,项目名称:marlin-renderer,代码行数:37,代码来源:MarlinRenderingEngine.java


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