Search in sources :

Example 6 with RandomFlameGeneratorSampler

use of org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler in project JWildfire by thargor6.

the class TinaController method createRandomBatch.

public boolean createRandomBatch(int pCount, RandomFlameGenerator randGen, RandomSymmetryGenerator randSymmGen, RandomGradientGenerator randGradientGen, RandomBatchQuality pQuality) {
    stopPreviewRendering();
    if (!confirmNewRandomBatch(randGen.getName()))
        return false;
    if (prefs.getTinaRandomBatchRefreshType() == RandomBatchRefreshType.CLEAR) {
        randomBatch.clear();
    }
    int imgCount = prefs.getTinaRandomBatchSize();
    List<SimpleImage> imgList = new ArrayList<SimpleImage>();
    int maxCount = (pCount > 0 ? pCount : imgCount);
    mainProgressUpdater.initProgress(maxCount);
    for (int i = 0; i < maxCount; i++) {
        int palettePoints = 7 + Tools.randomInt(24);
        boolean fadePaletteColors = Math.random() > 0.06;
        boolean uniformWidth = Math.random() > 0.75;
        RandomFlameGeneratorSampler sampler = new RandomFlameGeneratorSampler(FlameThumbnail.IMG_WIDTH / 2, FlameThumbnail.IMG_HEIGHT / 2, prefs, randGen, randSymmGen, randGradientGen, palettePoints, fadePaletteColors, uniformWidth, pQuality);
        RandomFlameGeneratorSample sample = sampler.createSample();
        FlameThumbnail thumbnail;
        thumbnail = new FlameThumbnail(sample.getFlame(), null, null);
        SimpleImage img = thumbnail.getPreview(3 * prefs.getTinaRenderPreviewQuality() / 4);
        if (prefs.getTinaRandomBatchRefreshType() == RandomBatchRefreshType.INSERT) {
            randomBatch.add(0, thumbnail);
            imgList.add(0, img);
        } else {
            randomBatch.add(thumbnail);
            imgList.add(img);
        }
        mainProgressUpdater.updateProgress(i + 1);
    }
    updateThumbnails();
    enableControls();
    return true;
}
Also used : RandomFlameGeneratorSample(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSample) SimpleImage(org.jwildfire.image.SimpleImage) ArrayList(java.util.ArrayList) RandomFlameGeneratorSampler(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler)

Example 7 with RandomFlameGeneratorSampler

use of org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler in project JWildfire by thargor6.

the class TinaInteractiveRendererController method genRandomFlame.

public void genRandomFlame() {
    final int IMG_WIDTH = 80;
    final int IMG_HEIGHT = 60;
    RandomFlameGenerator randGen = RandomFlameGeneratorList.getRandomFlameGeneratorInstance((String) randomStyleCmb.getSelectedItem(), true);
    int palettePoints = 3 + Tools.randomInt(68);
    boolean fadePaletteColors = Math.random() > 0.33;
    boolean uniformWidth = Math.random() > 0.75;
    RandomFlameGeneratorSampler sampler = new RandomFlameGeneratorSampler(IMG_WIDTH, IMG_HEIGHT, prefs, randGen, RandomSymmetryGeneratorList.SPARSE, RandomGradientGeneratorList.DEFAULT, palettePoints, fadePaletteColors, uniformWidth, RandomBatchQuality.HIGH);
    currFlame = sampler.createSample().getFlame();
    storeCurrFlame();
}
Also used : RandomFlameGeneratorSampler(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler) XYZProjectedPoint(org.jwildfire.create.tina.base.XYZProjectedPoint) RandomFlameGenerator(org.jwildfire.create.tina.randomflame.RandomFlameGenerator)

Aggregations

RandomFlameGeneratorSampler (org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler)7 RandomFlameGenerator (org.jwildfire.create.tina.randomflame.RandomFlameGenerator)5 AllRandomFlameGenerator (org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator)3 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)2 RandomFlameGeneratorSample (org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSample)2 ArrayList (java.util.ArrayList)1 Flame (org.jwildfire.create.tina.base.Flame)1 WikimediaCommonsRandomFlameGenerator (org.jwildfire.create.tina.randomflame.WikimediaCommonsRandomFlameGenerator)1 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)1 SimpleImage (org.jwildfire.image.SimpleImage)1