Package com.lightcrafts.model

Examples of com.lightcrafts.model.Contour


    }

    public boolean intersects(Rectangle2D rect) {
        Iterator it = region.getContours().iterator();
        while (it.hasNext()) {
            Contour c = (Contour) it.next();
            AffineTransform combined = transform;
            if (c.getTranslation() != null) {
                combined = AffineTransform.getTranslateInstance(c.getTranslation().getX(), c.getTranslation().getY());
                combined.preConcatenate(transform);
            }
            Rectangle2D translatedRect = rect;
            if (!combined.isIdentity()) {
                try {
                    AffineTransform inverse = combined.createInverse();
                    translatedRect = inverse.createTransformedShape(rect).getBounds2D();
                } catch (NoninvertibleTransformException e) {
                    e.printStackTrace();
                }
            }

            // Take the blur tapering into account
            Rectangle bounds = c.getOuterShape().getBounds();
            bounds.grow((int) (c.getWidth()), (int) (c.getWidth()));

            if (bounds.intersects(translatedRect))
                return true;
        }
        return false;
View Full Code Here


    private synchronized boolean somethingChanged() {
        Iterator it = region.getContours().iterator();

        int i = 0;
        while (it.hasNext()) {
            Contour c = (Contour) it.next();

            if (c != contours.get(i))
                return true;

            if (c.getTranslation() != null) {
                if (contours.size() > (i+1) && c.getTranslation() != contours.get(i+1))
                    return true;
                i+=2;
            } else
                i++;
        }
View Full Code Here

                We keep the current configuration around
                to check if something changes in this region.
            */
            Iterator it = region.getContours().iterator();
            while (it.hasNext()) {
                Contour c = (Contour) it.next();
                contours.add(c);

                // if  a contour has a translation
                // put that in the next list slot

                if (c.getTranslation() != null)
                    contours.add(c.getTranslation());
            }

            theMask = new ShapedMask(region, this);
        }

View Full Code Here

    public static Rectangle getOuterBounds(Region region, AffineTransform transform) {
        Rectangle outerBounds = null;
        Iterator it = region.getContours().iterator();
        while (it.hasNext()) {
            Contour c = (Contour) it.next();

            AffineTransform combined = transform;
            if (c.getTranslation() != null) {
                combined = AffineTransform.getTranslateInstance(c.getTranslation().getX(), c.getTranslation().getY());
                combined.preConcatenate(transform);
            }

            Rectangle cBounds = new Rectangle(c.getOuterShape().getBounds());
            cBounds = combined.createTransformedShape(cBounds).getBounds();

            if (outerBounds == null)
                outerBounds = cBounds;
            else
View Full Code Here

        WritableRaster result = (WritableRaster) ti.getData();

        boolean overlay = false;

        while (it.hasNext()) {
            Contour c = (Contour) it.next();
            AffineTransform combined = shape.getTransform();
            if (c.getTranslation() != null) {
                combined = AffineTransform.getTranslateInstance(c.getTranslation().getX(),
                                                                c.getTranslation().getY());
                combined.preConcatenate(shape.getTransform());
            }

            // Take the blur tapering into account
            Rectangle bounds = c.getOuterShape().getBounds();
            bounds.grow((int) c.getWidth(), (int) c.getWidth());

            if (combined.createTransformedShape(bounds).intersects(rect)) {
                ScaledImage scaledImage = getContourImage(c);
                PlanarImage maskImage = scaledImage.image;
View Full Code Here

    ContourRegion(Collection contours) {
        this.contours = contours;
        outerArea = new Area();
        for (Iterator i=contours.iterator(); i.hasNext(); ) {
            Contour contour = (Contour) i.next();
            Shape outerShape = contour.getOuterShape();
            outerArea.add(new Area(outerShape));
        }
    }
View Full Code Here

            Set curves = model.getCurves(comp);
            if (! curves.isEmpty()) {
                ArrayList contours = new ArrayList();
                for (Iterator i=curves.iterator(); i.hasNext(); ) {
                    Curve curve = (Curve) i.next();
                    Contour contour = model.getContour(curve);
                    contours.add(contour);
                }
                Region region = new ContourRegion(contours);
                return region;
            }
View Full Code Here

        return getClonePoint(curve) != null;
    }

    private void addContour(Curve curve) {
        if (! contours.containsKey(curve)) {
            Contour contour = new CurveContour(curve);
            contours.put(curve, contour);
        }
    }
View Full Code Here

            contours.put(curve, contour);
        }
    }

    private void changeContour(Curve curve) {
        Contour contour = new CurveContour(curve);
        contours.put(curve, contour);
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.model.Contour

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.