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