Folks,
I have a raw pixel data array that is 16bppGrayScale. The data is in a 1-d byte array, 2 bytes per pixel, padded to end
a row on a 4 byte bounday (held in image.Data below)
Here is my code that doesn't draw? What is wrong? ?????
same code works if I read the bmp in from disk and instead of assigning dataArray = image.Data, do byte[] dataArray = new byte[height*width*3];
Bitmap bmp = new Bitmap(image.ImageWidth, image.ImageLength, PixelFormat.Format16bppGrayScale);
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format16bppGrayScale);
IntPtr ptr = bmpData.Scan0;
int limit = image.Data.Length;
byte[] dataArray = image.Data;
Marshal.Copy(ptr, dataArray, 0, dataArray.Length);
bmp.UnlockBits(bmpData);
e.Graphics.DrawImage(bmp, 0, 0);