use of org.jwildfire.create.tina.io.MapGradientReader in project JWildfire by thargor6.
the class MapFilePreview method createThumbnail.
public void createThumbnail() {
if (currFile == null) {
currThumbnail = null;
return;
}
try {
if (currFile.exists()) {
List<RGBPalette> gradients = new MapGradientReader().readPalettes(currFile.getAbsolutePath());
int imgWidth = this.getPreferredSize().width;
int imgHeight = this.getPreferredSize().height - BUTTON_HEIGHT;
SimpleImage img = new RGBPaletteRenderer().renderHorizPalette(gradients.get(0), imgWidth, imgHeight);
currThumbnail = new ImageIcon(img.getBufferedImg());
}
} catch (Exception ex) {
currThumbnail = null;
if (ex.getCause() != null) {
ex.getCause().printStackTrace();
} else {
ex.printStackTrace();
}
}
}
Aggregations