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 = false;// = {0,0,0};
	public int currentColorDifference = 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)//28th Square DiagnosticsClass.java
	{
		tooSimilar = false;
		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 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);
		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);// */
		int colorDifference = Math.abs(color1A - color2A) + Math.abs(color1R - color2R) + Math.abs(color1G - color2G) + Math.abs(color1B - color2B);
		if ( colorDifference <= 164 )
			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
	{
		currentColorDifference = (int)( 255 * ( Math.abs( Color1.getOpacity() - Color2.getOpacity() ) + Math.abs( Color1.getRed() - Color2.getRed() ) + Math.abs( Color1.getGreen() - Color2.getGreen() ) + Math.abs( Color1.getBlue() - Color2.getBlue() ) ) );
		if ( currentColorDifference <= 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
	{
		tooSimilar = false;
		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(color1A - color2A) + Math.abs(color1R - color2R) + Math.abs(color1G - color2G) + Math.abs(color1B - 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
	{
		currentColorDifference = (int)( 255 * ( Math.abs( Color1.getOpacity() - Color2.getOpacity() ) + Math.abs( Color1.getRed() - Color2.getRed() ) + Math.abs( Color1.getGreen() - Color2.getGreen() ) + Math.abs( Color1.getBlue() - Color2.getBlue() ) ) );
		if ( currentColorDifference <= 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
}