Esempio n. 1
0
        private void InitStorage()
        {
            storage = new Dictionary <Screen, BitStorageBox>();
            foreach (Screen s in Screen.AllScreens)
            {
                string filename = string.Format("{0}@({1},{2}).{3}x{4}.dat", s.DeviceName, s.Bounds.X, s.Bounds.Y, s.Bounds.Width, s.Bounds.Height);
                filename = filename.Replace(@"\\.\", @"AbsPath-");

                BitStorageBox box = new BitStorageBox(filename, s.Bounds.Width, s.Bounds.Height);
                storage.Add(s, box);

                Debug.WriteLine("Monitoring screen at {0}", (object)filename);
            }
        }
Esempio n. 2
0
        private void UpdateImage()
        {
            IEnumerable <int> dirty = dirtyrows.ToArray().Distinct().OrderBy(i => i);

            dirtyrows = new ConcurrentBag <int>();

            BitStorageBox px = mouse.GetStorage(bounds);

            foreach (int y in dirty)
            {
                BitmapData bd = bitmap.LockBits(new Rectangle(0, y, bitmap.Width, 1), ImageLockMode.ReadWrite, PixelFormat.Format1bppIndexed);

                byte[] row = px.GetRow(y);
                Marshal.Copy(row, 0, bd.Scan0, row.Length);

                bitmap.UnlockBits(bd);
            }
        }