Skip to content

Commit

Permalink
Added extra SkPath methods (closes #14 closes #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jul 29, 2016
1 parent f1360b7 commit cbadd8d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
5 changes: 5 additions & 0 deletions binding/Binding/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public enum SKPathDirection {
CounterClockwise
}

public enum SKPathArcSize {
Small,
Large
}

public enum SKPathFillType
{
Winding,
Expand Down
20 changes: 20 additions & 0 deletions binding/Binding/SKPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ public void RCubicTo (float dx0, float dy0, float dx1, float dy1, float dx2, flo
SkiaApi.sk_path_rcubic_to (Handle, dx0, dy0, dx1, dy1, dx2, dy2);
}

public void ArcTo (float rx, float ry, float xAxisRotate, SKPathArcSize largeArc, SKPathDirection sweep, float x, float y)
{
SkiaApi.sk_path_arc_to (Handle, rx, ry, xAxisRotate, largeArc, sweep, x, y);
}

public void RArcTo (float rx, float ry, float xAxisRotate, SKPathArcSize largeArc, SKPathDirection sweep, float x, float y)
{
SkiaApi.sk_path_arc_to (Handle, rx, ry, xAxisRotate, largeArc, sweep, x, y);
}

public void Close ()
{
SkiaApi.sk_path_close (Handle);
Expand Down Expand Up @@ -192,6 +202,16 @@ public void AddPathReverse (SKPath other)
SkiaApi.sk_path_add_path_reverse (Handle, other.Handle);
}

public void AddRoundedRect (SKRect rect, float rx, float ry, SKPathDirection dir)
{
SkiaApi.sk_path_add_rounded_rect (Handle, ref rect, rx, ry, dir);
}

public void AddCircle (float x, float y, float radius, SKPathDirection dir)
{
SkiaApi.sk_path_add_circle (Handle, x, y, radius, dir);
}

public Iterator CreateIterator (bool forceClose)
{
return new Iterator (this, SkiaApi.sk_path_create_iter (Handle, forceClose ? 1 : 0));
Expand Down
8 changes: 8 additions & 0 deletions binding/Binding/SkiaApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,14 @@ internal static class SkiaApi
public extern static sk_path_t sk_path_clone (sk_path_t t);
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_path_t sk_path_transform (sk_path_t t, ref SKMatrix matrix);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_arc_to (sk_path_t t, float rx, float ry, float xAxisRotate, SKPathArcSize largeArc, SKPathDirection sweep, float x, float y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rarc_to (sk_path_t t, float rx, float ry, float xAxisRotate, SKPathArcSize largeArc, SKPathDirection sweep, float x, float y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_rounded_rect (sk_path_t t, ref SKRect rect, float rx, float ry, SKPathDirection dir);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_circle (sk_path_t t, float x, float y, float radius, SKPathDirection dir);

// iterator
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
Expand Down
2 changes: 1 addition & 1 deletion skia

0 comments on commit cbadd8d

Please sign in to comment.