最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

本文實例講述了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;
}

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

相關(guān)文章

最新評論

中卫市| 兴山县| 麻阳| 济阳县| 西和县| 呼图壁县| 宝清县| 绥滨县| 桐城市| 淳安县| 霍州市| 呼伦贝尔市| 荣成市| 上杭县| 富锦市| 中阳县| 长武县| 福鼎市| 镇宁| 浦北县| 牡丹江市| 衡阳县| 盐山县| 郁南县| 略阳县| 庐江县| 阳山县| 天门市| 清水河县| 丹凤县| 尼木县| 新民市| 织金县| 泗水县| 廊坊市| 丹江口市| 宜兰县| 潮安县| 正宁县| 密山市| 仙游县|