private Bitmap GetBitmapInt(double min, double max, ScaleMap scale) { int[] buf = (int[])DataBuffer; double factor = max - min; int stride = AxisSize[0]; int page = AxisSize[0] * AxisSize[1]; Bitmap bmp = new Bitmap(AxisSize[0], AxisSize[1]); FastBitmap fastBmp = new FastBitmap(bmp); fastBmp.LockBitmap(); unsafe { for (int y = 0; y < AxisSize[1]; y++) { int indexY = ((AxisSize[1] - 1) - y); PixelData *pData = fastBmp[0, y]; for (int x = 0; x < AxisSize[0]; x++) { if (color) { int datR = buf[(x + indexY * stride)]; int datG = buf[(x + indexY * stride) + page]; int datB = buf[(x + indexY * stride) + page * 2]; if (ContainsBlanks && (double)datR == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { int r = scale.Map(datR); int g = scale.Map(datG); int b = scale.Map(datB); * pData++ = new PixelData(r, g, b, 255); } } else { int dataValue = buf[x + indexY * stride]; if (ContainsBlanks && (double)dataValue == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { Byte val = scale.Map(dataValue); * pData++ = new PixelData(val, val, val, 255); } } } } } fastBmp.UnlockBitmap(); return(bmp); }
private Bitmap GetBitmapInt(double min, double max, ScaleMap scale) { var buf = (int[])DataBuffer; var stride = AxisSize[0]; var page = AxisSize[0]*AxisSize[1]; var bmp = new Bitmap(AxisSize[0], AxisSize[1]); var fastBmp = new FastBitmap(bmp); fastBmp.LockBitmap(); unsafe { for (var y = 0; y < AxisSize[1]; y++) { var indexY = ((AxisSize[1] - 1) - y); var pData = fastBmp[0, y]; for (var x = 0; x < AxisSize[0]; x++) { if (color) { var datR = buf[(x + indexY * stride)]; var datG = buf[(x + indexY * stride) + page]; var datB = buf[(x + indexY * stride) + page * 2]; if (ContainsBlanks && datR == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { int r = scale.Map(datR); int g = scale.Map(datG); int b = scale.Map(datB); *pData++ = new PixelData(r, g, b, 255); } } else { var dataValue = buf[x + indexY * stride]; if (ContainsBlanks && dataValue == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { var val = scale.Map(dataValue); *pData++ = new PixelData(val, val, val, 255); } } } } } fastBmp.UnlockBitmap(); return bmp; }
private Bitmap GetBitmapFloat(double min, double max, ScaleMap scale) { float[] buf = (float[])DataBuffer; double factor = max - min; int stride = AxisSize[0]; int page = AxisSize[0] * AxisSize[1]; Bitmap bmp = new Bitmap(AxisSize[0], AxisSize[1]); FastBitmap fastBmp = new FastBitmap(bmp); fastBmp.LockBitmap(); unsafe { for (int y = 0; y < AxisSize[1]; y++) { int indexY = ((AxisSize[1] - 1) - y); PixelData* pData = fastBmp[0, y]; for (int x = 0; x < AxisSize[0]; x++) { if (color) { double datR = buf[(x + indexY * stride)]; double datG = buf[(x + indexY * stride) + page]; double datB = buf[(x + indexY * stride) + page * 2]; if (ContainsBlanks && (double)datR == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { int r = scale.Map(datR); int g = scale.Map(datG); int b = scale.Map(datB); *pData++ = new PixelData(r, g, b, 255); } } else { double dataValue = buf[x + indexY * stride]; if (ContainsBlanks && (double)dataValue == BlankValue) { *pData++ = new PixelData(0, 0, 0, 0); } else { Byte val = scale.Map(dataValue); *pData++ = new PixelData(val, val, val, 255); } } } } } fastBmp.UnlockBitmap(); return bmp; }