比如将位图图像的像素颜色与画笔颜色进行比较

时间:2015-09-08 23:44:20

标签: c# c#-4.0

我遇到了以下问题:我需要构建一个方法,将BITMAPBRUSHES作为参数。在这个方法中,我必须比较每个像素的颜色与参数中传递的颜色的笔刷。我怎么做?到目前为止,我只准备好以下代码:

public static int FindPixelsColor(Bitmap image, System.Windows.Media.Brushes color)
    {
        var qt = 0;
        for (var x = 0; x < image.Width; x++)
        {
            for (var y = 0; y < image.Height; y++)
            {
                var currentPixel = image.GetPixel(x, y);
                //If this color the pixel is equal to brush the color increments the variable qt
            }
        }
        return qt;
    }

对于位图图像我正在使用System.Drawing;

0 个答案:

没有答案
相关问题