Example #1
0
        private int getMaxIndex(Bitmap sourceImage, getColor func)
        {
            int max_index = 0;

            for (int i = sourceImage.Width - 1; i > 0; i--)
            {
                for (int j = sourceImage.Height - 1; j > 0; j--)
                {
                    Color currentColor = sourceImage.GetPixel(i, j);
                    int   value        = func(currentColor);

                    if (0 != value)
                    {
                        max_index = j + i * sourceImage.Width;
                        return(max_index);
                    }
                }
            }

            return(max_index);
        }
Example #2
0
        private int getMinIndex(Bitmap sourceImage, getColor func)
        {
            int min_index = 0;

            for (int i = 0; i < sourceImage.Width; i++)
            {
                for (int j = 0; j < sourceImage.Height; j++)
                {
                    Color currentColor = sourceImage.GetPixel(i, j);

                    int value = func(currentColor);

                    if (0 != value)
                    {
                        min_index = j + i * sourceImage.Width;
                        return(min_index);
                    }
                }
            }

            return(min_index);
        }