Bitmap::LockBits/UnlockBits
2009-11-27 22:51:47
/Microsoft/Gdiplus

The online MSDN document is here:

http://msdn.microsoft.com/en-us/library/ms536298(VS.85).aspx

简而言之,对Bitmap的操作是通过BitmapData实现的。

  • 设置模式为ImageLockModeRead,调用LockBits方法,而后可通过BitmapData:Scan0读取像素信息;
  • 设置模式为ImageLockModeWrite,调用LockBits方法,而后可通过BitmapData:Scan0写入像素信息。但此时只是写入缓存,在调用UnlockBits方法后才正式写入Bitmap;
  • 设置模式为ImageLockModeWrite|ImageLockModeUserInputBuf,预先设置好一个BitmapData,保证Scan0指向要写入Bitmap的信息的缓存。在调用LockBits和UnlockBits方法后这些信息写入Bitmap。
posted by Cyker Way
Name
Email
Homepage
Content
/images/Facebook_32x32.png
/images/Twitter_32x32.png
/images/Feed_32x32.png
Creative Commons divcense