I have an RGB color held in a Int32 variable.
I using an unsafe code to loop through Bitmap data, and by using the
BitmapData.Scan0 pointer I need to copy the Int32 color value into the Bitmap
data.
But using the:
/////////////////////////////////////////////////////////////////////////////////////////
Bitmap img = new Bitmap(100, 200,
System.Drawing.Imaging.PixelFormat.Format32bppRgb) ;
System.Drawing.Imaging.BitmapData refData = img.LockBits(new Rectangle(0, 0,
img.Width, img.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly,
img.PixelFormat);
int myColot = GetColor(); // The RGB color value in a Int32 variable.
unsafe
{
refBuf = (byte*)refData.Scan0.ToPointer();
*refBuf = myColot; // This is the problematic code line !!!
}
/////////////////////////////////////////////////////////////////////////////////////////
How do I need to change the problematic code line above, to make it work?
--
Thanks
Sharon