Package com.lightcrafts.model

Examples of com.lightcrafts.model.CropBounds


    private void notifyListeners() {
        Rectangle2D rect = new Rectangle2D.Double(
            x.getValue(), y.getValue(), width.getValue(), height.getValue()
        );
        double radians = angle.getValue() * Math.PI / 180;
        CropBounds bounds = new CropBounds(rect, radians);

        Scale scale = new Scale(zoom.getValue() / 10f);

        for (Iterator i=listeners.iterator(); i.hasNext(); ) {
            Listener listener = (Listener) i.next();
View Full Code Here


            factor * center.getX(), factor * center.getY()
        );
        width *= factor;
        height *= factor;

        return new CropBounds(center, width, height, angle);
    }
View Full Code Here

        rotateMode.setUnderlayBounds(bounds);
        if (controlMode != null) {
            controlMode.setUnderlayBounds(bounds);
        }
        // The default crop bounds depend on the underlay bounds.
        CropBounds crop = cropMode.getCrop();
        CropBounds initCrop = getInitialCropBounds();
        if (crop == null) {
            cropMode.setCropWithConstraints(initCrop);
        }
        cropMode.setResetCropBounds(initCrop);
    }
View Full Code Here

        setMode(rotateMode);
        m_editorMode = EditorMode.ROTATE;
        doc.pushFitMode();
        doc.zoomToFit();
        // The "reset" button in rotate mode depends on the initial crop:
        CropBounds crop = cropMode.getCrop();
        rotateMode.setCrop(crop);
        rotateMode.setResetCropBounds(crop);
        return rotateMode.getControl().getResetButton();
    }
View Full Code Here

        double width = underlayBounds.getWidth();
        double height = underlayBounds.getHeight();
        Rectangle2D inset = new Rectangle2D.Double(
            x, y, width, height
        );
        CropBounds crop = new CropBounds(inset);
        try {
            AffineTransform inverse = getOverlayTransform().createInverse();
            crop = CropBounds.transform(inverse, crop);
            return crop;
        }
View Full Code Here

        this.engine = engine;
        this.xform = xform;
        rotorMode = new CropMode(true);
        cropMode = new CropMode(false);
        hiddenRotorMode = new RotorMode();
        bounds = new CropBounds();
        undo = new UndoableEditSupport();
        cropMode.addCropListener( new LocalCropListener( "Crop" ) );
        rotorMode.addCropListener( new LocalCropListener( "Rotate" ) );
        hiddenRotorMode.addRotorListener(this);
    }
View Full Code Here

        // The rotate package applies the convention that positive angles
        // are positive in screen coordinates, meaning clockwise on the
        // screen, which is the opposite of the convention in CropBounds.

        if (! isChanging) {
            CropBounds newBounds = getNewBounds(angle, isNinetyDegrees);
            engine.setCropBounds(newBounds);
            if (! newBounds.isAngleOnly()) {
                cropMode.setCrop(newBounds);
            }
            xform.update();
            postEdit(newBounds, LOCALE.get("RotateEditName"), true );
        }
View Full Code Here

        angleChanged(0, false, hasInvertedAspect);
    }

    private CropBounds getNewBounds(double angle, boolean invertAspect) {
        if (bounds.isAngleOnly()) {
            return new CropBounds(angle);
        }
        else if (invertAspect) {
            CropBounds inverted = bounds.createInvertedAspect();
            hasInvertedAspect = ! hasInvertedAspect;
            return new CropBounds(inverted, angle);
        }
        else {
            return new CropBounds(bounds, angle);
        }
    }
View Full Code Here

        }
    }

    private void postEdit( final CropBounds newBounds, final String name,
                           final boolean significant ) {
        final CropBounds oldBounds = bounds;
        bounds = newBounds;
        UndoableEdit edit = new AbstractUndoableEdit() {
            public String getPresentationName() {
                return name;
            }
View Full Code Here

        while (newAngle - oldAngle > Math.PI / 4) {
            Point2D center = crop.getCenter();
            double width = crop.getWidth();
            double height = crop.getHeight();
            double angle = crop.getAngle();
            crop = new CropBounds(center, height, width, angle - Math.PI / 2);
            newAngle = crop.getAngle();
        }
        while (newAngle - oldAngle < - Math.PI / 4) {
            Point2D center = crop.getCenter();
            double width = crop.getWidth();
            double height = crop.getHeight();
            double angle = crop.getAngle();
            crop = new CropBounds(center, height, width, angle + Math.PI / 2);
            newAngle = crop.getAngle();
        }
        return crop;
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.model.CropBounds

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.