public MyImg(Bitmap bmp) { widthVar = bmp.Width; heightVar = bmp.Height; px = PixelFormat.Format32bppPArgb; Create(bmp); if (bmp.Width > bmp.Height) { GetThumbnail(bmp.Width); } else { GetThumbnail(bmp.Height); } newBmp.Dispose(); LockBitmap.Pixels = new byte[0]; bitmap.Dispose(); bitmap = null; GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); }
private void Create(Bitmap bmp) { Create(); //******************************************** newBmp = new Bitmap(bmp);//used to create a 32bppPArgb bitmap = new LockBitmap(newBmp); LockBitmap.LockBits(); Marshal.Copy(LockBitmap.Pixels, 0, ptr_Address, LockBitmap.Pixels.Length); LockBitmap.UnlockBits(); }
private void Create(Bitmap bmp) { Create(); //******************************************** newBmp = new Bitmap(bmp);//used to create a 32bppPArgb bitmap = new LockBitmap(newBmp); bitmap.LockBits(); Marshal.Copy(bitmap.Pixels, 0, ptr_Address, bitmap.Pixels.Length); bitmap.UnlockBits(); newBmp.Dispose(); bitmap.Pixels = new byte[0]; bitmap = null; }