This commit is contained in:
Perfare 2020-08-06 13:31:17 +08:00
parent ef38471ff1
commit 1766dcbdeb
1 changed files with 4 additions and 4 deletions

View File

@ -37,10 +37,10 @@ namespace AssetStudio
{ {
return null; return null;
} }
var handle = GCHandle.Alloc(buff, GCHandleType.Pinned); var bitmap = new Bitmap(m_Width, m_Height, PixelFormat.Format32bppArgb);
var scan0 = handle.AddrOfPinnedObject(); var bmpData = bitmap.LockBits(new Rectangle(0, 0, m_Width, m_Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 4, PixelFormat.Format32bppArgb, scan0); Marshal.Copy(buff, 0, bmpData.Scan0, buff.Length);
handle.Free(); bitmap.UnlockBits(bmpData);
if (flip) if (flip)
{ {
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);