本文整理汇总了Java中java.awt.Stroke.createStrokedShape方法的典型用法代码示例。如果您正苦于以下问题:Java Stroke.createStrokedShape方法的具体用法?Java Stroke.createStrokedShape怎么用?Java Stroke.createStrokedShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Stroke
的用法示例。
在下文中一共展示了Stroke.createStrokedShape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnderlineShape
import java.awt.Stroke; //导入方法依赖的package包/类
Shape getUnderlineShape(float thickness,
float x1,
float x2,
float y) {
Stroke ulStroke = getStroke(thickness);
Line2D line = new Line2D.Float(x1, y + shift, x2, y + shift);
return ulStroke.createStrokedShape(line);
}
示例2: testStrokedShapes
import java.awt.Stroke; //导入方法依赖的package包/类
private static void testStrokedShapes() {
final Stroke stroke = new BasicStroke();
final Path2D.Double path = new Path2D.Double();
Shape s;
// Check filtering NaN values:
path.reset();
path.moveTo(100, NaN);
path.lineTo(NaN, 100);
path.lineTo(NaN, NaN);
path.quadTo(NaN, 100, NaN, 100);
path.quadTo(100, NaN, 100, NaN);
path.quadTo(NaN, NaN, NaN, NaN);
path.curveTo(NaN, 100, NaN, 100, NaN, 100);
path.curveTo(100, NaN, 100, NaN, 100, NaN);
path.curveTo(NaN, NaN, NaN, NaN, NaN, NaN);
path.closePath();
s = stroke.createStrokedShape(path);
checkEmptyPath(s);
// Check filtering +Infinity values:
path.reset();
path.moveTo(100, POSITIVE_INFINITY);
path.lineTo(POSITIVE_INFINITY, 100);
path.lineTo(POSITIVE_INFINITY, POSITIVE_INFINITY);
path.quadTo(POSITIVE_INFINITY, 100,
POSITIVE_INFINITY, 100);
path.quadTo(100, POSITIVE_INFINITY,
100, POSITIVE_INFINITY);
path.quadTo(POSITIVE_INFINITY, POSITIVE_INFINITY,
POSITIVE_INFINITY, POSITIVE_INFINITY);
path.curveTo(POSITIVE_INFINITY, 100,
POSITIVE_INFINITY, 100,
POSITIVE_INFINITY, 100);
path.curveTo(100, POSITIVE_INFINITY,
100, POSITIVE_INFINITY,
100, POSITIVE_INFINITY);
path.curveTo(POSITIVE_INFINITY, POSITIVE_INFINITY,
POSITIVE_INFINITY, POSITIVE_INFINITY,
POSITIVE_INFINITY, POSITIVE_INFINITY);
path.closePath();
s = stroke.createStrokedShape(path);
checkEmptyPath(s);
// Check filtering -Infinity values:
path.reset();
path.moveTo(100, NEGATIVE_INFINITY);
path.lineTo(NEGATIVE_INFINITY, 100);
path.lineTo(NEGATIVE_INFINITY, NEGATIVE_INFINITY);
path.quadTo(NEGATIVE_INFINITY, 100,
NEGATIVE_INFINITY, 100);
path.quadTo(100, NEGATIVE_INFINITY,
100, NEGATIVE_INFINITY);
path.quadTo(NEGATIVE_INFINITY, NEGATIVE_INFINITY,
NEGATIVE_INFINITY, NEGATIVE_INFINITY);
path.curveTo(NEGATIVE_INFINITY, 100,
NEGATIVE_INFINITY, 100,
NEGATIVE_INFINITY, 100);
path.curveTo(100, NEGATIVE_INFINITY,
100, NEGATIVE_INFINITY,
100, NEGATIVE_INFINITY);
path.curveTo(NEGATIVE_INFINITY, NEGATIVE_INFINITY,
NEGATIVE_INFINITY, NEGATIVE_INFINITY,
NEGATIVE_INFINITY, NEGATIVE_INFINITY);
path.closePath();
s = stroke.createStrokedShape(path);
checkEmptyPath(s);
}