Exemple #1
0
        public static WriteableBitmap ToWriteableBitmap(this Bitmap bmp)
        {
            if (bmp.IsNullOrEmpty())
            {
                return(null);
            }

            WriteableBitmap wbm = new WriteableBitmap(bmp.Width, bmp.Height, 96, 96, PixelFormats.Pbgra32, null);

            wbm.DrawImage(bmp);

            return(wbm);
        }