In my application, I store data Bitmapin a two-dimensional integer array ( int[,]). To access the values of R, G, and B, I use something like this:
int i = _data[x, y];
byte B = (byte)(i >> 0);
byte G = (byte)(i >> 8);
byte R = (byte)(i >> 16);
_data[x, y] = BitConverter.ToInt32(new byte[] { B, G, R, 0 }, 0);
I use whole arrays instead of the actual one System.Drawing.Bitmap, because my application runs on Windows Mobile devices, where the memory available for creating raster images is very limited.
I am interested, however, if it would be more appropriate to declare such a structure:
public struct RGB
{
public byte R;
public byte G;
public byte B;
}
... RGB int. , R, G B . - , byte, 32- , a byte 4 1 (, , Visual Basic).
(, RGB) , int, 3/4 3 ints?