Search in sources :

Example 11 with QualityProfile

use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.

the class PolylogarithmTest method visual.

@Test
@Ignore
public void visual() throws Exception {
    int side = 400;
    ResolutionProfile respro = new ResolutionProfile(true, side, side);
    int quality = 200;
    Flame f = new Flame();
    f.setWidth(side);
    f.setHeight(side);
    f.setGamma(4.0);
    f.setBGTransparency(false);
    f.setAntialiasAmount(.1);
    f.setAntialiasRadius(.1);
    Layer l = new Layer();
    XForm xf = new XForm();
    SquishFunc df = new SquishFunc();
    df.setParameter("power", 10);
    xf.addVariation(1, df);
    PolylogarithmFunc bf = new PolylogarithmFunc();
    bf.setParameter("n", 2);
    bf.setParameter("zpow", 1);
    xf.addVariation(.1, bf);
    f.setCamZoom(6);
    xf.setWeight(10);
    l.getXForms().add(xf);
    RGBPalette pal = new RGBPalette();
    for (int i = 0; i < 256; i++) pal.addColor(0, i, 255);
    pal.setFlam3Name("PolylogarithmFunc");
    l.setPalette(pal);
    f.setResolutionProfile(respro);
    f.getLayers().clear();
    f.getLayers().add(l);
    f.setPixelsPerUnit(43.75);
    new FlameWriter().writeFlame(f, "/dev/shm/PolylogarithmFunc.flame");
    JobRenderThreadController controller = new HeadlessBatchRendererController();
    List<Job> joblist = new ArrayList<>();
    Job j = new Job();
    j.setCustomHeight(side);
    j.setCustomWidth(side);
    j.setCustomQuality(quality);
    j.setFlameFilename("/dev/shm/PolylogarithmFunc.flame");
    joblist.add(j);
    QualityProfile qualpro = new QualityProfile();
    qualpro.setQuality(quality);
    JobRenderThread job = new JobRenderThread(controller, joblist, respro, qualpro, true);
    job.run();
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) XForm(org.jwildfire.create.tina.base.XForm) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) HeadlessBatchRendererController(org.jwildfire.create.tina.batch.HeadlessBatchRendererController) ArrayList(java.util.ArrayList) Layer(org.jwildfire.create.tina.base.Layer) FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JobRenderThread(org.jwildfire.create.tina.batch.JobRenderThread) QualityProfile(org.jwildfire.base.QualityProfile) Job(org.jwildfire.create.tina.batch.Job) JobRenderThreadController(org.jwildfire.create.tina.batch.JobRenderThreadController) Flame(org.jwildfire.create.tina.base.Flame) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with QualityProfile

use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.

the class TinaSWFAnimatorController method refreshControls.

