Search in sources :

Example 1 with Prefs

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

the class WikimediaCommonsRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Prefs prefs = Prefs.getPrefs();
    Flame flame = createSubFlame(prefs);
    flame.setPixelsPerUnit(200);
    return flame;
}
Also used : Prefs(org.jwildfire.base.Prefs) Flame(org.jwildfire.create.tina.base.Flame)

Example 2 with Prefs

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

the class Flame method applyDefaultOversamplingSettings.

public void applyDefaultOversamplingSettings() {
    Prefs prefs = Prefs.getPrefs();
    setSpatialFilterRadius(prefs.getTinaDefaultSpatialFilterRadius());
    setSpatialOversampling(getSolidRenderSettings().isSolidRenderingEnabled() ? DFLT_SOLID_SPATIAL_OVERSAMPLING : prefs.getTinaDefaultSpatialOversampling());
    setPostNoiseFilter(prefs.isTinaDefaultPostNoiseFilter());
}
Also used : Prefs(org.jwildfire.base.Prefs)

Example 3 with Prefs

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

the class EnvelopeDlgController method exportRawDataToFile.

public void exportRawDataToFile() {
    Prefs prefs = Prefs.getPrefs();
    JFileChooser chooser = new SplineDataFileChooser(prefs);
    if (prefs.getTinaRawMotionDataPath() != null) {
        try {
            chooser.setCurrentDirectory(new File(prefs.getTinaRawMotionDataPath()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    } else if (prefs.getTinaFlamePath() != null) {
        try {
            chooser.setCurrentDirectory(new File(prefs.getTinaFlamePath()));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    if (chooser.showSaveDialog(envelopePanel) == JFileChooser.APPROVE_OPTION) {
        try {
            String motionData = getRawMotionData(chooser.getSelectedFile().getAbsolutePath());
            Tools.writeUTF8Textfile(chooser.getSelectedFile().getAbsolutePath(), motionData);
        } catch (Exception ex) {
            errorHandler.handleError(ex);
        }
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) Prefs(org.jwildfire.base.Prefs) File(java.io.File)

Example 4 with Prefs

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

the class RandomTests method testAbstractRandomGenerator.

@Test
public void testAbstractRandomGenerator() throws Exception {
    Prefs p = Prefs.newInstance();
    for (RandomGeneratorType grt : RandomGeneratorType.values()) {
        AbstractRandomGenerator gr = RandomGeneratorFactory.getInstance(p, grt);
        for (int i = 0; i < 20; i++) Assert.assertTrue(gr.getClass().getSimpleName(), gr.random() < 1);
        for (int i = 0; i < 20; i++) Assert.assertTrue(gr.getClass().getSimpleName(), gr.random(100) < 100);
        gr.randomize(16L);
        if (!(gr instanceof MarsagliaOpenCLRandomGenerator))
            gr.cleanup();
    }
}
Also used : Prefs(org.jwildfire.base.Prefs)

Example 5 with Prefs

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

the class LeapMotionControllerHolder method stopLeapMotionListener.

public void stopLeapMotionListener() {
    try {
        try {
            if (leapMotionController != null && listener != null) {
                leapMotionController.removeListener(listener);
            }
        } finally {
            listener = null;
        }
        if (leapMotionEditorListenerThread != null) {
            leapMotionEditorListenerThread.signalCancel();
            leapMotionEditorListenerThread = null;
        }
        if (recorder != null && !recorder.isEmpty()) {
            tinaController.undoAction();
            applyMotionToFlame(recorder, tinaController.getCurrFlame());
            tinaController.refreshUI();
            if (doSave && StandardDialogs.confirm(rootPanel, "Do you want to save the recorded motion-data?")) {
                Prefs prefs = Prefs.getPrefs();
                JFileChooser chooser = new TxtFileChooser(prefs);
                if (prefs.getTinaRawMotionDataPath() != null) {
                    try {
                        chooser.setCurrentDirectory(new File(prefs.getTinaRawMotionDataPath()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                } else if (prefs.getTinaFlamePath() != null) {
                    try {
                        chooser.setCurrentDirectory(new File(prefs.getTinaFlamePath()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
                    try {
                        exportMotionToFile(chooser.getSelectedFile());
                    } catch (Exception ex) {
                        errorHandler.handleError(ex);
                    }
                }
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) TxtFileChooser(org.jwildfire.create.tina.swing.TxtFileChooser) Prefs(org.jwildfire.base.Prefs) File(java.io.File)

Aggregations

Prefs (org.jwildfire.base.Prefs)11 File (java.io.File)5 JFileChooser (javax.swing.JFileChooser)4 Flame (org.jwildfire.create.tina.base.Flame)3 ResolutionProfile (org.jwildfire.base.ResolutionProfile)1 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)1 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)1 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)1 TxtFileChooser (org.jwildfire.create.tina.swing.TxtFileChooser)1 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)1 SimpleImage (org.jwildfire.image.SimpleImage)1