WPF Image 绑定图片速度最快的方式
using (var target = new GDI.Bitmap(path))
{
var buffer = target.LockBits(
new GDI.Rectangle(0, 0, target.Width, target.Height),
GDI.Imaging.ImageLockMode.ReadOnly,
GDI.Imaging.PixelFormat.Format32bppArgb);
try
{
var bitmapSource = BitmapSource.Create(
buffer.Width, buffer.Height,
96, 96, PixelFormats.Bgra32, null,
buffer.Scan0, buffer.Stride * buffer.Height, buffer.Stride);
return bitmapSource;
}
finally
{
target.UnlockBits(buffer);
}
}