J
Jay Dee
Is it possible to draw directory to the surface of a windows handle?
As in the following code example accesses the raw byte data of an image and manipulates it.
I understand how to manipulate images of different pixel formats etc in this way but I carnet work out how to obtain a reference to the equivalent Scan0 pointer of a window. I am assuming it is possible. The Graphics class must do it somehow.
Many thanks in advance.
var boundsRect = new System.Drawing.Rectangle(0, 0, this.bitmap.Width, this.bitmap.Height);
System.Drawing.Imaging.BitmapData bitmapData = this.bitmap.LockBits(boundsRect, System.Drawing.Imaging.ImageLockMode.WriteOnly, this.bitmap.PixelFormat);
byte* pBase = (byte*)bitmapData.Scan0.ToPointer();
int y2 = (y * stride);
byte* pixel = (byte*)( pBase + y2 + x);
*pixel = color;
bitmap.UnlockBits(bitmapData);
bitmapData = null;
As in the following code example accesses the raw byte data of an image and manipulates it.
I understand how to manipulate images of different pixel formats etc in this way but I carnet work out how to obtain a reference to the equivalent Scan0 pointer of a window. I am assuming it is possible. The Graphics class must do it somehow.
Many thanks in advance.
var boundsRect = new System.Drawing.Rectangle(0, 0, this.bitmap.Width, this.bitmap.Height);
System.Drawing.Imaging.BitmapData bitmapData = this.bitmap.LockBits(boundsRect, System.Drawing.Imaging.ImageLockMode.WriteOnly, this.bitmap.PixelFormat);
byte* pBase = (byte*)bitmapData.Scan0.ToPointer();
int y2 = (y * stride);
byte* pixel = (byte*)( pBase + y2 + x);
*pixel = color;
bitmap.UnlockBits(bitmapData);
bitmapData = null;