Changeset - e9358d0228ac
[Not reviewed]
default
0 1 0
Tess Snider (Malkyne) - 3 years ago 2021-07-26 08:13:39
this@malkyne.org
Now recalculating recipe (and thus hypothetical color) after a Clear. Also,
clip status now clears when doing a white extrapolation.
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
Models/ReactionTest.cs
Show inline comments
...
 
@@ -221,22 +221,22 @@ namespace DesertPaintCodex.Models
 
                            PaintColor baseColor = _recipe.BaseColor;
 
                            if ((reaction.Red < baseColor.Red) &&
 
                                (reaction.Green < baseColor.Green) &&
 
                                (reaction.Blue < baseColor.Blue))
 
                            {
 
                                // White-shift down clip.
 
                                extrapolated               = ExtrapolateWhiteFromOneChannel(_observedColor.Red,   0, reaction.Red);
 
                                extrapolated                    = ExtrapolateWhiteFromOneChannel(_observedColor.Red,   0, reaction.Red);
 
                                if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Green, 0, reaction.Green);
 
                                if (!extrapolated)                ExtrapolateWhiteFromOneChannel(_observedColor.Blue,  0, reaction.Blue);
 
                            }
 
                            else if ((reaction.Red > baseColor.Red) &&
 
                                (reaction.Green > baseColor.Green) &&
 
                                (reaction.Blue > baseColor.Blue))
 
                            {
 
                                // White-shift up clip.
 
                                extrapolated               = ExtrapolateWhiteFromOneChannel(_observedColor.Red,   255, reaction.Red);
 
                                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)
...
 
@@ -258,12 +258,13 @@ namespace DesertPaintCodex.Models
 
        }
 

	
 
        private bool ExtrapolateWhiteFromOneChannel(int result, int clipBound, int reaction)
 
        {
 
            if (result == clipBound) return false;
 
            
 
            Clipped = ClipType.None;
 
            State = TestState.GoodResult;
 
            Reaction = new Reaction(reaction, reaction, reaction);
 

	
 
            return true;
 
        }
 

	
...
 
@@ -292,12 +293,13 @@ namespace DesertPaintCodex.Models
 
            }
 
            
 
            Reaction = null;
 
            BadReaction = null;
 
            Clipped = ClipType.None;
 
            State = TestState.Untested;
 
            UpdateRecipe();
 
        }
 

	
 
        public void SaveReaction()
 
        {
 
            PlayerProfile? profile = ProfileManager.CurrentProfile;
 
            if (profile == null) return;
0 comments (0 inline, 0 general)