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]); }
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); }
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); }
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)); }
public byte[] GetColorBits(byte colorIndex) { return(BitPixUtilities.ToBits(colorIndex, Layers.Length)); }