GetColor() public method

public GetColor ( Point point ) : Color
point Point
return Color
Esempio n. 1
0
        public bool IsMatch(FastBitmap bitmap, int tolerance)
        {
            Color c1 = bitmap.GetColor(X, Y);
            Color c2 = this.ToColor();

            if (Math.Abs(c1.R - c2.R) > tolerance || Math.Abs(c1.G - c2.G) > tolerance || Math.Abs(c1.B - c2.B) > tolerance)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Matches until difference is more than total tolerance.
        /// </summary>
        /// <param name="fast_bitmap"></param>
        /// <param name="sub_rect"></param>
        /// <returns></returns>
        public bool IsIn(FastBitmap fast_bitmap, Point basepoint, int tolerance)
        {
            int total = 0;

            for (int y = 0; y < this.Height; y++)
            {
                for (int x = 0; x < this.Width; x++)
                {
                    total += BitmapAnalyzer.AbsoluteDiff(this.GetColor(x, y), fast_bitmap.GetColor(basepoint.X + x, basepoint.Y + y));
                    if (total > tolerance)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 3
0
        public static bool IsMatch(FastBitmap fast_bitmap1, FastBitmap fast_bitmap2, int total_tolerance)
        {
            if (fast_bitmap1.Width != fast_bitmap2.Width || fast_bitmap1.Height != fast_bitmap2.Height)
            {
                return(false);
            }

            int total = 0;

            for (int y = 0; y < fast_bitmap1.Height; y++)
            {
                for (int x = 0; x < fast_bitmap1.Width; x++)
                {
                    total += BitmapAnalyzer.AbsoluteDiff(fast_bitmap1.GetColor(x, y), fast_bitmap2.GetColor(x, y));

                    if (total > total_tolerance)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }