Scratchoff effect using texture brush to remove a cover image and tell when most is gone
<p>What Ive done is put an image in picturebox1 background image then drawn a cover image over top of the image.  With picturebox1 mouse move if the mouse is down it erases parts of the cover to reveal the bottom image basically like a scratch off ticket.  I cant figure out how to judge if  MOST of the cover image is erased.  This is what I have so far</p>

<pre><code>    bmp1 = new Bitmap(coverimage);
    tb = new TextureBrush(pictureBox1.BackgroundImage);


private void pictureBox1_Paint(object sender, PaintEventArgs e)
{

    base.OnPaint(e);

    e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
    e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;

    e.Graphics.DrawImage(bmp1, 0, 0, 400, 325);
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left)
    {
        if (!_LastPoint.IsEmpty)
        {
            using (Graphics g = Graphics.FromImage(bmp1))
            using (Pen p = new Pen(tb, 50))
            {

                p.StartCap = LineCap.Round;
                p.EndCap = LineCap.Round;
                g.DrawLine(p, _LastPoint, e.Location);

                if (!g.Equals (bmp1))
                {
                    MessageBox.Show("done");
                }
            }
        }

        _LastPoint = e.Location;
       pictureBox1.Refresh();
    }
}
</code></pre>

<p>the !g.Equals (bmp1) notifies me when the image is altered but I cant find a way to make it only notify me if the image changes a drastic amount.  Is there anyway to judge this?</p>

<p>update:::</p>

<pre><code> static int flags = 0;
 public static void ImageCompareString(Bitmap firstImage, Bitmap secondImage)
 {
   MemoryStream ms = new MemoryStream();
          firstImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
          String firstBitmap = Convert.ToBase64String(ms.ToArray());
          ms.Position = 0;
          secondImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
          String secondBitmap = Convert.ToBase64String(ms.ToArray());

   if (firstBitmap.Equals(secondBitmap))
              {
                  flags = flags + 1;
              }
             else
              {

              }
</code></pre>

<p>Some how I got the above to work for what I needed by counting the flags and when they were >= 50 allowing the next step and clearing the mask</p>
