Fixes #840
This commit is contained in:
Matthew Leibowitz 2020-06-10 04:09:11 +02:00 коммит произвёл GitHub
Родитель 98cd9d2ecd
Коммит b7f02a67fe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 44 добавлений и 1 удалений

Просмотреть файл

@ -437,6 +437,25 @@ namespace SkiaSharp
}
}
public bool ToWinding (SKPath result)
{
if (result == null)
throw new ArgumentNullException (nameof (result));
return SkiaApi.sk_pathop_as_winding (Handle, result.Handle);
}
public SKPath ToWinding ()
{
var result = new SKPath ();
if (ToWinding (result)) {
return result;
} else {
result.Dispose ();
return null;
}
}
public string ToSvgPathData ()
{
using (var str = new SKString ()) {

Просмотреть файл

@ -2454,6 +2454,11 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void sk_pathmeasure_set_path (sk_pathmeasure_t pathMeasure, sk_path_t path, [MarshalAs (UnmanagedType.I1)] bool forceClosed);
// bool sk_pathop_as_winding(const sk_path_t* path, sk_path_t* result)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]
internal static extern bool sk_pathop_as_winding (sk_path_t path, sk_path_t result);
// bool sk_pathop_op(const sk_path_t* one, const sk_path_t* two, sk_pathop_t op, sk_path_t* result)
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.I1)]

2
externals/skia поставляемый

@ -1 +1 @@
Subproject commit 24831bf34359a90aa3fbf4392bda6aa056e97919
Subproject commit 4ddbe5cb84252a2896d53b80fa06584b919eb8a6

Просмотреть файл

@ -488,5 +488,24 @@ namespace SkiaSharp.Tests
Assert.Equal(SKColors.Black, bitmap.GetPixel(90, 50));
}
}
[SkippableFact]
public void ToWinding()
{
using var path = new SKPath();
path.AddRect(new SKRect(1, 2, 3, 4));
using var result = new SKPath();
path.FillType = SKPathFillType.Winding;
Assert.True(path.ToWinding(result));
Assert.NotEqual(path, result);
Assert.Equal(SKPathFillType.Winding, path.FillType);
path.FillType = SKPathFillType.EvenOdd;
Assert.True(path.ToWinding(result));
Assert.NotEqual(path, result);
Assert.Equal(SKPathFillType.Winding, result.FillType);
}
}
}