亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C#圖像亮度調(diào)整的方法

 更新時(shí)間:2015年04月24日 09:50:43   作者:滄海一粟……  
這篇文章主要介紹了C#圖像亮度調(diào)整的方法,涉及C#操作圖像亮度的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了C#圖像亮度調(diào)整的方法。分享給大家供大家參考。具體如下:

//定義數(shù)字圖象處理之(亮度調(diào)整函數(shù))
private static Bitmap BrightnessP(Bitmap a, int v)
{
 System.Drawing.Imaging.BitmapData bmpData = a.LockBits(new Rectangle(0, 0, a.Width, a.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
 int bytes = a.Width * a.Height * 3;
 IntPtr ptr = bmpData.Scan0;
 int stride = bmpData.Stride;
 unsafe
 {
  byte* p = (byte*)ptr;
  int temp;
  for (int j = 0; j < a.Height; j++)
  {
   for (int i = 0; i < a.Width * 3; i++,p++)
   {
   temp = (int)(p[0] + v);
   temp = (temp > 255) ? 255 : temp < 0 ? 0 : temp;
   p[0] = (byte)temp;
   }
   p += stride - a.Width * 3;
  }
 }
 a.UnlockBits(bmpData);
 return a;
}

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論