Browse Source
Merge pull request #6373 from wieslawsoltes/SkiaOpacityMaskFixes
Fix skia OpacityMask push and pop methods
pull/6429/head
Nikita Tsukanov
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
2 deletions
-
src/Skia/Avalonia.Skia/DrawingContextImpl.cs
|
|
|
@ -534,7 +534,11 @@ namespace Avalonia.Skia |
|
|
|
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)); |
|
|
|
@ -543,7 +547,14 @@ namespace Avalonia.Skia |
|
|
|
/// <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()) |
|
|
|
|