So right now I have a number between 0 and 2^24, and I need to map it to three RGB values. I\'m having a bit of trouble on how I\'d accomplish this. Any assistance is apprec
You can use the BitConverter
class to get the bytes from the int:
byte[] values = BitConverter.GetBytes(number);
if (!BitConverter.IsLittleEndian) Array.Reverse(values);
The array will have four bytes. The first three bytes contain your number:
byte b = values[0];
byte g = values[1];
byte r = values[2];