package rainbowPackage;

import javafx.scene.paint.Color;

public class ColorTooSimilar
{
	public boolean TooSimilar;// = {0,0,0};
	public ColorTooSimilar(boolean TooSimilar)
	{
		this.TooSimilar = TooSimilar;
	}
	public ColorTooSimilar()
	{
		this.TooSimilar = false;
	}
	public Boolean ColorTooSimilarFunction( int Color1, int Color2 )
	{
	    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(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 )
	{
		int colorDifference = (int)(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 void set(boolean TooSimilar) { this.TooSimilar = TooSimilar; }
	public Object get() { return TooSimilar; }
}