package rainbowPackage;

import javafx.scene.paint.Paint.*;
import javafx.scene.paint.Color;

public class ColorTooSimilar //Basic Class For Determining If 2 Colors Are Too Similar To Be Discerned By The Eye, To Be Accessed By RainbowSoft2D.java
{
	public boolean tooSimilar;// = {0,0,0};
	
	public ColorTooSimilar()//1st Square DiagnosticsClass.java
	{
		tooSimilar = false;
	}
	
	public ColorTooSimilar(boolean TooSimilar)//2nd Square DiagnosticsClass.java
	{
		tooSimilar = TooSimilar;
	}
	
	public Boolean ColorTooSimilarFunction( int Color1, int Color2 )//3rd Square DiagnosticsClass.java
	{
	    int color1A = (Color1 >> 24) & 0xff;
	    int color1R = (Color1 >> 16) & 0xff;
	    int color1G = (Color1 >> 8) & 0xff;
	    int color1B = (Color1) & 0xff;
	    int color2A = (Color2 >> 24) & 0xff;
	    int color2R = (Color2 >> 16) & 0xff;
	    int color2G = (Color2 >> 8) & 0xff;
	    int color2B = (Color2) & 0xff;
		/*Color1 = Math.abs(Color1);
		int Color1A = Color1 / 16777216;
		int Color1R = ( Color1 - Color1A * 16777216 ) / 65536;
		int Color1G = ( Color1 - Color1A * 16777216 - Color1R * 65536 ) / 256;
		int Color1B = ( Color1 - Color1A * 16777216 - Color1R * 65536 - Color1G * 256);
		Color2 = Math.abs(Color2);
		int Color2A = Color2 / 16777216;
		int Color2R = ( Color2 - Color2A * 16777216 ) / 65536;
		int Color2G = ( Color2 - Color2A * 16777216 - Color2R * 65536 ) / 256;
		int Color2B = ( Color2 - Color2A * 16777216 - Color2R * 65536 - Color2G * 256);
		System.out.println("Color1: " +  Color1);
		System.out.println("Color1A: " +  Color1A);
		System.out.println("Color1R: " +  Color1R);
		System.out.println("Color1G: " +  Color1G);
		System.out.println("Color1B: " +  Color1B);
		System.out.println("Color2: " +  Color2);
		System.out.println("Color2A: " +  Color2A);
		System.out.println("Color2R: " +  Color2R);
		System.out.println("Color2G: " +  Color2G);
		System.out.println("Color2B: " +  Color2B);//*/
		int colorDifference = Math.abs(Math.abs(color1A) - Math.abs(color2A)) + Math.abs(Math.abs(color1R) - Math.abs(color2R)) + Math.abs(Math.abs(color1G) - Math.abs(color2G)) + Math.abs(Math.abs(color1B) - Math.abs(color2B));
		if ( colorDifference <= 164 )//200 )
			tooSimilar = true;
		else
			tooSimilar = false;
		//System.out.println("colorDifference: " + colorDifference);
		//System.out.println(TooSimilar);
		return tooSimilar;
	}
	public Boolean ColorTooSimilarFunction( Color Color1, Color Color2 )//4th Square DiagnosticsClass.java
	{
		int colorDifference = (int)(Math.abs(255 * Math.abs(Color1.getOpacity()) - Math.abs(Color2.getOpacity())) + Math.abs(Math.abs(Color1.getRed()) - Math.abs(Color2.getRed())) + Math.abs(Math.abs(Color1.getGreen()) - Math.abs(Color2.getGreen())) + Math.abs(Math.abs(Color1.getBlue()) - Math.abs(Color2.getBlue())));
		if ( colorDifference <= 164 )//200 )
			tooSimilar = true;
		else
			tooSimilar = false;
		//System.out.println("colorDifference: " + colorDifference);
		//System.out.println(TooSimilar);
		return tooSimilar;
	}
	public Boolean ColorTooSimilarFunction( int Color1, int Color2, double ColorDifference )//3rd Square DiagnosticsClass.java
	{
	    int color1A = (Color1 >> 24) & 0xff;
	    int color1R = (Color1 >> 16) & 0xff;
	    int color1G = (Color1 >> 8) & 0xff;
	    int color1B = (Color1) & 0xff;
	    int color2A = (Color2 >> 24) & 0xff;
	    int color2R = (Color2 >> 16) & 0xff;
	    int color2G = (Color2 >> 8) & 0xff;
	    int color2B = (Color2) & 0xff;
		int colorDifference = Math.abs(Math.abs(color1A) - Math.abs(color2A)) + Math.abs(Math.abs(color1R) - Math.abs(color2R)) + Math.abs(Math.abs(color1G) - Math.abs(color2G)) + Math.abs(Math.abs(color1B) - Math.abs(color2B));
		if ( colorDifference <= ColorDifference )//200 )
			tooSimilar = true;
		else
			tooSimilar = false;
		//System.out.println("colorDifference: " + colorDifference);
		//System.out.println(TooSimilar);
		return tooSimilar;
	}
	public Boolean ColorTooSimilarFunction( Color Color1, Color Color2, double ColorDifference )//4th Square DiagnosticsClass.java
	{
		int colorDifference = (int)(255 * Math.abs(Math.abs(Color1.getOpacity()) - Math.abs(Color2.getOpacity())) + Math.abs(Math.abs(Color1.getRed()) - Math.abs(Color2.getRed())) + Math.abs(Math.abs(Color1.getGreen()) - Math.abs(Color2.getGreen())) + Math.abs(Math.abs(Color1.getBlue()) - Math.abs(Color2.getBlue())));
		if ( colorDifference <= ColorDifference )//200 )
			tooSimilar = true;
		else
			tooSimilar = false;
		//System.out.println("colorDifference: " + colorDifference);
		//System.out.println(TooSimilar);
		return tooSimilar;
	}

	public void set(boolean TooSimilar) { tooSimilar = TooSimilar; }//5th Square DiagnosticsClass.java
	public Object get() { return tooSimilar; }//6th Square DiagnosticsClass.java
}