예제 #1
0
        public static Bitmap Update_Gray(this Bitmap bm, byte[] data)
        {
            LockBitmap lockBitmap = new LockBitmap(bm);

            lockBitmap.LockBits();
            lockBitmap.Pixels = data;

            lockBitmap.UnlockBits();


            return(bm);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }