public void BitArrayToBytes() { var bitArray = new BitArray(32); var bytes = bitArray.ToBytes(); Assert.AreEqual(32 / BitTool.ByteLength, bytes.Length); Assert.IsTrue(bytes.All(b => b == 0x00)); Assert.IsTrue(bytes.GetHexStringFromBytes().All(c => c == '0')); bytes = bitArray.Not().ToBytes(); Assert.IsTrue(bytes.GetHexStringFromBytes().All(c => c == 'F')); // Console.WriteLine(bytes.GetHexStringFromBytes()); }
public static void RegisterHatchStylePattern(HatchStyle hatchStyle, BitArray pattern_32x32) { _hatchStyleCacheDictionary[(int)hatchStyle] = pattern_32x32.ToBytes(); }