Package com.lightcrafts.model

Examples of com.lightcrafts.model.Engine


            Document newDoc = frame.getDocument();
            Document oldDoc = docRef.get();
            if (newDoc != oldDoc) {
                removeAll();
                if (newDoc != null) {
                    Engine engine = newDoc.getEngine();
                    List items = engine.getDebugItems();
                    for (Object item : items) {
                        add((JMenuItem) item);
                    }
                }
                for (JMenuItem item : fixedItems) {
View Full Code Here


        }

        File file = new File(args[0]);
        ImageInfo info = ImageInfo.getInstanceFor(file);
        ImageMetadata meta = info.getMetadata();
        Engine engine = EngineFactory.createEngine(meta, null, null);
        Component comp = engine.getComponent();

        JFrame frame;

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
View Full Code Here

                saveLzn(doc, xml);
                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();
View Full Code Here

    /**
     * Write the XML to a file as-is, and add a thumbnail for the browser.
     */
    static void saveLzn(Document doc, XmlDocument xmlDoc) throws IOException {
        Engine engine = doc.getEngine();

        // Fill up the LZN file:
        SaveOptions options = doc.getSaveOptions();
        File file = options.getFile();
        OutputStream out = new FileOutputStream(file);
        xmlDoc.write(out);
        out.close();

        // Add thumbnail data for the browser:
        RenderedImage thumb = engine.getRendering(new Dimension(320, 320));
        // divorce the preview from the document
        thumb = new CachedImage((PlanarImage) thumb, JAIContext.fileCache);
        ImageInfo info = ImageInfo.getInstanceFor(file);
        LZNImageType.INSTANCE.putImage(info, thumb);

        // Cache a high resolution preview:
        int size = PreviewUpdater.PreviewSize;
        RenderedImage preview = engine.getRendering(new Dimension(size, size));
        // divorce the preview from the document
        preview = new CachedImage((PlanarImage) preview, JAIContext.fileCache);
        PreviewUpdater.cachePreviewForImage(file, preview);
    }
View Full Code Here

    private static void maybeAddRawAdjustments(Document doc) {
        ImageMetadata meta = doc.getMetadata();
        ImageType type = meta.getImageType();
        if (type instanceof RawImageType) {
            if (! doc.hasRawAdjustments()) {
                Engine engine = doc.getEngine();
                OperationType rawType = engine.getRawAdjustmentsOperationType();
                Editor editor = doc.getEditor();
                editor.addControl(rawType, 0);
                doc.discardEdits();
                doc.markClean();
            }
View Full Code Here

        }
    }

    public static void print(final ComboFrame frame, final Document doc, final PrintDoneCallback callback) {
        // Capture a preview image:
        Engine engine = doc.getEngine();
        RenderedImage image = engine.getRendering(new Dimension(400, 300));

        if (image instanceof PlanarImage) {
            image = ((PlanarImage) image).getAsBufferedImage();
        }
        // Restore the previous layout:
        PrintLayoutModel layout = doc.getPrintLayout();

        if (layout == null) {
            Dimension size = engine.getNaturalSize();
            // First try the most recent settings:
            if (LastPrintLayout != null) {
                layout = LastPrintLayout;
                layout.updateImageSize(size.width, size.height);
            }
View Full Code Here

    }

    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(
View Full Code Here

            // Code for the "actual size" save preference:
            if (export.resizeWidth.getValue() == 0 &&
                export.resizeHeight.getValue() == 0
            ) {
                Engine engine = doc.getEngine();
                Dimension size = engine.getNaturalSize();
                options.updateSize(size);
            }
            options.setFile(file);
        }
        return options;
View Full Code Here

    }

    private static void printHeadless(ComboFrame frame, Document doc) {

        // The Printable:
        final Engine engine = doc.getEngine();

        // The layout info:
        PrintLayoutModel layout = doc.getPrintLayout();

        // The Engine's layout sub-info:
        final PrintSettings settings = layout.getPrintSettings();

        PrinterLayer printer = Platform.getPlatform().getPrinterLayer();

        // The PageFormat:
        printer.setPageFormat(layout.getPageFormat());
        final PageFormat format = printer.getPageFormat();

        // Make up a name for the print job:
        String jobName;
        File file = doc.getFile();
        if (file != null) {
            jobName = file.getName();
        }
        else {
            ImageMetadata meta = doc.getMetadata();
            jobName = meta.getFile().getName();
        }
        printer.setJobName(jobName);

        boolean doPrint = printer.printDialog();

        if (doPrint) {
            ProgressDialog dialog = Platform.getPlatform().getProgressDialog();
            ProgressThread thread = new ProgressThread(dialog) {
                public void run() {
                    try {
                        engine.print(this, format, settings);
                    }
                    catch (PrinterException e) {
                        throw new RuntimeException(e);
                    }
                }
                public void cancel() {
                    engine.cancelPrint();
                }
            };
            dialog.showProgress(
                frame, thread, LOCALE.get("PrintingMessage"), 0, 0, true
            );
View Full Code Here

                    outName = outFile.getName();
                    DocumentDatabase.addDocumentFile(outFile);
                } else {
                    conformExportOptions(doc, conf, ignoreResize);

                    Engine engine = doc.getEngine();
                    DocumentWriter.export(engine, export, Progress);
                    outFile = export.getExportFile();
                    outName = outFile.getName();
                }
View Full Code Here

TOP

Related Classes of com.lightcrafts.model.Engine

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.