protected void refreshControls() {
    noRefresh = true;
    try {
        swfAnimatorFramesPerSecondREd.setValue(currMovie.getFramesPerSecond());
        for (int i = 0; i < globalScripts.size(); i++) {
            ScriptContainer container = globalScripts.get(i);
            setGlobalScriptToUI(currMovie.getGlobalScripts()[i], container.getScriptCmb(), container.getScriptREd());
        }
        for (int i = 0; i < xFormScripts.size(); i++) {
            ScriptContainer container = xFormScripts.get(i);
            setXFormScriptToUI(currMovie.getxFormScripts()[i], container.getScriptCmb(), container.getScriptREd());
        }
        {
            ResolutionProfile fittingProfile = null;
            ResolutionProfile doubleProfile = null;
            for (int i = 0; i < swfAnimatorResolutionProfileCmb.getItemCount(); i++) {
                ResolutionProfile profile = (ResolutionProfile) swfAnimatorResolutionProfileCmb.getItemAt(i);
                if (profile.getWidth() == currMovie.getFrameWidth() && profile.getHeight() == currMovie.getFrameHeight()) {
                    fittingProfile = profile;
                    break;
                } else if ((profile.getWidth() / 2) == currMovie.getFrameWidth() && (profile.getHeight() / 2) == currMovie.getFrameHeight()) {
                    doubleProfile = profile;
                }
            }
            if (fittingProfile != null) {
                swfAnimatorResolutionProfileCmb.setSelectedItem(fittingProfile);
            } else if (doubleProfile != null) {
                swfAnimatorResolutionProfileCmb.setSelectedItem(doubleProfile);
            }
        }
        {
            QualityProfile qualityProfile = null;
            for (int i = 0; i < swfAnimatorQualityProfileCmb.getItemCount(); i++) {
                QualityProfile profile = (QualityProfile) swfAnimatorQualityProfileCmb.getItemAt(i);
                if (qualityProfile == null) {
                    qualityProfile = profile;
                } else if (profile.getQuality() == currMovie.getQuality()) {
                    qualityProfile = profile;
                    break;
                }
            }
            if (qualityProfile != null) {
                swfAnimatorQualityProfileCmb.setSelectedItem(qualityProfile);
            }
        }
        swfAnimatorOutputTypeCmb.setSelectedItem(currMovie.getSequenceOutputType());
        for (JPanel panel : flamePartPanelList) {
            swfAnimatorFlamesPanel.remove(panel);
        }
        flamePartPanelList.clear();
        for (AbstractButton btn : flamePartRadioButtonList) {
            swfAnimatorFlamesButtonGroup.remove(btn);
        }
        flamePartRadioButtonList.clear();
        swfAnimatorFlamesPanel.getParent().validate();
        swfAnimatorFrameSlider.setValue(1);
        swfAnimatorFrameSlider.setMaximum(currMovie.getFrameCount());
        int frameCount = currMovie.getFrameCount();
        swfAnimatorFramesREd.setValue(frameCount);
        swfAnimatorFrameREd.setValue(1);
        swfAnimatorFrameREd.setMaxValue(frameCount);
        swfAnimatorMotionBlurLengthREd.setValue(currMovie.getMotionBlurLength());
        swfAnimatorMotionBlurTimeStepREd.setValue(currMovie.getMotionBlurTimeStep());
        for (FlameMoviePart part : currMovie.getParts()) {
            addFlameToFlamePanel(part);
        }
        enableControls();
    } finally {
        noRefresh = false;
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) JPanel(javax.swing.JPanel) AbstractButton(javax.swing.AbstractButton) QualityProfile(org.jwildfire.base.QualityProfile) FlameMoviePart(org.jwildfire.create.tina.animate.FlameMoviePart)

Example 13 with QualityProfile

use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.

the class TinaController method renderImageButton_actionPerformed.

public void renderImageButton_actionPerformed() {
    if (mainRenderThread != null) {
        mainRenderThread.setForceAbort();
        while (mainRenderThread.isFinished()) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        mainRenderThread = null;
        enableMainRenderControls();
    } else if (getCurrFlame() != null) {
        try {
            String dfltFileExt = Stereo3dMode.SIDE_BY_SIDE.equals(getCurrFlame().getStereo3dMode()) ? Tools.FILEEXT_PNS : Tools.FILEEXT_PNG;
            JFileChooser chooser = new ImageFileChooser(dfltFileExt);
            if (prefs.getOutputImagePath() != null) {
                try {
                    chooser.setCurrentDirectory(new File(prefs.getOutputImagePath()));
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if (chooser.showSaveDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
                QualityProfile qualProfile = getQualityProfile();
                ResolutionProfile resProfile = getResolutionProfile();
                final Flame flame = getCurrFlame();
                final File file = chooser.getSelectedFile();
                prefs.setLastOutputImageFile(file);
                RenderMainFlameThreadFinishEvent finishEvent = new RenderMainFlameThreadFinishEvent() {

                    @Override
                    public void succeeded(double pElapsedTime) {
                        try {
                            messageHelper.showStatusMessage(flame, "render time: " + Tools.doubleToString(pElapsedTime) + "s");
                            mainController.loadImage(file.getAbsolutePath(), false);
                            File zBuffer = new File(Tools.makeZBufferFilename(file.getAbsolutePath()));
                            if (zBuffer.exists()) {
                                mainController.loadImage(zBuffer.getAbsolutePath(), false);
                            }
                        } catch (Throwable ex) {
                            errorHandler.handleError(ex);
                        }
                        mainRenderThread = null;
                        enableMainRenderControls();
                    }

                    @Override
                    public void failed(Throwable exception) {
                        errorHandler.handleError(exception);
                        mainRenderThread = null;
                        enableMainRenderControls();
                    }
                };
                mainRenderThread = new RenderMainFlameThread(prefs, flame, file, qualProfile, resProfile, finishEvent, mainProgressUpdater);
                enableMainRenderControls();
                Thread worker = new Thread(mainRenderThread);
                worker.setPriority(Thread.MIN_PRIORITY);
                worker.start();
            }
        } catch (Throwable ex) {
            errorHandler.handleError(ex);
        }
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) ImageFileChooser(org.jwildfire.swing.ImageFileChooser) JFileChooser(javax.swing.JFileChooser) QualityProfile(org.jwildfire.base.QualityProfile) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 14 with QualityProfile

use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.

the class TinaController method refreshQualityProfileCmb.

private void refreshQualityProfileCmb(JComboBox pCmb, QualityProfile pSelectedProfile) {
    boolean oldCmbRefreshing = cmbRefreshing;
    cmbRefreshing = true;
    try {
        QualityProfile selected = pSelectedProfile;
        QualityProfile defaultProfile = null;
        pCmb.removeAllItems();
        for (QualityProfile profile : prefs.getQualityProfiles()) {
            if (selected == null && profile.isDefaultProfile()) {
                selected = profile;
            }
            if (defaultProfile == null && profile.isDefaultProfile()) {
                defaultProfile = profile;
            }
            pCmb.addItem(profile);
        }
        if (selected != null) {
            pCmb.setSelectedItem(selected);
        }
        if (pCmb.getSelectedIndex() < 0 && defaultProfile != null) {
            pCmb.setSelectedItem(defaultProfile);
        }
        if (pCmb.getSelectedIndex() < 0 && prefs.getQualityProfiles().size() > 0) {
            pCmb.setSelectedIndex(0);
        }
    } finally {
        cmbRefreshing = oldCmbRefreshing;
    }
}
Also used : QualityProfile(org.jwildfire.base.QualityProfile)

Aggregations

QualityProfile (org.jwildfire.base.QualityProfile)14 ResolutionProfile (org.jwildfire.base.ResolutionProfile)6 ArrayList (java.util.ArrayList)4 Point (java.awt.Point)3 Flame (org.jwildfire.create.tina.base.Flame)3 File (java.io.File)2 Test (org.junit.Test)2 Layer (org.jwildfire.create.tina.base.Layer)2 XForm (org.jwildfire.create.tina.base.XForm)2 HeadlessBatchRendererController (org.jwildfire.create.tina.batch.HeadlessBatchRendererController)2 Job (org.jwildfire.create.tina.batch.Job)2 JobRenderThread (org.jwildfire.create.tina.batch.JobRenderThread)2 JobRenderThreadController (org.jwildfire.create.tina.batch.JobRenderThreadController)2 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)2 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2 LinkedList (java.util.LinkedList)1 AbstractButton (javax.swing.AbstractButton)1 JFileChooser (javax.swing.JFileChooser)1 JPanel (javax.swing.JPanel)1 Ignore (org.junit.Ignore)1