public Display(String title, int width, int height, Area area) { this(title, width, height); double scaleX = (width * 0.9) / area.getBounds().getWidth(); double scaleY = (height * 0.9) / area.getBounds().getHeight(); double scale = Math.min(scaleX, scaleY); AffineTransform affineTransform = new AffineTransform(); affineTransform.translate(width / 2, height / 2); affineTransform.scale(scale, scale); affineTransform.translate(-area.getBounds2D().getCenterX(), -area.getBounds2D().getCenterY()); area.transform(affineTransform); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.fill(area); this.bufferedImage = image; }
if (!pBounds.contains(area.getBounds())) { processWarningOccurred("Bad region, contains point(s) out of bounds " + pBounds + ": " + area);
/** * Creates a new AreaMask object. * * @param area the defining absolute area */ public AreaMask (Area area) { this.area = area; rect = area.getBounds(); }
/** * Returns the height of the block shape of this * @return the height of the block shape of this */ public int getBlockHeight() { return blockArea.getBounds().height; }
case PICT.OP_FILL_SAME_RGN:// OK, not tested if (region != null && !region.getBounds().isEmpty()) { switch (opCode) { case PICT.OP_FRAME_RGN:
/** * Creates a new Mask object. * * @param area definition of the relevant area */ public Mask (Area area) { this.area = area; rect = area.getBounds(); bitmap = computeRelevantPoints(area); }
/** If this Displayable intersects with @param r or almost intersects, then returns true. * This method is meant to be very fast, and err on the "yes" and never on the "no". */ protected boolean isRoughlyInside(final Layer layer, final Rectangle r) { // Unless overriden: final Area a = getAreaForBucket(layer); if (a == null) return false; return a.getBounds().intersects(r); }
aw.mousePressed(me, la, x_p_w, y_p_w, mag, Arrays.asList(new Runnable[]{new Runnable() { @Override public void run() { // To be run on mouse released: // check if empty. If so, remove final Rectangle bounds = a.getBounds(); if (0 == bounds.width && 0 == bounds.height) { ht_areas.remove(lid); } calculateBoundingBox(la); }}})); aw.setSource(null);
private static Rectangle applyOverflowClip(Rectangle bounds, Area overflowClip) { if (overflowClip != null) { Area boxArea = new Area(bounds); boxArea.intersect(overflowClip); return boxArea.getBounds(); } return bounds; }
/** * Report the rectangular bounds that enclose this system. * * @return the system rectangular bounds */ public Rectangle getBounds () { if (getArea() != null) { return area.getBounds(); } else { return null; } }
/** * Returns the size of the area of the bounding box of the polygon. * * @param area the area of which the boundingbox size is measured * @return the size of the area of the boundingbox of this area */ private static double sizeOfArea(final Area area) { final Dimension d = area.getBounds().getSize(); return d.getHeight() * d.getWidth(); }
public Bounds bounds() { final Rectangle2D abounds = area.getBounds(); final Bounds bounds = new Bounds(); bounds.lower.x = abounds.getMinX(); bounds.upper.x = abounds.getMaxX(); bounds.lower.y = abounds.getMinY(); bounds.upper.y = abounds.getMaxY(); return bounds; }
/** Test whether the areas intersect each other. */ static public final boolean intersects(final Area a1, final Area a2) { final Area b = new Area(a1); b.intersect(a2); final java.awt.Rectangle r = b.getBounds(); return 0 != r.width && 0 != r.height; }
int w = ((int) dim.getWidth() / 2) - (bi.getWidth() / 2); int h = ((int) dim.getHeight() / 2) - (bi.getHeight() / 2); Rectangle oldArea = new Rectangle(w, h, bi.getWidth(), bi.getHeight()); bi = bi2; w = ((int) dim.getWidth() / 2) - (bi.getWidth() / 2); h = ((int) dim.getHeight() / 2) - (bi.getHeight() / 2); Rectangle newArea = new Rectangle(w, h, bi.getWidth(), bi.getHeight()); Area area = new Area(); area.add(oldArea); area.add(newArea); Rectangle updateArea = area.getBounds(); paintImmediately(updateArea);
@Override public boolean isRoughlyInside(final Rectangle localbox) { if (null == aw) return localbox.contains((int)x, (int)y); if (aw.getArea().getBounds().intersects(localbox)) return true; return super.isRoughlyInside(localbox); }
public void debug() { for (final Map.Entry<Layer,Set<Node<Area>>> e : node_layer_map.entrySet()) { for (final Node<Area> nd : e.getValue()) { final Area a = ((AreaNode)nd).aw.getArea(); Utils.log2("area: " + a + " " + (null != a ? a.getBounds() : null)); Utils.log2(" .. and has paths: " + M.getPolygons(a).size()); } } }
/** Returns a new Rectangle which encloses completly the given rectangle after transforming it with this Displayable's AffineTransform. The given rectangle's fields are untouched.*/ final public Rectangle transformRectangle(final Rectangle r) { if (this.at.isIdentity()) return (Rectangle)r.clone(); return new Area(r).createTransformedArea(this.at).getBounds(); }
private void computeArea () { setArea(AreaUtil.verticalRibbon(new Path2D.Double(median), width)); // Define precise bounds based on this path setBounds(getArea().getBounds()); }
/** * */ protected void computeArea () { setArea(AreaUtil.horizontalParallelogram(median.getP1(), median.getP2(), height)); // Define precise bounds based on this path setBounds(getArea().getBounds()); }