Phantom square inside the rounded rectangle in SKControl

Hello! Please try to run this code:

public partial class Form1 : Form
{
    SKControl skglControl;

    public Form1()
    {
        InitializeComponent();

        skglControl = new SKControl();
        skglControl.Dock = DockStyle.Fill;
        skglControl.PaintSurface += SkglControl_PaintSurface;

        this.Controls.Add(skglControl);
    }

    private void SkglControl_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
    {
        var r = new SKRect(10, 10, 100, 200);

        using (var p = new SKPaint()
        {
            IsAntialias = true,
            Color = SKColors.Fuchsia
        })
        {
            using (p.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Outer, 8, SKBlurMaskFilterFlags.None))
                e.Surface.Canvas.DrawRoundRect(r, 8, 8, p);
            r.Offset(150, 0);

            using (p.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Outer, 8, SKBlurMaskFilterFlags.HighQuality))
                e.Surface.Canvas.DrawRoundRect(r, 8, 8, p);
            r.Offset(150, 0);

            using (p.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Outer, 8, SKBlurMaskFilterFlags.None))
                e.Surface.Canvas.DrawRoundRect(r, 8, 8, p);
        }
    }
}

Posts

Sign In or Register to comment.