예제 #1
0
파일: BitPix.cs 프로젝트: Shinobytes/core
        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
파일: BitPix.cs 프로젝트: Shinobytes/core
        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
파일: BitPix.cs 프로젝트: Shinobytes/core
 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
파일: BitPix.cs 프로젝트: Shinobytes/core
        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
파일: BitPix.cs 프로젝트: Shinobytes/core
 public byte[] GetColorBits(byte colorIndex)
 {
     return(BitPixUtilities.ToBits(colorIndex, Layers.Length));
 }