diff --git a/Models/ReactionTest.cs b/Models/ReactionTest.cs --- a/Models/ReactionTest.cs +++ b/Models/ReactionTest.cs @@ -216,7 +216,23 @@ namespace DesertPaintCodex.Models // SPECIAL CASE: // Check to see if we've got a white-shift reaction that's partially clipped, where we can // still extrapolate the reaction, based on the available information. - if (!testing3Way && (reaction != null)) + bool isWhiteShift = (reaction != null) && Clipped switch + { + ClipType.RedLow => (reaction.Blue == reaction.Green) && (reaction.Blue != 0), + ClipType.RedHigh => (reaction.Blue == reaction.Green) && (reaction.Blue != 0), + ClipType.BlueLow => (reaction.Red == reaction.Green) && (reaction.Red != 0), + ClipType.BlueHigh => (reaction.Red == reaction.Green) && (reaction.Red != 0), + ClipType.GreenLow => (reaction.Red == reaction.Blue) && (reaction.Red != 0), + ClipType.GreenHigh => (reaction.Red == reaction.Blue) && (reaction.Red != 0), + ClipType.RedLow|ClipType.BlueLow => (reaction.Green < 0), + ClipType.RedLow|ClipType.GreenLow => (reaction.Blue < 0), + ClipType.BlueLow|ClipType.GreenLow => (reaction.Red < 0), + ClipType.RedHigh | ClipType.BlueHigh => (reaction.Green > 0), + ClipType.RedHigh | ClipType.GreenHigh => (reaction.Blue > 0), + ClipType.BlueHigh | ClipType.GreenHigh => (reaction.Red > 0), + _ => false + }; + if (!testing3Way && (reaction != null) && isWhiteShift) { PaintColor baseColor = _recipe.BaseColor; if ((reaction.Red < 0) && @@ -226,7 +242,7 @@ namespace DesertPaintCodex.Models // White-shift down clip. extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Red, 0, reaction.Red); if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Green, 0, reaction.Green); - if (!extrapolated) ExtrapolateWhiteFromOneChannel(_observedColor.Blue, 0, reaction.Blue); + if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Blue, 0, reaction.Blue); } else if ((reaction.Red > 0) && (reaction.Green > 0) && @@ -235,7 +251,7 @@ namespace DesertPaintCodex.Models // White-shift up clip. extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Red, 255, reaction.Red); if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Green, 255, reaction.Green); - if (!extrapolated) ExtrapolateWhiteFromOneChannel(_observedColor.Blue, 255, reaction.Blue); + if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Blue, 255, reaction.Blue); } }