Search in sources :

Example 1 with RandomFlameGeneratorSample

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

the class RandomFlameMutation method execute.

@Override
public void execute(Layer pLayer) {
    RandomFlameGenerator randGen = new AllRandomFlameGenerator();
    int palettePoints = 3 + Tools.randomInt(68);
    boolean fadePaletteColors = Math.random() > 0.33;
    boolean uniformWidth = Math.random() > 0.75;
    int IMG_WIDTH = 80;
    int IMG_HEIGHT = 60;
    RandomFlameGeneratorSampler sampler = new RandomFlameGeneratorSampler(IMG_WIDTH, IMG_HEIGHT, Prefs.getPrefs(), randGen, RandomSymmetryGeneratorList.SPARSE, RandomGradientGeneratorList.DEFAULT, palettePoints, fadePaletteColors, uniformWidth, RandomBatchQuality.NORMAL);
    RandomFlameGeneratorSample sample = sampler.createSample();
    pLayer.assign(sample.getFlame().getFirstLayer());
}
Also used : AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) RandomFlameGeneratorSample(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSample) RandomFlameGeneratorSampler(org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler) AllRandomFlameGenerator(org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator) RandomFlameGenerator(org.jwildfire.create.tina.randomflame.RandomFlameGenerator)

Example 2 with RandomFlameGeneratorSample

use of org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSample 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)

Aggregations

RandomFlameGeneratorSample (org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSample)2 RandomFlameGeneratorSampler (org.jwildfire.create.tina.randomflame.RandomFlameGeneratorSampler)2 ArrayList (java.util.ArrayList)1 AllRandomFlameGenerator (org.jwildfire.create.tina.randomflame.AllRandomFlameGenerator)1 RandomFlameGenerator (org.jwildfire.create.tina.randomflame.RandomFlameGenerator)1 SimpleImage (org.jwildfire.image.SimpleImage)1