本文整理汇总了Java中java.awt.geom.Area.isRectangular方法的典型用法代码示例。如果您正苦于以下问题:Java Area.isRectangular方法的具体用法?Java Area.isRectangular怎么用?Java Area.isRectangular使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.Area
的用法示例。
在下文中一共展示了Area.isRectangular方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clip
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void clip(Shape s) {
if(s==null) return;
if(clipping==null) {
setClip(s);
return;
}
Area a1 = new Area(clipping);
Area a2 = new Area(s);
a2.transform(transform);
a1.intersect(a2);
if(a1.isRectangular()) {
clipping = a1.getBounds2D();
} else {
clipping = a1;
}
}
示例2: getClip
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public Shape getClip() {
if(clipping==null)
return null;
try {
Area area = new Area(clipping);
area.transform(transform.createInverse());
if(area.isRectangular())
return area.getBounds2D();
return area;
} catch(NoninvertibleTransformException t) {
RuntimeException e2 = new RuntimeException();
e2.initCause(t);
throw e2;
}
}
示例3: getShapeROI
import java.awt.geom.Area; //导入方法依赖的package包/类
/**
* Get a PathShape from an Area.
* This will try to return a PathRectangleROI or PathPolygonROI if possible,
* or PathAreaROI if neither of the other classes can adequately represent the area.
*
* @param area
* @param c
* @param z
* @param t
* @param flatness - can be used to prefer polygons, see Shape.getPathIterator(AffineTransform at, double flatness)
* @return
*/
public static PathShape getShapeROI(Area area, int c, int z, int t, double flatness) {
if (area.isRectangular()) {
Rectangle2D bounds = area.getBounds2D();
return new RectangleROI(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), c, z, t);
}
// else if (area.isPolygonal() && area.isSingular())
else if (area.isSingular() && (area.isPolygonal() || flatness > 0)) {
Path2D path = new Path2D.Float(area);
List<Point2> points = flatness > 0 ? AWTAreaROI.getLinearPathPoints(path, path.getPathIterator(null, flatness)) : AWTAreaROI.getLinearPathPoints(path, path.getPathIterator(null));
return new PolygonROI(points, c, z, t);
// if (area.isPolygonal())
// return new PolygonROI(new Path2D.Float(area), c, z, t);
// else if (flatness > 0) {
// Path2D path = new Path2D.Float();
// path.append(area.getPathIterator(null, flatness), false);
// return new PolygonROI(path, c, z, t);
// }
}
return new AWTAreaROI(area, c, z, t);
}
示例4: setClip
import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public void setClip(Shape newClip) {
if(newClip==null) {
clipping = null;
return;
}
Area area = new Area(newClip);
area.transform( transform );
if(area.isRectangular()) {
clipping = area.getBounds2D();
} else {
clipping = area;
}
}