Ejemplo n.º 1
0
        public bool CompareImages(TMPart part, Bitmap image)
        {
            int diff = 0;

            // Alternative code that is slower than memcmp
            for (int i = 0; i < image.Width; i++)
            {
                for (int k = 0; k < image.Height; k++)
                {
                    Color c1 = image.GetPixel(i, k);
                    Color c2 = part.Bitmap.GetPixel(i, k);

                    if (c1 != c2)
                    {
                        diff += (c1.R > c2.R ? c1.R - c2.R : c2.R - c1.R) +
                                (c1.G > c2.G ? c1.G - c2.G : c2.G - c1.G) +
                                (c1.B > c2.B ? c1.B - c2.B : c2.B - c1.B);
                    }
                }
            }

            if (diff < 0 || diff > 1000)
            {
                return(false);
            }

            if (diff != 0)
            {
                Debug.WriteLine(string.Format("Checking {0}, Diff = {1}", part.PartName, diff));
            }

            return(true);

            //return CompareMemCmp(part.Bitmap, image);
        }
Ejemplo n.º 2
0
        public bool VerifyPart(string partName)
        {
            TMScreens tmScreens = new TMScreens();

            TMPart part = tmScreens.GetPart(partName);

            Bitmap bitmap = GetScreenPart(part.Position.Top, part.Position.Left, part.Position.Width, part.Position.Height);

            return(tmScreens.CompareImages(part, bitmap));
        }
Ejemplo n.º 3
0
        public bool VerifyPart(TMScreens tmScreens, TMPart part)
        {
            Bitmap bitmap = GetScreenPart(part.Position.Top, part.Position.Left, part.Position.Width, part.Position.Height);

            return(tmScreens.CompareImages(part, bitmap));
        }