package rainbowPackage;

import javafx.scene.paint.Color;

public final class ColorDecide
{
	//public boolean SomeTargetColorHit = true;
	public static Color fxColor = Color.BEIGE;
	public static RainbowSoftColor rainbowSoftColor = new RainbowSoftColor( new double[]{0,0,0,1} );
	public static ColorTooSimilar colorTooSimilarFunction = new ColorTooSimilar();

	public static final Color NextColorDecide ( Color BasisColor, Color BackgroundBasisColor, Color PatternColor, Color BrowserColor, Color InitialColorContrastingChoice, Color ColorTooSimilarReplacementColor, double ColorDifference, boolean SomeTargetColorHit, boolean FinalNotReversed, boolean NextStepColorTooSimilarEffect, boolean InvertBasisFromBackground )
	{
		if ( SomeTargetColorHit && BasisColor.getOpacity() == BackgroundBasisColor.getOpacity() && 
				BasisColor.getRed() == BackgroundBasisColor.getRed() && 
				BasisColor.getGreen() == BackgroundBasisColor.getGreen() && 
				BasisColor.getBlue() == BackgroundBasisColor.getBlue() )
		{
			/*if ( browserHit && BrowserColor.getOpacity() == VibrantColors.Magenta.getOpacity() && 
						BrowserColor.getRed() == VibrantColors.Magenta.getRed() && 
						BrowserColor.getGreen() == VibrantColors.Magenta.getGreen() && 
						BrowserColor.getBlue() == VibrantColors.Magenta.getBlue() )
				{
					if ( !NextStepColorTooSimilarEffect )//!NextStepColorTooSimilarEffect For ShortCutting To Show Full Basis Below & Putting Browser Picture Over Anything And Stuff Like That Like An Emergency Auxiliary To Show Pixels. reversalOfBackgroundEffectsSlave Does Not Work When !NextStepColorTooSimilarEffect,
					{
						rainbowSoftColor = new RainbowSoftColor( PatternColor );
						rgb = rainbowSoftColor.rgb;
						argb = rainbowSoftColor.argb;
						fxColor = rainbowSoftColor.ToFXColor();// [#]/
						return PatternColor;
					}
					else if ( !rainbowSoftColor.ColorTooSimilarFunction( BrowserColor, PatternColor, ColorDifference ) )//&& reversalOfBackgroundEffectsSlave )
					{
						rainbowSoftColor = new RainbowSoftColor( PatternColor );
						rgb = rainbowSoftColor.rgb;
						argoftColor.argb;
						fxColor = rainbowSoftColor.ToFXColor();// [#]/
						return PatternColor;
					}
					else if( InvertBasisFromBackground  )//&& reversalOfBackgroundEffectsSlave )
					{
						rainbowSoftColor = new RainbowSoftColor( PatternColor );
						rgb = rainbowSoftColor.rgb;
						argb = rainbowSoftColor.argb;
						fxColor = rainbowSoftColor.ToFXColor();
						fxColor = fxColor.invert();//32 Bit Support Necessary To Maintain Cubical Cellular Modularity To Get This Reprocessed Through NextColorDecide Jump Past This then And Goto Next else
						rainbowSoftColor = new RainbowSoftColor( new double[] { 255 * fxColor.getRed(), 255 * fxColor.getGreen(), 255 * fxColor.getBlue(), fxColor.getOpacity() } );
						rgb = rainbowSoftColor.rgb;
						argb = rainbowSoftColor.argb;
						fxColor = rainbowSoftColor.ToFXColor();// [#]/
						return fxColor;
					}
					else
					{
						rainbowSoftColor.RainbowSoftColorFunction(2, 1, BrowserColor, PatternColor );
						if ( !colorTooSimilarFunction.ColorTooSimilarFunction( InitialColorContrastingChoice, rainbowSoftColor.ToFXColor(), ColorDifference ) )
						{
							rainbowSoftColor = new RainbowSoftColor( InitialColorContrastingChoice );
							rgb = rainbowSoftColor.rgb;
							argb = rainbowSoftColor.argb;
							fxColor = rainbowSoftColor.ToFXColor();// [#]/
							return InitialColorContrastingChoice;
						}
						else
						{
							rainbowSoftColor = new RainbowSoftColor( ColorTooSimilarReplacementColor );
							rgb = rainbowSoftColor.rgb;
							argb = rainbowSoftColor.argb;
							fxColor = rainbowSoftColor.ToFXColor();// [#]/
							return ColorTooSimilarReplacementColor;
						}
					}
				}
				else//*/
			//{
			rainbowSoftColor = new RainbowSoftColor( PatternColor );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();// */
			return PatternColor;
			//}
		}
		else if ( FinalNotReversed )
		{
			rainbowSoftColor = new RainbowSoftColor( BasisColor );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();// */
			return BasisColor;
		}
		else if ( !NextStepColorTooSimilarEffect )//!NextStepColorTooSimilarEffect For ShortCutting To Show Full Basis Below & Putting Browser Picture Over Anything And Stuff Like That Like An Emergency Auxiliary To Show Pixels. reversalOfBackgroundEffectsSlave Does Not Work When !NextStepColorTooSimilarEffect,
		{
			rainbowSoftColor = new RainbowSoftColor( PatternColor );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();// */
			return PatternColor;
		}
		else if ( !rainbowSoftColor.ColorTooSimilarFunction( BasisColor, PatternColor, ColorDifference ) )//&& reversalOfBackgroundEffectsSlave )
		{
			rainbowSoftColor = new RainbowSoftColor( PatternColor );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();// */
			return PatternColor;
		}
		else if( InvertBasisFromBackground  )//&& reversalOfBackgroundEffectsSlave )
		{
			rainbowSoftColor = new RainbowSoftColor( PatternColor );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();
			fxColor = fxColor.invert();//32 Bit Support Necessary To Maintain Cubical Cellular Modularity To Get This Reprocessed Through NextColorDecide Jump Past This then And Goto Next else
			rainbowSoftColor = new RainbowSoftColor( new double[] { 255 * fxColor.getRed(), 255 * fxColor.getGreen(), 255 * fxColor.getBlue(), fxColor.getOpacity() } );
			//rgb = rainbowSoftColor.rgb;
			//argb = rainbowSoftColor.argb;
			fxColor = rainbowSoftColor.ToFXColor();// */
			return fxColor;
		}
		else
		{
			rainbowSoftColor.RainbowSoftColorFunction(2, 1, BasisColor, PatternColor );
			if ( !colorTooSimilarFunction.ColorTooSimilarFunction( InitialColorContrastingChoice, rainbowSoftColor.ToFXColor(), ColorDifference ) )
			{
				rainbowSoftColor = new RainbowSoftColor( InitialColorContrastingChoice );
				//rgb = rainbowSoftColor.rgb;
				//argb = rainbowSoftColor.argb;
				fxColor = rainbowSoftColor.ToFXColor();// */
				return InitialColorContrastingChoice;
			}
			else
			{
				rainbowSoftColor = new RainbowSoftColor( ColorTooSimilarReplacementColor );
				//rgb = rainbowSoftColor.rgb;
				//argb = rainbowSoftColor.argb;
				fxColor = rainbowSoftColor.ToFXColor();// */
				return ColorTooSimilarReplacementColor;
			}
		}
		/*rainbowSoftColor = new RainbowSoftColor( VibrantColors.Maroon );
		//rgb = rainbowSoftColor.rgb;
		//argb = rainbowSoftColor.argb;
		fxColor = rainbowSoftColor.ToFXColor();
		return fxColor;// */
	}
}
