本文整理汇总了Java中sun.awt.geom.PathConsumer2D.closePath方法的典型用法代码示例。如果您正苦于以下问题:Java PathConsumer2D.closePath方法的具体用法?Java PathConsumer2D.closePath怎么用?Java PathConsumer2D.closePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.geom.PathConsumer2D
的用法示例。
在下文中一共展示了PathConsumer2D.closePath方法的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();
}
}
示例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;
}