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()); }
public override void onLeftMouseDown(DmiEXImage dmiExImage, Point p) { _cancellationToken?.Cancel(); drawStart(dmiExImage, p); drawMove(dmiExImage, p); }
private void drawStart(DmiEXImage dmiExImage, Point p) { if (_mouseHeld) { return; } StartingPoint = p; _mouseHeld = true; OnDrawStart(dmiExImage, p); }
protected override void OnDrawMove(DmiEXImage dmiExImage, Point[] p) { if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control)) { ImageEditor.DeSelectPixel(p); } else { ImageEditor.SelectPixel(p); } }
private void drawStop(DmiEXImage dmiExImage, Point p) { if (!_mouseHeld) { return; } _mouseHeld = false; lastPoint = new Point(-1, -1); OnDrawStop(dmiExImage, p); }
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()); }
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); }); }
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); } }
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); }
protected override void OnDrawStop(DmiEXImage dmiExImage, Point p) { MainWindow.Current.UndoManager.RegisterUndoItem(new PixelChangeUndoItem(Layer, _changeBuffer)); _changeBuffer = null; }
protected override void OnDrawStart(DmiEXImage dmiExImage, Point p) { _changeBuffer = new List <PixelChangeItem>(); }
protected virtual void OnDrawStop(DmiEXImage dmiExImage, Point p) { }
public virtual void onMouseMove(DmiEXImage dmiExImage, Point p) { }
public override void onLeftMouseUp(DmiEXImage dmiExImage, Point p) { _cancellationToken?.Cancel(); drawStop(dmiExImage, p); }
public virtual void onLeftMouseUp(DmiEXImage dmiExImage, Point p) { }
public virtual void onMouseExited(DmiEXImage dmiExImage, Point p) { }
protected virtual void OnDrawMove(DmiEXImage dmiExImage, Point[] p) { }
public override void onLeftMouseDown(DmiEXImage dmiExImage, Point p) => PixelAct(p);
public override void onMouseMove(DmiEXImage dmiExImage, Point p) { _cancellationToken?.Cancel(); drawMove(dmiExImage, p); }
public LayerNewUndoItem(DmiEXImage image, DmiEXLayer layer) { _image = image; _layer = layer; }
protected virtual void OnDrawMoveEnded(DmiEXImage image, Point p) { }
public LayerDeletedUndoItem(DmiEXImage image, DmiEXLayer layer) { _image = image; _layer = layer; }
public virtual void onMouseEnter(DmiEXImage dmiExImage, Point p, bool LeftMousePressed) { }