Exemplo n.º 1
0
 private void CaptureImage_OnPreviewMouseMove(object sender, MouseEventArgs e)
 {
     if (!(sender is Image image) || image.Source == null || !image.IsMouseOver)
     {
         return;
     }
     this.GetViewModel().HoveredColor = PickerUtil.GetColorAt(this.GetViewModel().CurrentBitmap, PickerViewModel.GetCoordsAt(image, e.GetPosition(CaptureImage)));
 }
        private void BtnDesktop_OnClick(object sender, RoutedEventArgs e)
        {
            this.Closed += (s, arg) =>
            {
                // You'd think being in the 'closed' would be good enough but nope!
                // Sleep about 0.5 seconds to give the window a chance to fully close
                Thread.Sleep(500);

                // Open the picker window with a capture of the current screen
                new PickerWindow(this.Owner, PickerUtil.CaptureScreen()).ShowDialog();
            };
            this.Close();
        }
Exemplo n.º 3
0
        public void EmitsExpectedGs()
        {
            PickerUtil.NextRgb(out var nextR, out var nextG, out var nextB);
            for (var g = 0; g <= 255; ++g)
            {
                Assert.AreEqual((0, g, 0), (nextR, nextG, nextB));

                for (var r = 0; r <= 255; ++r)
                {
                    PickerUtil.NextRgb(out nextR, out nextG, out nextB);
                }
            }
        }
Exemplo n.º 4
0
        private void CaptureImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            CaptureImage.CaptureMouse();
            var tt = (TranslateTransform)((TransformGroup)CaptureImage.RenderTransform).Children.First(tr => tr is TranslateTransform);

            _start  = e.GetPosition(CaptureImageBorder);
            _origin = new Point(tt.X, tt.Y);

            if (!(sender is Image image) || image.Source == null || !image.IsMouseOver)
            {
                return;
            }
            this.GetViewModel().PickedColor = PickerUtil.GetColorAt(this.GetViewModel().CurrentBitmap, PickerViewModel.GetCoordsAt(image, e.GetPosition(CaptureImage)));
        }
Exemplo n.º 5
0
 public void SetUp()
 {
     PickerUtil.Reset();
 }