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


Java Path2D.getBounds方法代码示例

本文整理汇总了Java中java.awt.geom.Path2D.getBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Path2D.getBounds方法的具体用法?Java Path2D.getBounds怎么用?Java Path2D.getBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Path2D的用法示例。


在下文中一共展示了Path2D.getBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetBounds

import java.awt.geom.Path2D; //导入方法依赖的package包/类
static void testGetBounds(Path2D pathA, Path2D pathB) {
    final Rectangle rA = pathA.getBounds();
    final Rectangle rB = pathB.getBounds();

    if (!rA.equals(rB)) {
        throw new IllegalStateException("Bounds are not equals [" + rA
            + "|" + rB + "] !");
    }
    final Rectangle2D r2dA = pathA.getBounds2D();
    final Rectangle2D r2dB = pathB.getBounds2D();

    if (!equalsRectangle2D(r2dA, r2dB)) {
        throw new IllegalStateException("Bounds2D are not equals ["
            + r2dA + "|" + r2dB + "] !");
    }
    log("testGetBounds: passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Path2DCopyConstructor.java

示例2: drawPath

import java.awt.geom.Path2D; //导入方法依赖的package包/类
private Rectangle drawPath(VdPath path, Graphics canvas, int w, int h, float scale) {

        Path2D path2d = new Path2D.Double();
        Graphics2D g = (Graphics2D) canvas;
        path.toPath(path2d);

        // TODO: Use AffineTransform to apply group's transformation info.
        double theta = Math.toRadians(path.mRotate);
        g.rotate(theta, path.mRotateX, path.mRotateY);
        if (path.mClip) {
            logger.log(Level.FINE, "CLIP");

            g.setColor(Color.RED);
            g.fill(path2d);

        }
        if (path.mFillColor != 0) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setColor(new Color(path.mFillColor, true));
            g.fill(path2d);
        }
        if (path.mStrokeColor != 0) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setStroke(new BasicStroke(path.mStrokeWidth));
            g.setColor(new Color(path.mStrokeColor, true));
            g.draw(path2d);
        }

        g.rotate(-theta, path.mRotateX, path.mRotateY);
        return path2d.getBounds();
    }
 
开发者ID:RaysonYeungHK,项目名称:Svg2AndroidXml,代码行数:32,代码来源:VdTree.java


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