예제 #1
0
        protected override void OnDrawMoveEnded(DmiEXImage dmiExImage, Point p)
        {
            var          startingPoint  = StartingPoint.Equals(new Point(-1, -1)) ? p : StartingPoint;
            List <Point> selectedPoints = GetPointsInBox(startingPoint, p);

            ImageEditor.SetSelection(selectedPoints.ToArray());
        }
예제 #2
0
        public override void onLeftMouseDown(DmiEXImage dmiExImage, Point p)
        {
            _cancellationToken?.Cancel();

            drawStart(dmiExImage, p);
            drawMove(dmiExImage, p);
        }
예제 #3
0
        private void drawStart(DmiEXImage dmiExImage, Point p)
        {
            if (_mouseHeld)
            {
                return;
            }

            StartingPoint = p;
            _mouseHeld    = true;
            OnDrawStart(dmiExImage, p);
        }
예제 #4
0
 protected override void OnDrawMove(DmiEXImage dmiExImage, Point[] p)
 {
     if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
     {
         ImageEditor.DeSelectPixel(p);
     }
     else
     {
         ImageEditor.SelectPixel(p);
     }
 }
예제 #5
0
        private void drawStop(DmiEXImage dmiExImage, Point p)
        {
            if (!_mouseHeld)
            {
                return;
            }

            _mouseHeld = false;
            lastPoint  = new Point(-1, -1);
            OnDrawStop(dmiExImage, p);
        }
예제 #6
0
        protected override void OnDrawMove(DmiEXImage dmiExImage, Point[] pixels)
        {
            List <Point> pixels_to_change = new List <Point>();

            foreach (var p in pixels)
            {
                if (getColor() == getPixel(p))
                {
                    return;
                }

                _changeBuffer.Add(new PixelChangeItem(p, getPixel(p)));
                pixels_to_change.Add(p);
            }

            setPixels(pixels_to_change.ToArray(), getColor());
        }
예제 #7
0
        public override void onMouseExited(DmiEXImage dmiExImage, Point p)
        {
            if (!_mouseHeld)
            {
                return;
            }

            recentExit = true;

            _cancellationToken?.Cancel();
            _cancellationToken = new CancellationTokenSource();

            Task.Factory.StartNew(() =>
            {
                Task.Delay(2000, _cancellationToken.Token).Wait(_cancellationToken.Token);
                drawStop(dmiExImage, p);
            });
        }
예제 #8
0
        public override void onMouseEnter(DmiEXImage dmiExImage, Point p, bool leftMousePressed)
        {
            _cancellationToken?.Cancel();

            if (_mouseHeld == leftMousePressed)
            {
                return;
            }

            if (_mouseHeld)
            {
                drawStop(dmiExImage, p);
            }
            else
            {
                drawStart(dmiExImage, p);
            }
        }
예제 #9
0
        private void drawMove(DmiEXImage dmiExImage, Point p)
        {
            if (!_mouseHeld)
            {
                return;
            }
            if (p.Equals(lastPoint))
            {
                return;
            }
            if (lastPoint.X == -1 && lastPoint.Y == -1)
            {
                lastPoint = p;
            }

            double       d_x = Math.Abs(p.X - lastPoint.X);
            double       d_y = Math.Abs(p.Y - lastPoint.Y);
            List <Point> pixels;

            if ((d_x > 1 || d_y > 1) && !recentExit)
            {
                pixels = GetPointsBetween(lastPoint, p);
            }
            else
            {
                //our pixels are adjacent, we dont need to interpolate
                pixels = new List <Point>()
                {
                    p
                };
            }

            pixels.RemoveAll(point => point.X < 0 || point.Y < 0);
            pixels.RemoveAll(point => point.X >= Layer.Width || point.Y >= Layer.Height);


            OnDrawMove(dmiExImage, pixels.ToArray());
            lastPoint  = p;
            recentExit = false;
            OnDrawMoveEnded(dmiExImage, p);
        }
예제 #10
0
 protected override void OnDrawStop(DmiEXImage dmiExImage, Point p)
 {
     MainWindow.Current.UndoManager.RegisterUndoItem(new PixelChangeUndoItem(Layer, _changeBuffer));
     _changeBuffer = null;
 }
예제 #11
0
 protected override void OnDrawStart(DmiEXImage dmiExImage, Point p)
 {
     _changeBuffer = new List <PixelChangeItem>();
 }
예제 #12
0
 protected virtual void OnDrawStop(DmiEXImage dmiExImage, Point p)
 {
 }
예제 #13
0
 public virtual void onMouseMove(DmiEXImage dmiExImage, Point p)
 {
 }
예제 #14
0
        public override void onLeftMouseUp(DmiEXImage dmiExImage, Point p)
        {
            _cancellationToken?.Cancel();

            drawStop(dmiExImage, p);
        }
예제 #15
0
 public virtual void onLeftMouseUp(DmiEXImage dmiExImage, Point p)
 {
 }
예제 #16
0
 public virtual void onMouseExited(DmiEXImage dmiExImage, Point p)
 {
 }
예제 #17
0
 protected virtual void OnDrawMove(DmiEXImage dmiExImage, Point[] p)
 {
 }
예제 #18
0
 public override void onLeftMouseDown(DmiEXImage dmiExImage, Point p) => PixelAct(p);
예제 #19
0
        public override void onMouseMove(DmiEXImage dmiExImage, Point p)
        {
            _cancellationToken?.Cancel();

            drawMove(dmiExImage, p);
        }
예제 #20
0
 public LayerNewUndoItem(DmiEXImage image, DmiEXLayer layer)
 {
     _image = image;
     _layer = layer;
 }
예제 #21
0
 protected virtual void OnDrawMoveEnded(DmiEXImage image, Point p)
 {
 }
예제 #22
0
 public LayerDeletedUndoItem(DmiEXImage image, DmiEXLayer layer)
 {
     _image = image;
     _layer = layer;
 }
예제 #23
0
 public virtual void onMouseEnter(DmiEXImage dmiExImage, Point p, bool LeftMousePressed)
 {
 }