コード例 #1
0
        public void CalcBoundsOnQuadrantIII()
        {
            ScreenFacade negMon = new ScreenFacade(new Rectangle(-100, 0, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, 20, screens);

            Assert.AreEqual(90, xy.X);
            Assert.AreEqual(20, xy.Y);
        }
コード例 #2
0
        public void CalcBoundsOnQuadrantI()
        {
            ScreenFacade negMon  = new ScreenFacade(new Rectangle(0, -200, 100, 200));
            ScreenFacade primary = new ScreenFacade(new Rectangle(0, 0, 150, 250));

            IScreen[] screens = new IScreen[] { negMon, primary };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(10, -20, screens);

            Assert.AreEqual(10, xy.X);
            Assert.AreEqual(180, xy.Y);
        }
コード例 #3
0
        public void DesktopToScreenCoordinates()
        {
            var mon1 = new ScreenFacade(new Rectangle(0, 0, 200, 100), isPrimary: true);
            var mon2 = new ScreenFacade(new Rectangle(200, 50, 200, 100));

            var monPoint = ScreenCoordinateMapper.DesktopToScreenCoordinates(200, 50, new IScreen[] { mon1, mon2 });

            Assert.AreEqual(200, monPoint.X);
            Assert.AreEqual(50, monPoint.Y);

            // var point2 = ScreenshotCoordinateMapper.
        }
コード例 #4
0
        public void PerfMaping()
        {
            var negMon = new ScreenFacade(new Rectangle(-50, -50, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       sw      = Stopwatch.StartNew();
            const int Runs    = 1000 * 1000;

            for (int i = 0; i < Runs; i++)
            {
                var xy = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, -20, screens);
            }
            sw.Stop();
            Console.WriteLine($"Calls/s {Runs / sw.Elapsed.TotalSeconds:N0}");
        }
コード例 #5
0
        public void CalcOverlappingQuadrants()
        {
            ScreenFacade negMon = new ScreenFacade(new Rectangle(-50, -50, 100, 200));

            IScreen[] screens = new IScreen[] { negMon };
            var       xy      = ScreenCoordinateMapper.ScreenToDesktopCoordinates(-10, -20, screens);

            Assert.AreEqual(40, xy.X);
            Assert.AreEqual(30, xy.Y);

            var xy00 = ScreenCoordinateMapper.ScreenToDesktopCoordinates(0, 0, screens);

            Assert.AreEqual(50, xy00.X);
            Assert.AreEqual(50, xy00.Y);

            var xy50_150 = ScreenCoordinateMapper.ScreenToDesktopCoordinates(49, 149, screens);

            Assert.AreEqual(99, xy50_150.X);
            Assert.AreEqual(199, xy50_150.Y);
        }