public static Bitmap Update_Gray(this Bitmap bm, byte[] data) { LockBitmap lockBitmap = new LockBitmap(bm); lockBitmap.LockBits(); lockBitmap.Pixels = data; lockBitmap.UnlockBits(); return(bm); }
public static Bitmap UpdateFromPointCloud_Color(this Image im, PointCloud pc, int width, int height) { //Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppRgb); byte[] data = PointCloud.ToColorArrayBytes(pc, width, height); LockBitmap lockBitmap = new LockBitmap((Bitmap)im); lockBitmap.LockBits(); lockBitmap.Pixels = data; lockBitmap.UnlockBits(); return((Bitmap)im); }
public static Bitmap UpdateFromByteArray_Color(this Image im, byte[] data) { //Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppRgb); LockBitmap lockBitmap = new LockBitmap((Bitmap)im); lockBitmap.LockBits(); lockBitmap.Pixels = data; lockBitmap.UnlockBits(); return((Bitmap)im); }
public static Bitmap FromByteArray_Gray(byte[] data, int width, int height) { System.Drawing.Bitmap bitmap8bpp = new Bitmap(width, height, PixelFormat.Format8bppIndexed); bitmap8bpp.Palette = ImageExtensions.GrayScalePalette; LockBitmap lockBitmap = new LockBitmap(bitmap8bpp); lockBitmap.LockBits(); lockBitmap.Pixels = data; lockBitmap.UnlockBits(); return(bitmap8bpp); }
public static Bitmap Update_Color(this Bitmap bm, byte[] data) { try { LockBitmap lockBitmap = new LockBitmap(bm); lockBitmap.LockBits(); lockBitmap.Pixels = data; lockBitmap.UnlockBits(); return(bm); } catch (Exception err) { System.Windows.Forms.MessageBox.Show("Error in updating bitmap : " + err.Message); } return(null); }