本文整理匯總了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);
}