Search in sources :

Example 21 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer in project JWildfire by thargor6.

the class Boarders2Test method testTransformXbigXNeg.

@Test
public void testTransformXbigXNeg() {
    XYZPoint pt = new XYZPoint();
    pt.y = .4;
    pt.x = -.5;
    pt.z = 1;
    XYZPoint pt2 = new XYZPoint();
    pt2.y = .4;
    pt2.x = -.5;
    pt2.z = 1;
    Boarders2Func bf = new Boarders2Func();
    bf.setParameter("right", 0);
    bf.init(null, null, new XForm(), 10);
    Flame f = new Flame();
    f.setHeight(500);
    f.setWidth(500);
    f.setName("test1");
    bf.transform(new FlameTransformationContext(new FlameRenderer(f, Prefs.getPrefs(), true, false), new ZigguratRandomGenerator(), 1), new XForm(), pt, pt2, 10);
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) ZigguratRandomGenerator(org.jwildfire.create.tina.random.ZigguratRandomGenerator) Flame(org.jwildfire.create.tina.base.Flame) Test(org.junit.Test)

Example 22 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer in project JWildfire by thargor6.

the class JWildfireApplet method renderButton_clicked.

public void renderButton_clicked() {
    clearScreen();
    ImgSize size = getImgSize();
    RenderInfo info = new RenderInfo(size.getWidth(), size.getHeight(), RenderMode.PREVIEW);
    Flame flame = getCurrFlame();
    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());
    flame.setSampleDensity(10);
    info.setRenderHDR(false);
    info.setRenderZBuffer(false);
    new FlameBGColorHandler(flame).fillBackground(image);
    initRender(prefs.getTinaRenderThreads());
    renderer = new FlameRenderer(flame, prefs, flame.isBGTransparency(), false);
    renderer.registerIterationObserver(this);
    renderStartTime = System.currentTimeMillis();
    pausedRenderTime = 0;
    threads = renderer.startRenderFlame(info);
    state = State.RENDER;
    enableControls();
}
Also used : FlameBGColorHandler(org.jwildfire.create.tina.render.FlameBGColorHandler) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) Flame(org.jwildfire.create.tina.base.Flame)

Example 23 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer in project JWildfire by thargor6.

the class DancingFractalsController method refreshFlameImage.

public void refreshFlameImage(Flame flame, boolean pDrawTriangles, double pFPS, long pFrame, boolean pDrawFPS) {
    FlamePanel imgPanel = getFlamePanel();
    if (imgPanel == null)
        return;
    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);
        if (flame != null) {
            double oldSpatialFilterRadius = flame.getSpatialFilterRadius();
            double oldSampleDensity = flame.getSampleDensity();
            imgPanel.setDrawTriangles(pDrawTriangles);
            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());
                Flame renderFlame = new FlamePreparer(prefs).createRenderFlame(flame);
                FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
                renderer.setProgressUpdater(null);
                RenderedFlame res = renderer.renderFlame(info);
                SimpleImage img = res.getImage();
                if (pDrawFPS) {
                    TextTransformer txt = new TextTransformer();
                    txt.setText1("fps: " + Tools.doubleToString(pFPS) + ", time: " + Tools.doubleToString(pFrame / 1000.0) + "s");
                    txt.setAntialiasing(false);
                    txt.setColor(Color.LIGHT_GRAY);
                    txt.setMode(Mode.NORMAL);
                    txt.setFontStyle(FontStyle.PLAIN);
                    txt.setFontName("Arial");
                    txt.setFontSize(10);
                    txt.setHAlign(HAlignment.LEFT);
                    txt.setVAlign(VAlignment.BOTTOM);
                    txt.transformImage(img);
                }
                imgPanel.setImage(img);
            } finally {
                flame.setSpatialFilterRadius(oldSpatialFilterRadius);
                flame.setSampleDensity(oldSampleDensity);
            }
        }
    } else {
        try {
            imgPanel.setImage(new SimpleImage(width, height));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    flameRootPanel.repaint();
}
Also used : SimpleImage(org.jwildfire.image.SimpleImage) Rectangle(java.awt.Rectangle) TextTransformer(org.jwildfire.transform.TextTransformer) FlamePanel(org.jwildfire.create.tina.swing.flamepanel.FlamePanel) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 24 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer in project JWildfire by thargor6.

the class DancingFractalsController method refreshPoolPreviewFlameImage.

public void refreshPoolPreviewFlameImage(Flame flame) {
    FlamePanel imgPanel = getPoolPreviewFlamePanel();
    if (imgPanel == null)
        return;
    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);
        if (flame != null) {
            imgPanel.setDrawTriangles(false);
            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());
            Flame renderFlame = new FlamePreparer(prefs).createRenderFlame(flame);
            FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, false);
            renderer.setProgressUpdater(null);
            RenderedFlame res = renderer.renderFlame(info);
            imgPanel.setImage(res.getImage());
        } else {
            imgPanel.setImage(new SimpleImage(width, height));
        }
    } else {
        imgPanel.setImage(new SimpleImage(width, height));
    }
    poolFlamePreviewPnl.repaint();
}
Also used : SimpleImage(org.jwildfire.image.SimpleImage) Rectangle(java.awt.Rectangle) FlamePanel(org.jwildfire.create.tina.swing.flamepanel.FlamePanel) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 25 with FlameRenderer

