use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.
the class TinaSWFAnimatorController method resolutionProfileCmb_changed.
public void resolutionProfileCmb_changed() {
Flame currFlame = getCurrFlame();
if (currFlame == null) {
return;
}
ResolutionProfile profile = getResolutionProfile();
currFlame.setResolutionProfile(profile);
removeFlamePanel();
previewFlameImage();
}
use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.
the class Boarders2Test method visual.
// @Ignore
@Test
public void visual() throws Exception {
Prefs.getPrefs().setTinaRandomNumberGenerator(RandomGeneratorType.JAVA_INTERNAL);
System.out.println(Prefs.getPrefs().getTinaRandomNumberGenerator().name());
int side = 600;
ResolutionProfile respro = new ResolutionProfile(true, side, side);
int quality = 80;
Flame f = new Flame();
f.setWidth(side);
f.setHeight(side);
f.setGamma(4.0);
f.setBGTransparency(false);
f.setAntialiasAmount(1.0);
f.setAntialiasRadius(.1);
Layer l = new Layer();
XForm xf = new XForm();
Boarders2Func bf = new Boarders2Func();
bf.setParameter("c", .6);
bf.setParameter("left", .65);
bf.setParameter("right", .35);
xf.addVariation(1.0, bf);
f.setCamZoom(6.461);
xf.setWeight(5.5);
l.getXForms().add(xf);
RGBPalette pal = new RGBPalette();
for (int i = 0; i < 256; i++) pal.addColor(0, i, 255);
pal.setFlam3Name("test");
l.setPalette(pal);
f.setResolutionProfile(respro);
f.getLayers().clear();
f.getLayers().add(l);
// this is "scale"
f.setPixelsPerUnit(43.75);
new FlameWriter().writeFlame(f, "/dev/shm/test.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/test.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.ResolutionProfile in project JWildfire by thargor6.
the class HeadlessBatchRendererController method main.
public static void main(String[] args) throws Exception {
// args = new String[]{"/dev/shm/","400","400","80"};//,"ZIGGURAT"};
int height;
int width;
int quality;
String filename;
File f;
List<File> files = new LinkedList<File>();
long start = System.nanoTime();
if (args.length < 4) {
usage(args);
return;
} else {
try {
height = Integer.parseInt(args[1]);
width = Integer.parseInt(args[2]);
quality = Integer.parseInt(args[3]);
filename = args[0].trim();
String was = Prefs.getPrefs().getTinaRandomNumberGenerator().name();
if (args.length > 4 && Arrays.toString(RandomGeneratorType.values()).contains(args[4])) {
Prefs.getPrefs().setTinaRandomNumberGenerator(RandomGeneratorType.valueOf(args[4]));
System.out.println(was + " changed to " + Prefs.getPrefs().getTinaRandomNumberGenerator().name());
}
f = new File(filename);
if (!f.exists())
throw new Exception(filename + " does not exist");
if (f.isDirectory()) {
final File[] listFiles = f.listFiles();
if (listFiles != null)
for (File fi : listFiles) {
if (fi.canRead() && fi.exists() && fi.getName().toLowerCase().endsWith(".flame"))
files.add(fi);
}
} else if (f.getName().toLowerCase().endsWith(".flame"))
files.add(f);
} catch (Exception e) {
usage(args);
System.err.println(e.getMessage());
return;
}
}
ResolutionProfile respro = new ResolutionProfile(true, width, height);
JobRenderThreadController controller = new HeadlessBatchRendererController();
List<Job> joblist = new ArrayList<Job>();
for (File fi : files) {
Job j = new Job();
j.setCustomHeight(height);
j.setCustomWidth(width);
j.setCustomQuality(quality);
j.setFlameFilename(fi.getCanonicalPath());
joblist.add(j);
}
QualityProfile qualpro = new QualityProfile();
qualpro.setQuality(quality);
JobRenderThread job = new JobRenderThread(controller, joblist, respro, qualpro, true, false);
job.run();
System.out.println((System.nanoTime() - start) / 1000 / 1000 + " ms");
}
use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.
the class ResolutionProfileDialog method applyChanges.
private boolean applyChanges() {
try {
final int MIN_SIZE = 16;
int width = Integer.parseInt(getWidthREd().getText());
if (width < MIN_SIZE) {
throw new Exception("Width must be at least " + MIN_SIZE + " pixels");
}
int height = Integer.parseInt(getHeightREd().getText());
if (height < MIN_SIZE) {
throw new Exception("Height must be at least " + MIN_SIZE + " pixels");
}
ResolutionProfile profile;
if (editStatus == EditStatus.NEW) {
profile = new ResolutionProfile();
} else {
profile = (ResolutionProfile) getProfileCmb().getSelectedItem();
}
profile.setWidth(width);
profile.setHeight(height);
profile.setDefaultProfile(getDefaultCBx().isSelected());
if (editStatus == EditStatus.NEW) {
refreshing = true;
try {
getProfileCmb().addItem(profile);
getProfileCmb().setSelectedItem(profile);
} finally {
refreshing = false;
}
}
if (profile.isDefaultProfile()) {
for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
ResolutionProfile lProfile = (ResolutionProfile) getProfileCmb().getItemAt(i);
if (lProfile != profile) {
lProfile.setDefaultProfile(false);
}
}
}
getProfileCmb().requestFocus();
editStatus = EditStatus.BROWSE;
enableControls();
configChanged = true;
return true;
} catch (Throwable ex) {
getStatusLbl().setText(ex.getMessage());
return false;
}
}
use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.
the class ResolutionProfileDialog method setProfiles.
public void setProfiles(List<ResolutionProfile> pProfiles) {
refreshing = true;
try {
getProfileCmb().removeAllItems();
if (pProfiles != null) {
for (ResolutionProfile profile : pProfiles) {
ResolutionProfile clonedProfile = (ResolutionProfile) profile.makeCopy();
getProfileCmb().addItem(clonedProfile);
}
}
getProfileCmb().setSelectedIndex(-1);
editStatus = EditStatus.CLOSE;
} finally {
refreshing = false;
}
}
Aggregations