Package java.awt.geom

Examples of java.awt.geom.Area$AreaIterator$IteratorSegment


        if (!(roi instanceof ROIShape)) {
            return super.add(roi);
        } else {
            ROIShape rois = (ROIShape) roi;
            Area a1 = new Area(theShape);
            Area a2 = new Area(rois.theShape);
            a1.add(a2);
            return new ROIShape(a1);
        }
    }
View Full Code Here


        if (!(roi instanceof ROIShape)) {
            return super.subtract(roi);
        } else {
            ROIShape rois = (ROIShape)roi;
            Area a1 = new Area(theShape);
            Area a2 = new Area(rois.theShape);
            a1.subtract(a2);
            return new ROIShape(a1);
        }
    }
View Full Code Here

        if (!(roi instanceof ROIShape)) {
            return super.intersect(roi);
        } else {
            ROIShape rois = (ROIShape)roi;
            Area a1 = new Area(theShape);
            Area a2 = new Area(rois.theShape);
            a1.intersect(a2);
            return new ROIShape(a1);
        }
    }
View Full Code Here

        if (!(roi instanceof ROIShape)) {
            return super.exclusiveOr(roi);
        } else {
            ROIShape rois = (ROIShape)roi;
            Area a1 = new Area(theShape);
            Area a2 = new Area(rois.theShape);
            a1.exclusiveOr(a2);
            return new ROIShape(a1);
        }
    }
View Full Code Here

            if(invalidBounds.isEmpty()) {
                return;
            }

            // Intersect with ROI.
            Area invalidArea = new Area(invalidRegion);
            if(srcROI != null) {
                Shape roiShape = srcROI.getAsShape();
                if(roiShape != null) {
                    invalidArea.intersect(new Area(roiShape));
                } else {
                    LinkedList rectList =
                        srcROI.getAsRectangleList(invalidBounds.x,
                                                  invalidBounds.y,
                                                  invalidBounds.width,
                                                  invalidBounds.height);
                    Iterator it = rectList.iterator();
                    while(it.hasNext() && !invalidArea.isEmpty()) {
                        invalidArea.intersect(new Area((Rectangle)it.next()));
                    }
                }
            }

            // If empty, all is valid.
            if(invalidArea.isEmpty()) {
                return;
            }

            // Determine all possible overlapping tiles.
            Point[] tileIndices = getTileIndices(invalidArea.getBounds());
            int numIndices = tileIndices.length;

            // Clear any tiles which intersect the invalid area.
            for(int i = 0; i < numIndices; i++) {
                int tx = tileIndices[i].x;
                int ty = tileIndices[i].y;
                Raster tile = tiles[tx][ty];
                if ((tile != null) &&
        invalidArea.intersects(tile.getBounds())) {
                    tiles[tx][ty] = null;
                }
            }

            if(eventManager.hasListeners("InvalidRegion")) {
                // Determine the old invalid region.
                Shape oldInvalidRegion = new Rectangle(); // default is empty.

                // If there is a ROI, the old invalid region is the
                // complement of the ROI within the image bounds.
                if(srcROI != null) {
                    Area oldInvalidArea = new Area(getBounds());
                    Shape roiShape = srcROI.getAsShape();
                    if(roiShape != null) {
                        oldInvalidArea.subtract(new Area(roiShape));
                    } else {
                        Rectangle oldInvalidBounds =
                            oldInvalidArea.getBounds();
                        LinkedList rectList =
                            srcROI.getAsRectangleList(oldInvalidBounds.x,
                                                      oldInvalidBounds.y,
                                                      oldInvalidBounds.width,
                                                      oldInvalidBounds.height);
                        Iterator it = rectList.iterator();
                        while(it.hasNext() && !oldInvalidArea.isEmpty()) {
                            oldInvalidArea.subtract(new Area((Rectangle)it.next()));
                        }
                    }
                    oldInvalidRegion = oldInvalidArea;
                }
View Full Code Here

        /// XXX bpb 1998/09/28 Is it really necessary to use Area.intersects()?
        /// Note that the Polygon.intersects() method appears not to be
        /// implemented. Shape.intersects() also appeared not to work in
        /// testing the trivial case below.
        if (!((new Area(theShape)).intersects(clip))) { // Null overlap.
            return null;
        } else if (theShape instanceof Rectangle2D) { // Trivial case.
            // Return a list consisting of a single Rectangle which is the
            // intersection of the clipping Rectangle with the internal
            // Shape of the ROIShape rounded to integer coordinates.
View Full Code Here

        LinkedList rectList = null;
        in.defaultReadObject();
        rectList = (LinkedList)in.readObject();

        // Restore the transient Shape as an Area.
        Area a = new Area();
        int listSize = rectList.size();
        for (int i = 0; i < listSize; i++) {
            a.add(new Area((Rectangle)rectList.get(i)));
        }
        theShape = a;
    }
View Full Code Here

            Rectangle r2 = textPane.modelToView(info.end);

            if(r2.y > r1.y) {
                // token spans more than one line
                GeneralPath gp = new GeneralPath();
                Area area = new Area();
                for(int index=info.start; index<info.end; index++) {
                    Rectangle r = textPane.modelToView(index);
                    // compute the width of the index
                    r.width = Math.max(0,textPane.modelToView(index+1).x - r.x);
                    area.add(new Area(r));
                }
                gp.append(area, true);
                if(fill)
                    g.fill(gp);
                else
View Full Code Here

    public void clip(Shape shape)
    {
        if(getDeviceclip() != null)
        {
            Area area = new Area(getClip());
            if(shape != null)
                area.intersect(new Area(shape));
            shape = area;
        }
        setClip(shape);
    }
View Full Code Here

    @Test public void testArea() throws Exception {
        SRect rect = new SRect(0,0,10,10);
        rect.setFillPaint(FlatColor.RED);
        SOval oval = new SOval(5,5,10,10);
        oval.setFillPaint(FlatColor.BLUE);
        Area area = new Area();
        area.add(rect.toArea());
        area.add(oval.toArea());
        SArea sarea = new SArea(area);
        sarea.setTranslateX(10);
        sarea.setTranslateY(10);
        sarea.setFillPaint(FlatColor.GREEN);
        page.clear();
View Full Code Here

TOP

Related Classes of java.awt.geom.Area$AreaIterator$IteratorSegment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.