Create 1bpp mask from image
问题 How do you create a 1 bit per pixel mask from an image using GDI in C#? The image I am trying to create the mask from is held in a System.Drawing.Graphics object. I have seen examples that use Get/SetPixel in a loop, which are too slow. The method that interests me is one that uses only BitBlits, like this. I just can't get it to work in C#, any help is much appreciated. 回答1: Try this: using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; ... public static