Example #1
0
 public override BitmapImage Precache(int width, int height)
 {
     using (var fs = new FileStream(FileList.CurrentPath, FileMode.Open, FileAccess.Read))
     {
         var bmp = new Bitmap(fs);
         _pagesCount = bmp.GetFrameCount(FrameDimension.Page);
         bmp.SelectActiveFrame(FrameDimension.Page, CurrentPage);
         _bmp = new Bitmap(bmp);
     }
     return _bmp.ToBitmapImage(width, height);
 }
Example #2
0
        public BitmapImage Load(ToxKey publicKey, out byte[] result)
        {
            byte[] bytes = LoadBytes(publicKey);
            if (bytes == null)
            {
                result = null;
                return null;
            }

            MemoryStream stream = new MemoryStream(bytes);

            using (Bitmap bmp = new Bitmap(stream))
            {
                result = bytes;
                return bmp.ToBitmapImage(ImageFormat.Png);
            }
        }
 private void Display(Bitmap bitmap)
 {
     Webcam.Source = bitmap.ToBitmapImage();
 }