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;
}
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());
}
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);
}
}
}
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();
}
}
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();
}
}
Aggregations