Package com.lightcrafts.image.export

Examples of com.lightcrafts.image.export.ImageExportOptions


                // We've stopped exposing the multilayer TIFF option to users,
                // but the option can slip through via persisted options.
                if (options.isMultilayerTiff()) {
                    // Convert to a single-layer TIFF in this case.
                    final ImageExportOptions export =
                        SaveOptions.getExportOptions(options);
                    options = SaveOptions.createSidecarTiff(export);
                }
                LastSaveOptions = options;
                doc.setSaveOptions(options);
View Full Code Here


        // We've stopped exposing the multilayer TIFF option to users,
        // but the option can slip through via persisted options.
        if (options.isMultilayerTiff()) {
            // Convert to a single-layer TIFF in this case.
            ImageExportOptions export =
                SaveOptions.getExportOptions(options);
            options = SaveOptions.createSidecarTiff(export);
        }
        LastSaveOptions = options;
        doc.setSaveOptions(options);
View Full Code Here

            return false;
        }
    }

    public static boolean export(ComboFrame frame, Document doc) {
        ImageExportOptions oldOptions = doc.getExportOptions();
        ImageMetadata meta = doc.getMetadata();
        final Engine engine = doc.getEngine();
        Dimension size = engine.getNaturalSize();

        ImageExportOptions newOptions;
        if (oldOptions != null) {
            // This Document has been exported before.
            newOptions = ExportLogic.getDefaultExportOptions(
                oldOptions, size
            );
        }
        else if (LastExportOptions != null) {
            // This Document has never been exported, but export has been used.
            File file = doc.getFile();
            if (file != null) {
                // This Document has been saved:
                newOptions = ExportLogic.getDefaultExportOptions(
                    LastExportOptions, meta, size, file.getName()
                );
            }
            else {
                // This Document not has been saved:
                newOptions = ExportLogic.getDefaultExportOptions(
                    LastExportOptions, meta, size
                );
            }
        }
        else {
            // Export has never been used.
            newOptions = ExportLogic.getDefaultExportOptions(
                meta, size
            );
        }
        // Show the export dialog using these defaults:
        FileChooser chooser = Platform.getPlatform().getFileChooser();
        ImageExportOptions options = chooser.exportFile(newOptions, frame);

        // User cancelled:
        if (options == null) {
            return false;
        }
        // Do the write:
        boolean success;
        frame.pause();
        try {
            success = DocumentWriter.exportWithDialog(
                engine, options, LOCALE.get("ExportMessage"), frame
            );
        }
        catch (Throwable e) {   // IOException, unchecked Exceptions
            showError(
                LOCALE.get("ExportError", options.getExportFile().toString()),
                e, frame
            );
            success = false;
        }
        finally {
            frame.resume();
        }
        if (! success) {
            // User canceled.
            File file = options.getExportFile();
            if (file != null) {
                file.delete();
            }
            return false;
        }
        doc.setExportOptions(options);

        LastExportOptions = options;
        addToRecentFiles(options.getExportFile());
        savePrefs();

        return true;
    }
View Full Code Here

                frame.resume();
            }
            else {
                // We're performing some kind of Engine export:
                Engine engine = doc.getEngine();
                ImageExportOptions export =
                    SaveOptions.getExportOptions(options);

                OtherApplication app = (OtherApplication)doc.getSource();

                // Mangle LZN and add it to the export options as appropriate:
View Full Code Here

            saveMarker(node);
            export.write(node);
        }

        static SidecarJpeg restore(XmlNode node) throws XMLException {
            ImageExportOptions export = ImageExportOptions.read(node);
            SidecarJpeg jpeg = new SidecarJpeg(export);
            jpeg.verifyMarker(node);
            return jpeg;
        }
View Full Code Here

            saveMarker(node);
            export.write(node);
        }

        static MultilayerTiff restore(XmlNode node) throws XMLException {
            ImageExportOptions export = ImageExportOptions.read(node);
            MultilayerTiff tiff = new MultilayerTiff(export);
            tiff.verifyMarker(node);
            return tiff;
        }
View Full Code Here

                }
            }
        );
        // Initialize all the image type filters:
        for (ExportFilter filter : filters) {
            ImageExportOptions filterOptions = filter.getExportOptions();
            ImageType filterType = filterOptions.getImageType();
            if (defaultType.equals(filterType)) {
                // For the default filter, use the default options:
                filter = new ExportFilter(options);
                defaultFilter = filter;
            }
View Full Code Here

        return dialog;
    }

    ImageExportOptions getSelectedExportOptions() {
        ExportFilter filter = (ExportFilter) getFileFilter();
        ImageExportOptions options = filter.getExportOptions();
        File file = getSelectedFile();
        options.setExportFile(file);
        return options;
    }
View Full Code Here

    private void fileFilterChanged(
        ExportFilter oldFilter, ExportFilter newFilter
    ) {
        // The oldFilter may be null, the first time an ExportFilter is set.
        ImageExportOptions newOptions = newFilter.getExportOptions();
        if (dialog != null) {
            Container content = dialog.getContentPane();
            if (controls != null) {
                content.remove(controls);
                controls.remove(buttons);
            }
            if (oldFilter != null) {
                ImageExportOptions oldOptions = oldFilter.getExportOptions();
                ExportLogic.mergeExportOptions(oldOptions, newOptions);
            }
            ExportControls ctrls = new ExportControls(newOptions, true);
            toggle = new ExportCtrlToggle(ctrls, dialog);
View Full Code Here

        // enqueues some of its actions:
        final XmlDocument doc = new XmlDocument("Root");
        EventQueue.invokeAndWait(
            new Runnable() {
                public void run() {
                    ImageExportOptions o = showDialog(options, null);
                    if (o != null) {
                        o.write(doc.getRoot());
                    }
                    else {
                        System.out.println("cancelled");
                        System.exit(0);
                    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.image.export.ImageExportOptions

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.