Can you combine the Bitmap.LockBits and Graphics.FromImage methods, or, in other words, if I have a "bmp" bitmap and want to edit the bitmap with the g graphic, these are the changes visible in the -array BitmapData.Scan0 byte :
Bitmap bmp = new Bitmap(200,200);
Graphics g = Graphics.FromImage(bmp);
bmp.LockBits(new Rectangle(0,0,200,200),
ImageLockMode.ReadOnly,PixelFormat.Format32bppArgb);
byte* pixelData = (byte*) (void*) bmd.Scan0;
g.FillRectangle(Brushes.Red,new Rectangle(0,0,50,50));
Can I see the changes in PixelData after filling the red rectangle?
source
share