/* ZSelfProjEffectApp.java */
package org.jfx.scene.effect.coding.test1;

import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.scene.Group;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
import org.jfx.scene.effect.coding.ZSelfProjEffectCls;

/**
 * This class is only used for the test on the effect.<br>
 *
 * @author ZZZ. No copyright(c). Public Domain.
 */
public class ZSelfProjEffectApp extends Application {

    //
    protected static final Image IMG = new Image(ZSelfProjEffectApp.class.getResourceAsStream("tv.jpg"));

    protected static String getSpecialDir() { // Only as reference....Not used...
        //com.sun.prism.zes2.ZES2Pipeline;
        java.io.File file = new java.io.File("");
        // System.out.println(file.getAbsolutePath());
        // build/classes/org/jfx/scene/effect/test/special
        return file.getAbsolutePath() + "/build/classes/org/jfx/scene/effect/coding/";
    }

    protected Parent createContent() {
        //java.io.File file = new java.io.File("");
        //System.out.println(file.getAbsolutePath());
        //
        Group root = new Group();
        ImageView sample = new ImageView(IMG);
        addEffect(sample);
        root.getChildren().add(sample);
        return root;
    }

    // @Override
    protected void addEffect(ImageView sample) {
        sample.setEffect(effect);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        //primaryStage.setResizable(false);
        primaryStage.setResizable(true);
        primaryStage.setScene(new Scene(createContent()));
        primaryStage.setTitle(this.getClass().getSimpleName());
        primaryStage.show();
        doPostAction();
    }

    protected void doPostAction() {
    }

    // ========================================================================
    protected ZSelfProjEffectCls effect = new ZSelfProjEffectCls();

    /**
     * Java main for when running without JavaFX launcher
     *
     * @param args
     */
    public static void main(String[] args) {
        launch(args);
    }
}
