use of org.jwildfire.image.SimpleImage in project JWildfire by thargor6.
the class FlamesGPURenderController method refreshImagePanel.
private void refreshImagePanel() {
if (imageScrollPane != null) {
imageRootPanel.remove(imageScrollPane);
imageScrollPane = null;
}
ResolutionProfile profile = getResolutionProfile();
int width = profile.getWidth();
int height = profile.getHeight();
if (quarterSizeButton.isSelected()) {
width /= 4;
height /= 4;
} else if (halveSizeButton.isSelected()) {
width /= 2;
height /= 2;
}
image = new SimpleImage(width, height);
image.getBufferedImg().setAccelerationPriority(1.0f);
image.fillBackground(prefs.getTinaRandomBatchBGColorRed(), prefs.getTinaRandomBatchBGColorGreen(), prefs.getTinaRandomBatchBGColorBlue());
ImagePanel imagePanel = new ImagePanel(image, 0, 0, image.getImageWidth());
imagePanel.setSize(image.getImageWidth(), image.getImageHeight());
imagePanel.setPreferredSize(new Dimension(image.getImageWidth(), image.getImageHeight()));
imageScrollPane = new JScrollPane(imagePanel);
imageScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
imageScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
imageRootPanel.add(imageScrollPane, BorderLayout.CENTER);
imageRootPanel.getParent().validate();
}
use of org.jwildfire.image.SimpleImage in project JWildfire by thargor6.
the class ImageThumbnail method generatePreview.
private SimpleImage generatePreview() {
if (cacheKey != null) {
SimpleImage img = ThumbnailCacheProvider.getThumbnail(cacheKey, IMG_WIDTH);
if (img != null) {
return img;
}
}
SimpleImage image;
try {
image = ((SimpleImage) RessourceManager.getImage(filename));
RessourceManager.clearImage(filename);
ScaleTransformer scaleT = new ScaleTransformer();
scaleT.setScaleWidth(IMG_WIDTH);
scaleT.setAspect(ScaleAspect.KEEP_WIDTH);
scaleT.transformImage(image);
if (cacheKey != null) {
ThumbnailCacheProvider.storeThumbnail(cacheKey, IMG_WIDTH, image);
}
return image;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
use of org.jwildfire.image.SimpleImage in project JWildfire by thargor6.
the class TinaController method grabPaletteFromImageButton_actionPerformed.
public void grabPaletteFromImageButton_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 {
SimpleImage img = new ImageReader(centerPanel).loadImage(file.getAbsolutePath());
prefs.setLastInputImageFile(file);
RGBPalette palette = new MedianCutQuantizer().createPalette(img);
data.paletteKeyFrames = null;
saveUndoPoint();
getCurrLayer().setPalette(palette);
setLastGradient(palette);
refreshPaletteColorsTable();
refreshPaletteUI(palette);
refreshFlameImage(true, false, 1, true, false);
} catch (Throwable ex) {
errorHandler.handleError(ex);
}
}
}
use of org.jwildfire.image.SimpleImage in project JWildfire by thargor6.
the class TinaController method getFilterKernelPreviewPanel.
private ImagePanel getFilterKernelPreviewPanel() {
if (data.filterKernelPreviewPanel == null) {
int width = data.filterKernelPreviewRootPnl.getWidth();
int height = data.filterKernelPreviewRootPnl.getHeight();
SimpleImage img = new SimpleImage(width, height);
img.fillBackground(0, 0, 0);
data.filterKernelPreviewPanel = new ImagePanel(img, 0, 0, data.filterKernelPreviewRootPnl.getWidth());
data.filterKernelPreviewRootPnl.add(data.filterKernelPreviewPanel, BorderLayout.CENTER);
data.filterKernelPreviewRootPnl.getParent().validate();
}
return data.filterKernelPreviewPanel;
}
use of org.jwildfire.image.SimpleImage in project JWildfire by thargor6.
the class TinaController method countDown.
public void countDown(int pTime) {
for (int i = pTime; i >= 0; i--) {
Rectangle bounds = flamePreviewHelper.getPanelBounds();
SimpleImage img = new SimpleImage((int) bounds.getWidth(), (int) bounds.getHeight());
TextTransformer txt = new TextTransformer();
txt.setText1(i > 0 ? String.valueOf(i) : "go!");
txt.setAntialiasing(true);
txt.setColor(Color.RED);
txt.setMode(Mode.NORMAL);
txt.setFontStyle(FontStyle.BOLD);
txt.setFontName("Arial");
txt.setFontSize(64);
txt.setHAlign(HAlignment.CENTRE);
txt.setVAlign(VAlignment.CENTRE);
txt.transformImage(img);
flamePreviewHelper.setImage(img);
flamePreviewHelper.forceRepaint();
try {
Thread.sleep(i > 0 ? 500 : 50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Aggregations