Exemple #1
0
        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);
            }
        }
Exemple #2
0
        protected async Task SetWipeStyleAsync(WipeStyle style)
        {
            await _batch.LineWidthAsync(style.Thickness);

            await _batch.GlobalCompositeOperationAsync(CompositeOperation.Destination_Out);
        }
Exemple #3
0
 public async Task WipeAsync(Wipe wipe, WipeStyle style)
 {
     await SetWipeStyleAsync(style);
     await LineAsync(wipe.StylusPoints);
 }