use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class FlamePreviewHelper method refreshFlameImage.
public void refreshFlameImage(boolean pQuickRender, boolean pMouseDown, int pDownScale, boolean pReRender, boolean pAllowUseCache) {
cancelBackgroundRender();
if (pQuickRender && detachedPreviewProvider != null && detachedPreviewProvider.getDetachedPreviewController() != null && pDownScale == 1) {
detachedPreviewProvider.getDetachedPreviewController().setFlame(flameHolder.getFlame());
}
FlamePanel imgPanel = flamePanelProvider.getFlamePanel();
FlamePanelConfig cfg = flamePanelProvider.getFlamePanelConfig();
if (pReRender) {
if (!pQuickRender || !isProgressivePreviewEnabled(cfg)) {
SimpleImage img = renderFlameImage(pQuickRender, pMouseDown, pDownScale, pAllowUseCache);
if (img != null) {
imgPanel.setImage(img);
}
}
}
imgPanel.setBounds(imgPanel.getParentImageBounds());
if (!cfg.isNoControls()) {
centerPanel.getParent().validate();
centerPanel.repaint();
} else {
imgPanel.repaint();
}
if (pReRender && isProgressivePreviewEnabled(cfg) && pQuickRender) {
if (pAllowUseCache) {
SimpleImage img = renderFlameImage(pQuickRender, pMouseDown, pDownScale, pAllowUseCache);
if (img != null) {
imgPanel.setImage(img);
}
} else {
startBackgroundRender(imgPanel);
}
}
if (pQuickRender && !cfg.isNoControls() && randomBatchHolder != null) {
refreshThumbnail();
}
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class EnvelopeDialog method refreshFlameImage.
public void refreshFlameImage() {
FlamePanel imgPanel = getFlamePanel();
Rectangle bounds = imgPanel.getImageBounds();
int width = bounds.width;
int height = bounds.height;
if (width >= 16 && height >= 16) {
RenderInfo info = new RenderInfo(width, height, RenderMode.PREVIEW);
Flame flame = getFlame();
if (flame != null) {
double oldSpatialFilterRadius = flame.getSpatialFilterRadius();
double oldSampleDensity = flame.getSampleDensity();
try {
double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
flame.setWidth(info.getImageWidth());
flame.setHeight(info.getImageHeight());
FlameRenderer renderer = new FlameRenderer(flame, Prefs.getPrefs(), false, false);
renderer.setProgressUpdater(null);
if (flame.getSolidRenderSettings().isSolidRenderingEnabled()) {
flame.setCamDOF(0.0);
flame.getSolidRenderSettings().setAoEnabled(false);
if (ShadowType.SMOOTH.equals(flame.getSolidRenderSettings().getShadowType())) {
flame.getSolidRenderSettings().setShadowType(ShadowType.FAST);
} else {
flame.getSolidRenderSettings().setShadowType(ShadowType.OFF);
}
flame.setSampleDensity(Prefs.getPrefs().getTinaRenderRealtimeQuality() * 2.0);
} else {
flame.setSampleDensity(Prefs.getPrefs().getTinaRenderRealtimeQuality() * 6.0);
}
flame.setSpatialFilterRadius(0.0);
RenderedFlame res = renderer.renderFlame(info);
imgPanel.setImage(res.getImage());
} finally {
flame.setSpatialFilterRadius(oldSpatialFilterRadius);
flame.setSampleDensity(oldSampleDensity);
}
}
} else {
imgPanel.setImage(new SimpleImage(width, height));
}
getPreviewRootPanel().repaint();
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class IFlamesController method getFlamePanel.
@Override
public FlamePanel getFlamePanel() {
if (flamePanel == null) {
Prefs prefs = Prefs.getPrefs();
int width = centerPanel.getWidth();
int height = centerPanel.getHeight();
SimpleImage img = new SimpleImage(width, height);
img.fillBackground(0, 0, 0);
flamePanel = new FlamePanel(prefs, img, 0, 0, centerPanel.getWidth(), this, null);
flamePanel.getConfig().setWithColoredTransforms(prefs.isTinaEditorControlsWithColor());
flamePanel.setFlamePanelTriangleMode(prefs.getTinaEditorControlsStyle());
flamePanel.getConfig().setProgressivePreview(prefs.isTinaEditorProgressivePreview());
flamePanel.importOptions(prevFlamePanel);
prevFlamePanel = null;
ResolutionProfile resProfile = getResolutionProfile();
flamePanel.setRenderWidth(resProfile.getWidth());
flamePanel.setRenderHeight(resProfile.getHeight());
flamePanel.setFocusable(true);
if (firstFlamePanel) {
centerPanel.remove(0);
firstFlamePanel = false;
}
centerPanel.add(flamePanel, BorderLayout.CENTER);
centerPanel.getParent().validate();
centerPanel.repaint();
flamePanel.requestFocusInWindow();
}
return flamePanel;
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class IFlamesController method refreshBaseFlamePreview.
private void refreshBaseFlamePreview() {
FlamePanel imgPanel = getBaseFlamePreviewPanel();
Rectangle bounds = imgPanel.getImageBounds();
int width = bounds.width;
int height = bounds.height;
if (width >= 16 && height >= 16) {
RenderInfo info = new RenderInfo(width, height, RenderMode.PREVIEW);
Flame flame = getBaseFlame();
if (flame != null) {
double oldSpatialFilterRadius = flame.getSpatialFilterRadius();
double oldSampleDensity = flame.getSampleDensity();
try {
double wScl = (double) info.getImageWidth() / (double) flame.getWidth();
double hScl = (double) info.getImageHeight() / (double) flame.getHeight();
flame.setPixelsPerUnit((wScl + hScl) * 0.5 * flame.getPixelsPerUnit());
flame.setWidth(info.getImageWidth());
flame.setHeight(info.getImageHeight());
FlameRenderer renderer = new FlameRenderer(flame, prefs, false, false);
renderer.setProgressUpdater(null);
flame.setSampleDensity(1.0);
flame.setSpatialFilterRadius(0.0);
RenderedFlame res = renderer.renderFlame(info);
imgPanel.setImage(res.getImage());
} finally {
flame.setSpatialFilterRadius(oldSpatialFilterRadius);
flame.setSampleDensity(oldSampleDensity);
}
} else {
imgPanel.setImage(new SimpleImage(width, height));
}
} else {
imgPanel.setImage(new SimpleImage(width, height));
}
baseFlamePreviewRootPnl.repaint();
}
use of org.jwildfire.create.tina.swing.flamepanel.FlamePanel in project JWildfire by thargor6.
the class MeshGenController method getFlamePanel.
private FlamePanel getFlamePanel(JPanel pRootPanel, FlameHolder pFlameHolder) {
FlamePanel flamePanel = flamepanels.get(pRootPanel);
if (flamePanel == null) {
int width = pRootPanel.getWidth();
int height = pRootPanel.getHeight();
SimpleImage img = new SimpleImage(width, height);
img.fillBackground(0, 0, 0);
flamePanel = new FlamePanel(prefs, img, 0, 0, pRootPanel.getWidth(), pFlameHolder, null);
flamePanel.setRenderWidth(renderWidthREd.getIntValue());
flamePanel.setRenderHeight(renderHeightREd.getIntValue());
flamePanel.setFocusable(true);
pRootPanel.add(flamePanel, BorderLayout.CENTER);
pRootPanel.getParent().validate();
pRootPanel.repaint();
flamePanel.requestFocusInWindow();
flamepanels.put(pRootPanel, flamePanel);
}
return flamePanel;
}
Aggregations