use of org.jwildfire.image.WFImage in project JWildfire by thargor6.
the class TinaController method selectImageForGradientButton_actionPerformed.
public void selectImageForGradientButton_actionPerformed(ActionEvent e) {
JFileChooser chooser = new ImageFileChooser(Tools.FILEEXT_PNG);
if (prefs.getInputImagePath() != null) {
try {
chooser.setCurrentDirectory(new File(prefs.getInputImagePath()));
} catch (Exception ex) {
ex.printStackTrace();
}
}
if (chooser.showOpenDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
try {
String filename = file.getAbsolutePath();
WFImage img = RessourceManager.getImage(filename);
if (img.getImageWidth() < 16 || img.getImageHeight() < 16 || !(img instanceof SimpleImage)) {
throw new Exception("Invalid gradient map");
}
prefs.setLastInputImageFile(file);
saveUndoPoint();
getCurrLayer().setGradientMapFilename(filename);
setLastGradient(getCurrLayer().getPalette());
refreshPaletteColorsTable();
refreshPaletteUI(getCurrLayer().getPalette());
refreshFlameImage(true, false, 1, true, false);
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
}
Aggregations