Changeset - eee2a6a0c86b
[Not reviewed]
default
0 3 0
Jason Maltzen (jmaltzen) - 9 years ago 2016-03-04 06:23:05
jason.maltzen@unsanctioned.net
Loosen checks on testing for papyrus texture some more. Allow for a bit of error there, as long as everything else checks out.
3 files changed with 20 insertions and 17 deletions:
0 comments (0 inline, 0 general)
MainWindow.cs
Show inline comments
...
 
@@ -30,5 +30,5 @@ using DesertPaintLab;
 
public partial class MainWindow : Gtk.Window
 
{
 
    const string APP_VERSION = "1.7.13";
 
    const string APP_VERSION = "1.7.14";
 

	
 
	bool unsavedData = false;
ReactionRecorder.cs
Show inline comments
...
 
@@ -97,20 +97,21 @@ namespace DesertPaintLab
 

	
 
            bool isDarkPixel = false;
 
            bool isPapyAbove = false;
 
            bool isPapyBelow = false;
 
            //bool isPapyAbove = false;
 
            //bool isPapyBelow = false;
 

	
 
            // 1.) Check if the top pixel is a dark pixel.
 
            isDarkPixel = IsDarkPixel(r, g, b); // ((r < 0x46) && (g < 0x46) && (b < 0x46));
 
            
 
            // 2.) Check the pixel above it to see if it's from the papy texture.
 
            int otherPixelStart = testPixelStart - stride;
 
            isPapyAbove = ((otherPixelStart >= 0) &&
 
                IsPapyTexture(pixBytes[otherPixelStart++], pixBytes[otherPixelStart++], pixBytes[otherPixelStart]));
 
            //// 2.) Check the pixel above it to see if it's from the papy texture.
 
            //int otherPixelStart = testPixelStart - stride;
 
            //isPapyAbove = ((otherPixelStart >= 0) &&
 
            //    IsPapyTexture(pixBytes[otherPixelStart++], pixBytes[otherPixelStart++], pixBytes[otherPixelStart]));
 

	
 
            // 3.) Check the pixel below where the swatch should be to see if it's also from the papy texture.
 
            otherPixelStart = testPixelStart + (stride * swatchHeight);
 
            isPapyBelow = (IsPapyTexture(pixBytes[otherPixelStart++], pixBytes[otherPixelStart++], pixBytes[otherPixelStart]));
 
            //// 3.) Check the pixel below where the swatch should be to see if it's also from the papy texture.
 
            //otherPixelStart = testPixelStart + (stride * swatchHeight);
 
            //isPapyBelow = (IsPapyTexture(pixBytes[otherPixelStart++], pixBytes[otherPixelStart++], pixBytes[otherPixelStart]));
 

	
 
            bool result = isDarkPixel && isPapyAbove && isPapyBelow;
 
            //bool result = isDarkPixel && isPapyAbove && isPapyBelow;
 
            bool result = isDarkPixel;
 

	
 
            // grab the swatch color
...
 
@@ -123,5 +124,5 @@ namespace DesertPaintLab
 
            for (int i = (2*pixelMultiplier); result && (i < swatchHeight-(2*pixelMultiplier)); ++i)
 
            {
 
                otherPixelStart = testPixelStart + (stride * i);
 
                int otherPixelStart = testPixelStart + (stride * i);
 
                result &= IsColorMatch(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2], r, g, b);
 
            }
...
 
@@ -142,5 +143,6 @@ namespace DesertPaintLab
 
            }
 

	
 
            // test the dark top border and for papyrus below the swatch
 
            // test the dark top border and for papyrus above and below the swatch
 
            int papyErrorCount = 0;
 
            for (int i = 0; result && (i < swatchWidth); ++i)
 
            {
...
 
@@ -148,7 +150,8 @@ namespace DesertPaintLab
 
                result &= IsDarkPixel(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]);
 
                otherPixelStart = otherPixelStart - stride;
 
                result &= IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]);
 
                papyErrorCount += (IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]) ? 1 : 0);
 
                otherPixelStart = testPixelStart + (stride * swatchHeight) + (3 * i);
 
                result &= IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]);
 
                papyErrorCount += (IsPapyTexture(pixBytes[otherPixelStart], pixBytes[otherPixelStart+1], pixBytes[otherPixelStart+2]) ? 1 : 0);
 
                result &= (papyErrorCount < (swatchWidth / 20)); // allow up to 5% error rate checking for papy texture, because this seems to be inconsistent
 
            }
 

	
...
 
@@ -188,5 +191,5 @@ namespace DesertPaintLab
 
                        // location.
 
                        colorMatch = true;
 
                        for (int i = 1; i < swatchHeight - 2; ++i)
 
                        for (int i = 2; i < swatchHeight - (2 * pixelMultiplier); ++i)
 
                        {
 
                            otherPixelStart = pixelStart + (stride * i);
gtk-gui/MainWindow.cs
Show inline comments
...
 
@@ -93,5 +93,5 @@ public partial class MainWindow
 
		w1.Add (this.SimulatorAction, null);
 
		this.RecipeGeneratorAction = new global::Gtk.RadioAction ("RecipeGeneratorAction", "Recipe Generator", null, null, 0);
 
		this.RecipeGeneratorAction.Group = this.SimulatorAction.Group;
 
		this.RecipeGeneratorAction.Group = this.CaptureAction.Group;
 
		this.RecipeGeneratorAction.ShortLabel = "Recipe Generator";
 
		w1.Add (this.RecipeGeneratorAction, null);
0 comments (0 inline, 0 general)