📜  lockbits 方法 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:41.450000             🧑  作者: Mango

代码示例1
for (int i = 0; i < bmp.Width; i++)
{
    for (int j = 0; j < bmp.Height; j++)
    {
         Color c = bmp.GetPixel(i, j);

         //Apply conversion equation
         byte gray = (byte)(.21 * c.R + .71 * c.G + .071 * c.B);

         //Set the color of this pixel
         bmp.SetPixel(i, j, Color.FromArgb(gray, gray, gray));
    }
}