Example #1
0
        static unsafe void CapturedEvent(object sender, OnScreenUpdatedEventArgs args)
        {
            using (Bitmap decoded = new Bitmap(args.Bitmap, new Size(width, height)))
            {
                MainWindow.current.Dispatcher.Invoke(() =>
                {
                    var rect = new System.Drawing.Rectangle(0, 0, width, height);

                    var bitmapData = decoded.LockBits(
                        rect,
                        ImageLockMode.ReadWrite,
                        System.Drawing.Imaging.PixelFormat.Format32bppRgb);

                    writeableBitmap.WritePixels(new System.Windows.Int32Rect(0, 0, width, height), bitmapData.Scan0, width * height * 4, width * 4);

                    decoded.UnlockBits(bitmapData);
                });

                encodeAndSend(decoded);
            }
        }
Example #2
0
 private static void ScreenCapturer_OnScreenUpdated(object sender, OnScreenUpdatedEventArgs e)
 {
     lock (Lck_ScreenImage)
         _screenImage = e.Bitmap.Clone(new Rectangle(0,0,e.Bitmap.Size.Width, e.Bitmap.Size.Height),PixelFormat.DontCare);
 }