//www.RainbowFirm.com's Rainbow Software For Developing Variated Rainbow/Custom-Color Videos, Pictures, And Browsing
package rainbowPackage;

import java.awt.Dimension;

import javafx.application.Application;

//import android.graphics.Color;

import javafx.application.Platform;
import javafx.scene.*;
import javafx.scene.paint.Paint.*;
import javafx.scene.paint.Color.*;
import javafx.scene.Scene;
import javafx.stage.*;
import javafx.stage.Stage;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javafx.scene.input.MouseEvent;

import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.image.*;
//import javafx.scene.input.KeyEvent;

import javafx.fxml.FXMLLoader;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.scene.SnapshotParameters;

import java.awt.*;
import java.awt.image.*;
//import java.awt.event.ActionEvent;
import java.awt.Dimension;
import java.lang.Object;
import java.io.InputStream;
import java.io.File;
import javax.imageio.ImageIO;//Keep For .png Image Creation
import java.io.IOException;
import java.nio.ByteBuffer;

import javafx.scene.paint.Color;
import javafx.geometry.Rectangle2D;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyCodeCombination;
//import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.image.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.image.WritableImage.*;
//import javafx.scene.input.KeyEvent;
//import javafx.scene.layout.VBox;
import javafx.scene.text.*;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.scene.layout.*;
//import javafx.scene.shape.*;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.concurrent.Worker.State;
//import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

//import java.util.Timer;
//import java.util.TimerTask;
import java.lang.Object.*;
/////import org.apache.commons.io.*;
import java.io.PrintWriter;
import java.io.PrintStream;
import javax.swing.JFileChooser;
//import javafx.stage.DirectoryChooser;
//import javafx.stage.FileChooser;
import javafx.embed.swing.SwingFXUtils;
import javafx.embed.swing.SwingFXUtils.*;
//import org.openqa.selenium.By;
//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.firefox.FirefoxDriver;

//import com.sun.tools.javac.api.JavacTaskPool.Worker;

//import org.apache.commons.io.FileUtils;

//import org.openqa.selenium.OutputType;

//import org.openqa.selenium.TakesScreenshot;

import java.io.*;

import org.jcodec.api.SequenceEncoder;
import org.jcodec.api.SequenceEncoder.*;
import org.jcodec.api.awt.AWTSequenceEncoder;
import org.jcodec.common.Codec;
import org.jcodec.common.Format;
import org.jcodec.common.io.NIOUtils;
import org.jcodec.common.io.SeekableByteChannel;
import org.jcodec.common.model.Rational;
import org.jcodec.scale.AWTUtil;
import org.jcodec.api.*;
import java.nio.channels.*;
//import java.nio.channels.SeekableByteChannel;
import org.jcodec.*;//Keep For .mp4 Video Creation

//www.allaviacad.com Owns
//www.freeworldalliance.org Which Operates
//www.rainbowfirm.com Which Provides
//RainbowSoft® For The Pixies To Use And Control In Their Local Area Under The Angels Of The
//www.orderofmagi.com Who Protect The
//rainbowPackage Where It All Is,
//main Starts Application
//RainbowMainBody Extends Application To Begin
//start Which Starts Threading
//Which Runs Setup
//Which Begins Engine To Deploy
//RainbodSoft2D Which Maintains Loop Of
//RainbowVideo.java Which Accesses
//RainbowColorCodeSchemes.java For Frames
//Which Uses RainbowSoftColorCodes.java Of
//RainbowSoftColorCode.java Codes Of
//VibrantColors.java Class To Configure Where Patterns Are Displayed Through Accessing
//RainbowPattern2D.java For Each Rainbow/Custom Pattern, Which Accesses
//RainbowSoftColor.java For Each Rainbow/Custom Color Determination, Which Uses
//ColorSlider.java For Variation Determination Between 2 Of Each Color Points And Can Use
//TranspaerencySlider.java As Well For Transparency Determination At The Same Time, And The
//ColorTooSimilar.java Class Is For Checking To See If 2 Colors Are To Similar For Another Color To Be Displayed Allowing Text To Be Seen Throughout
//RainbowFirm's®
//Rainbow Hardware® Developments That Make
//RainbowSoft's®
//Proprietary Rainbow Software Which With Proper Computational Support And Expertise Makes
//Ideal Variated Rainbow/Custom Videos

/*public class RainbowMainBody {

	public RainbowMainBody() {
		// TODO Auto-generated constructor stub
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}*/
public class RainbowMainBody extends Application 
{	
	/* RainbowMainBody.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
    {
        public void handle(MouseEvent event) 
        {
            System.exit(0);
        }
    });// */
	@Override
	public void start(Stage zeroStage) throws IOException
	{
		Thread zeroThread = new Thread();//(() -> {

		zeroStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
		{
			public void handle(MouseEvent event) 
			{
				System.exit(0);
			}
		});

		try { Thread.sleep(400); }
		catch (InterruptedException exc) { throw new Error("Unexpected interruption", exc); }
		// Update text on FX Application Thread:
		/*stage.addEventHandler(KeyEvent.KEY_RELEASED, (KeyEvent event) -> {
	        if (KeyCode.ESCAPE == event.getCode()) {
	            stage.close();
	        }
	    });//*/
		/*stage.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
			public void handle(KeyEvent event) {
				if (changeHotkey) {
					if (addHotkey(event, changeHotkeyFunction)) {
						changeHotkey = false;
					}
				}
			}
		});//*/

		Platform.runLater(new Runnable() {
			public void run()
			{
				//@Override
				zeroStage.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
				{
					@Override
					public void handle(MouseEvent event) 
					{
						System.exit(0);
					}
				});// */

				//try { onKeyPressed (KeyEvent); }
				//catch(IOException ie) { ie.printStackTrace(); }
				try { RainbowSetup.Setup(zeroStage, zeroThread ); }
				catch(IOException ie) { ie.printStackTrace(); }
			}
		});

		zeroThread.setDaemon(true);
		zeroThread.start();
	}
	
	//@Override
	public void onKeyPressed(KeyEvent SecondEvent) {
		if (SecondEvent.getKeyCode() == KeyCode.ESCAPE.hashCode()) {
			System.exit(0);
		}
	}// */
	
	public static void main(String[] args) throws IOException
	{
		/*args.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>()
        {
            public void handle(MouseEvent event) 
            {
                System.exit(0);
            }
        });// */
		launch(args);

	}

}