當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。