private async Task DrawAsync(int previousX, int previousY, int currentX, int currentY) { if (StylusSettings.Mode == StylusMode.Brush) { var stroke = new Stroke { Style = new StrokeStyle { Color = Brush.Color, Thickness = Brush.Size }, StylusPoints = new StylusPointCollection { (previousX, previousY), (currentX, currentY) } }; await StrokeAsync(stroke); } else if (StylusSettings.Mode == StylusMode.Eraser) { var wipe = new Wipe { Style = new WipeStyle { Thickness = Eraser.Size }, StylusPoints = new StylusPointCollection { (previousX, previousY), (currentX, currentY) } }; await WipeAsync(wipe); } else if (StylusSettings.Mode == StylusMode.PaintBucket) { var fill = new Fill { Style = new FillStyle { Color = PaintBucket.Color }, StylusPoint = new StylusPoint { X = currentX, Y = currentY } }; await FillAsync(fill); } }
protected async Task SetWipeStyleAsync(WipeStyle style) { await _batch.LineWidthAsync(style.Thickness); await _batch.GlobalCompositeOperationAsync(CompositeOperation.Destination_Out); }
public async Task WipeAsync(Wipe wipe, WipeStyle style) { await SetWipeStyleAsync(style); await LineAsync(wipe.StylusPoints); }