Skip to content

Commit

Permalink
Merge pull request #6373 from wieslawsoltes/SkiaOpacityMaskFixes
Browse files Browse the repository at this point in the history
Fix skia OpacityMask push and pop methods
  • Loading branch information
kekekeks committed Aug 16, 2021
2 parents 1855a8c + ec62912 commit cf9bb15
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Skia/Avalonia.Skia/DrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,11 @@ public void PopBitmapBlendMode()
public void PushOpacityMask(IBrush mask, Rect bounds)
{
// TODO: This should be disposed
var paint = new SKPaint();
var paint = new SKPaint()
{
IsAntialias = true,
Style = SKPaintStyle.StrokeAndFill
};

Canvas.SaveLayer(paint);
_maskStack.Push(CreatePaint(paint, mask, bounds, true));
Expand All @@ -543,7 +547,14 @@ public void PushOpacityMask(IBrush mask, Rect bounds)
/// <inheritdoc />
public void PopOpacityMask()
{
using (var paint = new SKPaint { BlendMode = SKBlendMode.DstIn })
using (var paint = new SKPaint
{
IsAntialias = true,
Style = SKPaintStyle.StrokeAndFill,
BlendMode = SKBlendMode.DstIn,
Color = new SKColor(0, 0, 0, 255),
ColorFilter = SKColorFilter.CreateLumaColor()
})
{
Canvas.SaveLayer(paint);
using (var paintWrapper = _maskStack.Pop())
Expand Down

0 comments on commit cf9bb15

Please sign in to comment.