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


Java Stroke.createStrokedShape方法代码示例

本文整理汇总了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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Underline.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:79,代码来源:CrashNaNTest.java


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