use of org.jwildfire.base.QualityProfile 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.QualityProfile in project JWildfire by thargor6.
the class QualityProfileDialog method setProfile.
public void setProfile(QualityProfile pProfile) {
refreshing = true;
try {
if (pProfile == null) {
getProfileCmb().setSelectedIndex(-1);
} else {
boolean found = false;
for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
QualityProfile profile = (QualityProfile) getProfileCmb().getItemAt(i);
if (profile.toString().equals(pProfile.toString())) {
getProfileCmb().setSelectedIndex(i);
found = true;
break;
}
}
if (!found) {
getProfileCmb().setSelectedIndex(-1);
}
}
editStatus = getProfileCmb().getSelectedItem() != null ? EditStatus.BROWSE : EditStatus.CLOSE;
refreshProfileView();
enableControls();
} finally {
refreshing = false;
}
}
use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.
the class QualityProfileDialog method setProfiles.
public void setProfiles(List<QualityProfile> pProfiles) {
refreshing = true;
try {
getProfileCmb().removeAllItems();
if (pProfiles != null) {
for (QualityProfile profile : pProfiles) {
QualityProfile clonedProfile = (QualityProfile) profile.makeCopy();
getProfileCmb().addItem(clonedProfile);
}
}
getProfileCmb().setSelectedIndex(-1);
editStatus = EditStatus.CLOSE;
} finally {
refreshing = false;
}
}
use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.
the class QualityProfileDialog method getProfiles.
public List<QualityProfile> getProfiles() {
List<QualityProfile> res = new ArrayList<QualityProfile>();
for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
res.add((QualityProfile) getProfileCmb().getItemAt(i));
}
Collections.sort(res, new QualityProfileComparator());
return res;
}
use of org.jwildfire.base.QualityProfile in project JWildfire by thargor6.
the class QualityProfileDialog method applyChanges.
private boolean applyChanges() {
try {
final int MIN_QUALITY = 1;
String caption = getCaptionREd().getText();
if (caption == null || caption.trim().length() == 0) {
throw new Exception("Caption must not be empty");
}
int quality = Integer.parseInt(getQualityREd().getText());
if (quality < MIN_QUALITY) {
throw new Exception("Quality must be at least " + MIN_QUALITY);
}
QualityProfile profile;
if (editStatus == EditStatus.NEW) {
profile = new QualityProfile();
} else {
profile = (QualityProfile) getProfileCmb().getSelectedItem();
}
profile.setCaption(caption);
profile.setQuality(quality);
profile.setWithHDR(getWithHDRCBx().isSelected());
profile.setWithZBuffer(getWithZBufferCBx().isSelected());
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++) {
QualityProfile lProfile = (QualityProfile) 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;
}
}
Aggregations