Search in sources :

Example 16 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile 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 17 with ResolutionProfile

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

the class IFlamesController method getFlamePanel.

@Override
public FlamePanel getFlamePanel() {
    if (flamePanel == null) {
        Prefs prefs = Prefs.getPrefs();
        int width = centerPanel.getWidth();
        int height = centerPanel.getHeight();
        SimpleImage img = new SimpleImage(width, height);
        img.fillBackground(0, 0, 0);
        flamePanel = new FlamePanel(prefs, img, 0, 0, centerPanel.getWidth(), this, null);
        flamePanel.getConfig().setWithColoredTransforms(prefs.isTinaEditorControlsWithColor());
        flamePanel.setFlamePanelTriangleMode(prefs.getTinaEditorControlsStyle());
        flamePanel.getConfig().setProgressivePreview(prefs.isTinaEditorProgressivePreview());
        flamePanel.importOptions(prevFlamePanel);
        prevFlamePanel = null;
        ResolutionProfile resProfile = getResolutionProfile();
        flamePanel.setRenderWidth(resProfile.getWidth());
        flamePanel.setRenderHeight(resProfile.getHeight());
        flamePanel.setFocusable(true);
        if (firstFlamePanel) {
            centerPanel.remove(0);
            firstFlamePanel = false;
        }
        centerPanel.add(flamePanel, BorderLayout.CENTER);
        centerPanel.getParent().validate();
        centerPanel.repaint();
        flamePanel.requestFocusInWindow();
    }
    return flamePanel;
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) SimpleImage(org.jwildfire.image.SimpleImage) FlamePanel(org.jwildfire.create.tina.swing.flamepanel.FlamePanel) Prefs(org.jwildfire.base.Prefs)

Example 18 with ResolutionProfile

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

the class IFlamesController method resolutionProfileCmb_changed.

public void resolutionProfileCmb_changed() {
    if (noRefresh || getFlame() == null) {
        return;
    }
    noRefresh = true;
    try {
        ResolutionProfile profile = getResolutionProfile();
        getFlame().setResolutionProfile(profile);
        removeFlamePanel();
        refreshPreview();
        resolutionProfileCmb.requestFocus();
    } finally {
        noRefresh = false;
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile)

Example 19 with ResolutionProfile

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

the class IFlamesController method refreshResolutionProfileCmb.

@SuppressWarnings("unchecked")
private void refreshResolutionProfileCmb(@SuppressWarnings("rawtypes") JComboBox pCmb, ResolutionProfile pSelectedProfile) {
    boolean oldNoRefresh = noRefresh;
    noRefresh = true;
    try {
        ResolutionProfile selected = pSelectedProfile;
        ResolutionProfile defaultProfile = null;
        pCmb.removeAllItems();
        for (ResolutionProfile profile : prefs.getResolutionProfiles()) {
            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.getResolutionProfiles().size() > 0) {
            pCmb.setSelectedIndex(0);
        }
    } finally {
        noRefresh = oldNoRefresh;
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile)

Example 20 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile 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)

Aggregations

ResolutionProfile (org.jwildfire.base.ResolutionProfile)29 SimpleImage (org.jwildfire.image.SimpleImage)8 Flame (org.jwildfire.create.tina.base.Flame)7 QualityProfile (org.jwildfire.base.QualityProfile)6 ArrayList (java.util.ArrayList)5 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)5 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)5 Dimension (java.awt.Dimension)3 Point (java.awt.Point)3 File (java.io.File)3 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)3 ImagePanel (org.jwildfire.swing.ImagePanel)3 JFileChooser (javax.swing.JFileChooser)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)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