Added .Contains() and .LastPoint to SKPath
This commit is contained in:
Родитель
444fbf9179
Коммит
2293db42a8
|
@ -80,6 +80,15 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
public SKPoint LastPoint
|
||||
{
|
||||
get {
|
||||
SKPoint point;
|
||||
SkiaApi.sk_path_get_last_point (Handle, out point);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
||||
public SKPoint GetPoint (int index)
|
||||
{
|
||||
SKPoint point;
|
||||
|
@ -99,6 +108,11 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_path_get_points (Handle, points, max);
|
||||
}
|
||||
|
||||
public bool Contains (float x, float y)
|
||||
{
|
||||
return SkiaApi.sk_path_contains (Handle, x, y);
|
||||
}
|
||||
|
||||
public void MoveTo (float x, float y)
|
||||
{
|
||||
SkiaApi.sk_path_move_to (Handle, x, y);
|
||||
|
|
|
@ -379,6 +379,12 @@ namespace SkiaSharp
|
|||
public extern static uint sk_image_get_unique_id(sk_image_t t);
|
||||
|
||||
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public extern static bool sk_path_contains (sk_path_t cpath, float x, float y);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public extern static bool sk_path_get_last_point (sk_path_t cpath, out SKPoint point);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_path_t sk_path_new();
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
|
|
2
skia
2
skia
|
@ -1 +1 @@
|
|||
Subproject commit fa414e4d96c6460161fd750ad13bc50780d0c53a
|
||||
Subproject commit 66b97f55fe30c3d6b6d9aa10f1dc01ac98ff68b6
|
|
@ -37,5 +37,27 @@ namespace SkiaSharp.Tests
|
|||
Assert.AreEqual (new SKPoint (68.6763107f, 56.0058575f), path.Points [1]);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PathContainsPoint()
|
||||
{
|
||||
using (var path = new SKPath ()) {
|
||||
path.AddRect (SKRect.Create (10, 10, 100, 100), SKPathDirection.Clockwise);
|
||||
|
||||
Assert.IsTrue (path.Contains (30, 30));
|
||||
Assert.IsFalse (path.Contains (5, 30));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetLastPoint()
|
||||
{
|
||||
using (var path = new SKPath ()) {
|
||||
path.MoveTo (0, 0);
|
||||
path.LineTo (10, 20);
|
||||
|
||||
Assert.AreEqual (new SKPoint(10, 20), path.LastPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче