Added some more path members
This commit is contained in:
Родитель
af51bb49d3
Коммит
599b0674a8
|
@ -519,6 +519,14 @@ namespace SkiaSharp
|
|||
InverseEvenOdd
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SKPathSegmentMask {
|
||||
Line = 1 << 0,
|
||||
Quad = 1 << 1,
|
||||
Conic = 1 << 2,
|
||||
Cubic = 1 << 3,
|
||||
}
|
||||
|
||||
public enum SKColorType {
|
||||
Unknown,
|
||||
Alpha8,
|
||||
|
|
|
@ -77,6 +77,8 @@ namespace SkiaSharp
|
|||
|
||||
public bool IsEmpty => VerbCount == 0;
|
||||
|
||||
public SKPathSegmentMask SegmentMasks => SkiaApi.sk_path_get_segment_masks (Handle);
|
||||
|
||||
public int VerbCount {
|
||||
get {
|
||||
return SkiaApi.sk_path_count_verbs (Handle);
|
||||
|
@ -394,6 +396,13 @@ namespace SkiaSharp
|
|||
SkiaApi.sk_path_add_circle (Handle, x, y, radius, dir);
|
||||
}
|
||||
|
||||
public void AddPoly (SKPoint[] points, bool close = true)
|
||||
{
|
||||
if (points == null)
|
||||
throw new ArgumentNullException (nameof (points));
|
||||
SkiaApi.sk_path_add_poly (Handle, points, points.Length, close);
|
||||
}
|
||||
|
||||
public Iterator CreateIterator (bool forceClose)
|
||||
{
|
||||
return new Iterator (this, forceClose);
|
||||
|
|
|
@ -544,6 +544,11 @@ namespace SkiaSharp
|
|||
public extern static void sk_path_to_svg_string (sk_path_t cpath, sk_string_t str);
|
||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static int sk_path_convert_conic_to_quads(ref SKPoint p0, ref SKPoint p1, ref SKPoint p2, float w, [Out] SKPoint[] pts, int pow2);
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static void sk_path_add_poly (sk_path_t cpath, [In] SKPoint[] points, int count, bool close);
|
||||
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static SKPathSegmentMask sk_path_get_segment_masks (sk_path_t t);
|
||||
|
||||
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
public extern static sk_pathmeasure_t sk_pathmeasure_new();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d44a5051d62783ef9440658f987bb6a1eca59b2b
|
||||
Subproject commit 13849e529c7b3c116e077b479e83e67b8c5ab5a4
|
|
@ -64,6 +64,9 @@ namespace SkiaSharp.Tests
|
|||
// the right value
|
||||
Assert.Equal (new SKPoint (68.6763107f, 56.0058575f), path.GetPoint (1));
|
||||
Assert.Equal (new SKPoint (68.6763107f, 56.0058575f), path.Points [1]);
|
||||
|
||||
// the right segment masks
|
||||
Assert.Equal (SKPathSegmentMask.Cubic | SKPathSegmentMask.Line, path.SegmentMasks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,6 +243,8 @@ namespace SkiaSharp.Tests
|
|||
path.MoveTo (10f, 10f);
|
||||
path.LineTo (110f, 10f);
|
||||
|
||||
Assert.Equal (SKPathSegmentMask.Line, path.SegmentMasks);
|
||||
|
||||
var measure = new SKPathMeasure (path);
|
||||
|
||||
Assert.Equal (100f, measure.Length);
|
||||
|
|
Загрузка…
Ссылка в новой задаче