package io.gitlab.jfronny.ImgJava;

import io.gitlab.jfronny.ImgJava.imageProcessing.ImageUtil;
import io.gitlab.jfronny.ImgJava.util.ImageStackViewer;
import io.gitlab.jfronny.ImgJava.util.Picture;

import java.awt.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static void main(String[] args) {
        try {
            ImageStackViewer stackViewer = new ImageStackViewer(new Dimension(1000, 1000));
            stackViewer.setTitle("Jf Example");
            Path run = Paths.get("./run/");
            if (!Files.isDirectory(run))
                Files.createDirectory(run);
            Picture pict = stackViewer.push(new Picture("iris.jpg"));
            pict = stackViewer.push(ImageUtil.mirror(pict, ImageUtil.MirrorMode.Horizontal));
            pict = stackViewer.push(ImageUtil.mirror(pict, ImageUtil.MirrorMode.Vertical));
            pict = stackViewer.push(ImageUtil.rotate(pict, ImageUtil.RotateMode.Left));
            pict = stackViewer.push(ImageUtil.rotate(pict, ImageUtil.RotateMode.Right));
            pict = stackViewer.push(ImageUtil.mirror(pict, ImageUtil.MirrorMode.Vertical));
            //pict = stackViewer.push(ImageUtil.blurBox(pict, 10));
            pict = stackViewer.push(ImageUtil.blurGauss(pict, 3));
            pict = stackViewer.push(ImageUtil.sharpen(pict, 3));
            pict.save(run.resolve("moscov.png"));
            stackViewer.repaint();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
