use of org.jwildfire.create.tina.palette.RGBPaletteRenderer 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();
}
}
}
use of org.jwildfire.create.tina.palette.RGBPaletteRenderer in project JWildfire by thargor6.
the class TinaController method refreshPaletteImg.
private void refreshPaletteImg() {
try {
if (getCurrLayer() != null) {
ImagePanel[] panels = { getPalettePanel(), getColorChooserPalettePanel() };
for (ImagePanel imgPanel : panels) {
int width = imgPanel.getWidth();
int height = imgPanel.getHeight();
if (width >= 16 && height >= 4) {
if (getCurrLayer().getGradientMapFilename() != null && getCurrLayer().getGradientMapFilename().length() > 0) {
SimpleImage img = (SimpleImage) RessourceManager.getImage(getCurrLayer().getGradientMapFilename());
imgPanel.setImage(img, 0, 0, width, height);
} else {
SimpleImage img = new RGBPaletteRenderer().renderHorizPalette(getCurrLayer().getPalette(), width, height);
imgPanel.setImage(img);
}
}
imgPanel.getParent().validate();
imgPanel.repaint();
}
}
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
Aggregations