public override Color ColorWrite(BitArray data, int position, Color color) { byte red = (byte)(color.R / twoPower * twoPower + BitByte.BitsToByte(data, position, numberOfBit)); byte green = (byte)(color.G / twoPower * twoPower + BitByte.BitsToByte(data, position + numberOfBit, numberOfBit)); byte blue = (byte)(color.B / twoPower * twoPower + BitByte.BitsToByte(data, position + 2 * numberOfBit, numberOfBit)); return(Color.FromArgb(red, green, blue)); }
public override Color ColorWrite(BitArray data, int position, Color color) { byte red = color.R; byte green = color.G; byte blue = color.B; int number = 0; for (int i = 0; i < colors.Length; i++) { if (colors[i] == parameters[0]) { red = (byte)(color.R / BitByte.powerOfTwo(i + 1) * BitByte.powerOfTwo(i + 1) + BitByte.BitsToByte(data, position + number, i + 1)); } if (colors[i] == parameters[1]) { green = (byte)(color.G / BitByte.powerOfTwo(i + 1) * BitByte.powerOfTwo(i + 1) + BitByte.BitsToByte(data, position + number, i + 1)); } if (colors[i] == parameters[2]) { blue = (byte)(color.B / BitByte.powerOfTwo(i + 1) * BitByte.powerOfTwo(i + 1) + BitByte.BitsToByte(data, position + number, i + 1)); } number += i + 1; } return(Color.FromArgb(red, green, blue)); }
public override Color ColorWrite(BitArray data, int position, Color color) { byte red = color.R; byte green = color.G; byte blue = color.B; if (hideColor.Equals("red")) { red = (byte)(red / BitByte.powerOfTwo(numberOfBit) * BitByte.powerOfTwo(numberOfBit) + BitByte.BitsToByte(data, position, numberOfBit)); } if (hideColor.Equals("green")) { green = (byte)(green / BitByte.powerOfTwo(numberOfBit) * BitByte.powerOfTwo(numberOfBit) + BitByte.BitsToByte(data, position, numberOfBit)); } if (hideColor.Equals("blue")) { blue = (byte)(blue / BitByte.powerOfTwo(numberOfBit) * BitByte.powerOfTwo(numberOfBit) + BitByte.BitsToByte(data, position, numberOfBit)); } return(Color.FromArgb(red, green, blue)); }