use of org.jwildfire.create.tina.render.FlameRenderer in project JWildfire by thargor6.

the class CacheRendererThread method renderFlame.

private SimpleImage renderFlame(FlameFlatNode pNode, int pImgWidth, int pImgHeight) {
    List<Flame> flames = new FlameReader(prefs).readFlames(pNode.getFilename());
    if (flames.size() > 0) {
        Flame renderFlame = flames.get(0);
        RenderInfo info = new RenderInfo(pImgWidth, pImgHeight, RenderMode.PREVIEW);
        double wScl = (double) info.getImageWidth() / (double) renderFlame.getWidth();
        double hScl = (double) info.getImageHeight() / (double) renderFlame.getHeight();
        renderFlame.setPixelsPerUnit((wScl + hScl) * 0.5 * renderFlame.getPixelsPerUnit());
        renderFlame.setWidth(pImgWidth);
        renderFlame.setHeight(pImgHeight);
        renderFlame.setSampleDensity(prefs.getTinaRenderPreviewQuality() / 3.0);
        FlameRenderer renderer = new FlameRenderer(renderFlame, prefs, false, true);
        RenderedFlame renderRes = renderer.renderFlame(info);
        return renderRes.getImage();
    }
    return null;
}
Also used : FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameRenderer(org.jwildfire.create.tina.render.FlameRenderer) RenderInfo(org.jwildfire.create.tina.render.RenderInfo) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Aggregations

FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)34 RenderInfo (org.jwildfire.create.tina.render.RenderInfo)28 Flame (org.jwildfire.create.tina.base.Flame)27 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)25 SimpleImage (org.jwildfire.image.SimpleImage)12 Rectangle (java.awt.Rectangle)10 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)9 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)5 Test (org.junit.Test)4 XForm (org.jwildfire.create.tina.base.XForm)4 XYZPoint (org.jwildfire.create.tina.base.XYZPoint)4 ZigguratRandomGenerator (org.jwildfire.create.tina.random.ZigguratRandomGenerator)4 AbstractRenderThread (org.jwildfire.create.tina.render.AbstractRenderThread)4 DrawFocusPointFlameRenderer (org.jwildfire.create.tina.render.DrawFocusPointFlameRenderer)4 ImageIcon (javax.swing.ImageIcon)3 FlameReader (org.jwildfire.create.tina.io.FlameReader)3 FlamePanelConfig (org.jwildfire.create.tina.swing.flamepanel.FlamePanelConfig)3 File (java.io.File)2 ResolutionProfile (org.jwildfire.base.ResolutionProfile)2 Layer (org.jwildfire.create.tina.base.Layer)2