/*
         * private static void SetOneLedToColor(byte[] buffer, int ledIndex, Color color)
         * {
         *  int bufferIndex = colorBits * ledIndex + headerBits;
         *  SetBufferColorAt(buffer, bufferIndex, color);
         * }
         *
         * private static void SetAllLedsToColor(byte[] buffer, Color color)
         * {
         *
         *  for (int bufferIndex = headerBits; bufferIndex < buffer.Length; bufferIndex += colorBits)
         *  {
         *      SetBufferColorAt(buffer, bufferIndex, color);
         *  }
         *
         * }
         *
         *
         * private static void SetBufferColorAt(byte[] buffer, int bufferIndex, Color color)
         * {
         *  buffer[bufferIndex++] = gammaTable[color.G];
         *  buffer[bufferIndex++] = gammaTable[color.R];
         *  buffer[bufferIndex++] = gammaTable[color.B];
         * }
         */



        private static void ConnectMirrorDriver()
        {
            if (_mirror.Load())
            {
                _mirror.Connect();
            }
            else
            {
                Debug.WriteLine("Error Loading Ambience.");
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            DesktopMirror _mirror = new DesktopMirror();

            _mirror.Load();
            _mirror.Connect();
            long now = System.DateTime.Now.Ticks / 10000;

            while (true)
            {
                now = System.DateTime.Now.Ticks / 10000;
                List <Bitmap> changes = _mirror.getDifference();
                // List<Bitmap> changes= new List<Bitmap>();
                //  changes.Add(_mirror.GetScreen());
                foreach (Bitmap change in changes)
                {
                    System.IO.MemoryStream m = new System.IO.MemoryStream();
                    change.Save(m, System.Drawing.Imaging.ImageFormat.Png);
                    change.Save("d:\\abc.png", System.Drawing.Imaging.ImageFormat.Png);
                }
                //if(changes.Count>0)
                //changes[0].Save("d:\\abc.png", System.Drawing.Imaging.ImageFormat.Png);
                //Console.WriteLine("changes count:"+changes.Count);

                //Bitmap screen = _mirror.GetScreen();

                //System.IO.MemoryStream m = new System.IO.MemoryStream();

                //screen.Save(m, System.Drawing.Imaging.ImageFormat.Png);

                Console.WriteLine((System.DateTime.Now.Ticks / 10000 - now) + "ms");
            }

            _mirror.Disconnect();
            _mirror.Unload();
        }
Exemple #3
0
 private void initialDriver()
 {
     _mirror.Load();
     _mirror.Connect();
     _mirror.Start();
 }