[关闭]
@Hopelessness 2016-10-30T15:56:23.000000Z 字数 396 阅读 522

正片反冲效果的C解释

Photoshop


  1. public unsafe void 反色(Bitmap bmp)
  2. {
  3. int w = bmp.Width, h = bmp.Height;
  4. BitmapData data = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
  5. byte* p = (byte*)data.Scan0;
  6. Action<int> action = Y =>
  7. {
  8. byte* py = p + Y * data.Stride;
  9. for (int X = 0; X < w; X++)
  10. {
  11. *py = (byte)~*py;
  12. py++;
  13. *py = (byte)~*py;
  14. py++;
  15. *py = (byte)~*py;
  16. py++;
  17. py++;
  18. }
  19. };
  20. Parallel.For(0, h, action);
  21. bmp.UnlockBits(data);
  22. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注