Search in sources :

Example 11 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.

the class TinaSWFAnimatorController method resolutionProfileCmb_changed.

public void resolutionProfileCmb_changed() {
    Flame currFlame = getCurrFlame();
    if (currFlame == null) {
        return;
    }
    ResolutionProfile profile = getResolutionProfile();
    currFlame.setResolutionProfile(profile);
    removeFlamePanel();
    previewFlameImage();
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 12 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.

the class Boarders2Test method visual.

// @Ignore
@Test
public void visual() throws Exception {
    Prefs.getPrefs().setTinaRandomNumberGenerator(RandomGeneratorType.JAVA_INTERNAL);
    System.out.println(Prefs.getPrefs().getTinaRandomNumberGenerator().name());
    int side = 600;
    ResolutionProfile respro = new ResolutionProfile(true, side, side);
    int quality = 80;
    Flame f = new Flame();
    f.setWidth(side);
    f.setHeight(side);
    f.setGamma(4.0);
    f.setBGTransparency(false);
    f.setAntialiasAmount(1.0);
    f.setAntialiasRadius(.1);
    Layer l = new Layer();
    XForm xf = new XForm();
    Boarders2Func bf = new Boarders2Func();
    bf.setParameter("c", .6);
    bf.setParameter("left", .65);
    bf.setParameter("right", .35);
    xf.addVariation(1.0, bf);
    f.setCamZoom(6.461);
    xf.setWeight(5.5);
    l.getXForms().add(xf);
    RGBPalette pal = new RGBPalette();
    for (int i = 0; i < 256; i++) pal.addColor(0, i, 255);
    pal.setFlam3Name("test");
    l.setPalette(pal);
    f.setResolutionProfile(respro);
    f.getLayers().clear();
    f.getLayers().add(l);
    // this is "scale"
    f.setPixelsPerUnit(43.75);
    new FlameWriter().writeFlame(f, "/dev/shm/test.flame");
    JobRenderThreadController controller = new HeadlessBatchRendererController();
    List<Job> joblist = new ArrayList<>();
    Job j = new Job();
    j.setCustomHeight(side);
    j.setCustomWidth(side);
    j.setCustomQuality(quality);
    j.setFlameFilename("/dev/shm/test.flame");
    joblist.add(j);
    QualityProfile qualpro = new QualityProfile();
    qualpro.setQuality(quality);
    JobRenderThread job = new JobRenderThread(controller, joblist, respro, qualpro, true);
    job.run();
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) XForm(org.jwildfire.create.tina.base.XForm) RGBPalette(org.jwildfire.create.tina.palette.RGBPalette) HeadlessBatchRendererController(org.jwildfire.create.tina.batch.HeadlessBatchRendererController) ArrayList(java.util.ArrayList) Layer(org.jwildfire.create.tina.base.Layer) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JobRenderThread(org.jwildfire.create.tina.batch.JobRenderThread) QualityProfile(org.jwildfire.base.QualityProfile) Job(org.jwildfire.create.tina.batch.Job) JobRenderThreadController(org.jwildfire.create.tina.batch.JobRenderThreadController) Flame(org.jwildfire.create.tina.base.Flame) Test(org.junit.Test)

Example 13 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.

the class HeadlessBatchRendererController method main.

public static void main(String[] args) throws Exception {
    // args = new String[]{"/dev/shm/","400","400","80"};//,"ZIGGURAT"};
    int height;
    int width;
    int quality;
    String filename;
    File f;
    List<File> files = new LinkedList<File>();
    long start = System.nanoTime();
    if (args.length < 4) {
        usage(args);
        return;
    } else {
        try {
            height = Integer.parseInt(args[1]);
            width = Integer.parseInt(args[2]);
            quality = Integer.parseInt(args[3]);
            filename = args[0].trim();
            String was = Prefs.getPrefs().getTinaRandomNumberGenerator().name();
            if (args.length > 4 && Arrays.toString(RandomGeneratorType.values()).contains(args[4])) {
                Prefs.getPrefs().setTinaRandomNumberGenerator(RandomGeneratorType.valueOf(args[4]));
                System.out.println(was + " changed to " + Prefs.getPrefs().getTinaRandomNumberGenerator().name());
            }
            f = new File(filename);
            if (!f.exists())
                throw new Exception(filename + " does not exist");
            if (f.isDirectory()) {
                final File[] listFiles = f.listFiles();
                if (listFiles != null)
                    for (File fi : listFiles) {
                        if (fi.canRead() && fi.exists() && fi.getName().toLowerCase().endsWith(".flame"))
                            files.add(fi);
                    }
            } else if (f.getName().toLowerCase().endsWith(".flame"))
                files.add(f);
        } catch (Exception e) {
            usage(args);
            System.err.println(e.getMessage());
            return;
        }
    }
    ResolutionProfile respro = new ResolutionProfile(true, width, height);
    JobRenderThreadController controller = new HeadlessBatchRendererController();
    List<Job> joblist = new ArrayList<Job>();
    for (File fi : files) {
        Job j = new Job();
        j.setCustomHeight(height);
        j.setCustomWidth(width);
        j.setCustomQuality(quality);
        j.setFlameFilename(fi.getCanonicalPath());
        joblist.add(j);
    }
    QualityProfile qualpro = new QualityProfile();
    qualpro.setQuality(quality);
    JobRenderThread job = new JobRenderThread(controller, joblist, respro, qualpro, true, false);
    job.run();
    System.out.println((System.nanoTime() - start) / 1000 / 1000 + " ms");
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) QualityProfile(org.jwildfire.base.QualityProfile) File(java.io.File)

Example 14 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.

the class ResolutionProfileDialog method applyChanges.

private boolean applyChanges() {
    try {
        final int MIN_SIZE = 16;
        int width = Integer.parseInt(getWidthREd().getText());
        if (width < MIN_SIZE) {
            throw new Exception("Width must be at least " + MIN_SIZE + " pixels");
        }
        int height = Integer.parseInt(getHeightREd().getText());
        if (height < MIN_SIZE) {
            throw new Exception("Height must be at least " + MIN_SIZE + " pixels");
        }
        ResolutionProfile profile;
        if (editStatus == EditStatus.NEW) {
            profile = new ResolutionProfile();
        } else {
            profile = (ResolutionProfile) getProfileCmb().getSelectedItem();
        }
        profile.setWidth(width);
        profile.setHeight(height);
        profile.setDefaultProfile(getDefaultCBx().isSelected());
        if (editStatus == EditStatus.NEW) {
            refreshing = true;
            try {
                getProfileCmb().addItem(profile);
                getProfileCmb().setSelectedItem(profile);
            } finally {
                refreshing = false;
            }
        }
        if (profile.isDefaultProfile()) {
            for (int i = 0; i < getProfileCmb().getItemCount(); i++) {
                ResolutionProfile lProfile = (ResolutionProfile) getProfileCmb().getItemAt(i);
                if (lProfile != profile) {
                    lProfile.setDefaultProfile(false);
                }
            }
        }
        getProfileCmb().requestFocus();
        editStatus = EditStatus.BROWSE;
        enableControls();
        configChanged = true;
        return true;
    } catch (Throwable ex) {
        getStatusLbl().setText(ex.getMessage());
        return false;
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile) Point(java.awt.Point)

Example 15 with ResolutionProfile

use of org.jwildfire.base.ResolutionProfile in project JWildfire by thargor6.

the class ResolutionProfileDialog method setProfiles.

public void setProfiles(List<ResolutionProfile> pProfiles) {
    refreshing = true;
    try {
        getProfileCmb().removeAllItems();
        if (pProfiles != null) {
            for (ResolutionProfile profile : pProfiles) {
                ResolutionProfile clonedProfile = (ResolutionProfile) profile.makeCopy();
                getProfileCmb().addItem(clonedProfile);
            }
        }
        getProfileCmb().setSelectedIndex(-1);
        editStatus = EditStatus.CLOSE;
    } finally {
        refreshing = false;
    }
}
Also used : ResolutionProfile(org.jwildfire.base.ResolutionProfile)

Aggregations

ResolutionProfile (org.jwildfire.base.ResolutionProfile)29 SimpleImage (org.jwildfire.image.SimpleImage)8 Flame (org.jwildfire.create.tina.base.Flame)7 QualityProfile (org.jwildfire.base.QualityProfile)6 ArrayList (java.util.ArrayList)5 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)5 FlamePanel (org.jwildfire.create.tina.swing.flamepanel.FlamePanel)5 Dimension (java.awt.Dimension)3 Point (java.awt.Point)3 File (java.io.File)3 XYZProjectedPoint (org.jwildfire.create.tina.base.XYZProjectedPoint)3 ImagePanel (org.jwildfire.swing.ImagePanel)3 JFileChooser (javax.swing.JFileChooser)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 Test (org.junit.Test)2 Layer (org.jwildfire.create.tina.base.Layer)2 XForm (org.jwildfire.create.tina.base.XForm)2 HeadlessBatchRendererController (org.jwildfire.create.tina.batch.HeadlessBatchRendererController)2 Job (org.jwildfire.create.tina.batch.Job)2