CSharpUtils.Drawing.Distance.DistanceMap.GetMask C# (CSharp) Method

GetMask() static public method

static public GetMask ( Bitmap Bitmap, byte AlphaThresold = 1 ) : ].bool[
Bitmap System.Drawing.Bitmap
AlphaThresold byte
return ].bool[
		static public bool[,] GetMask(Bitmap Bitmap, byte AlphaThresold = 1)
		{
			var Width = Bitmap.Width;
			var Height = Bitmap.Height;
			var Mask = new bool[Bitmap.Width, Bitmap.Height];
			Bitmap.LockBitsUnlock(System.Drawing.Imaging.PixelFormat.Format32bppArgb, (BitmapData) => {
				for (int y = 0; y < Height; y++)
				{
					var Ptr = ((byte *)BitmapData.Scan0.ToPointer()) + BitmapData.Stride * y;
					Ptr += 3;
					for (int x = 0; x < Width; x++)
					{
						Mask[x, y] = (*Ptr >= AlphaThresold);
						Ptr += 4;
						//Console.Write(Mask[x, y] ? 1 : 0);
					}
					//Console.WriteLine("");
				}
			});
			return Mask;
		}