本文整理汇总了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.");
}
示例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();
}