Пример #1
0
        public byte GetColorBitAt(int x, int y, int layer)
        {
            var l    = Layers[layer];
            var idx  = GetBitIndex(x, y);
            var bits = BitPixUtilities.ToBits(l);

            return(bits[idx]);
        }
Пример #2
0
        public void SetColorBitAt(int x, int y, bool value, int layer)
        {
            var l    = Layers[layer];
            var idx  = GetBitIndex(x, y);
            var bits = BitPixUtilities.ToBits(l);

            bits[idx] = (byte)(value ? 1 : 0);

            Layers[layer] = BitPixUtilities.ToBytes(bits);
        }
Пример #3
0
 public int GetColorIndexFromBits(byte[] colorBits)
 {
     for (var i = 0; i < ColorCount; i++)
     {
         var bits = BitPixUtilities.ToBits((byte)i, colorBits.Length);
         if (BitPixUtilities.BitEquals(colorBits, bits))
         {
             return(i);
         }
     }
     return(-1);
 }
Пример #4
0
        public byte GetColorIndexAt(int x, int y)
        {
            var index = GetBitIndex(x, y);

            var bits = new byte[Layers.Length];

            for (var i = 0; i < Layers.Length; i++)
            {
                bits[i] = BitPixUtilities.ToBits(Layers[i])[index];
            }

            return((byte)GetColorIndexFromBits(bits));
        }
Пример #5
0
 public byte[] GetColorBits(byte colorIndex)
 {
     return(BitPixUtilities.ToBits(colorIndex, Layers.Length));
 }