Skip to content

Commit

Permalink
Merge branch 'master' into pr/49
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmes committed Apr 8, 2016
2 parents d26b9d6 + 54841df commit f2b88b1
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 16 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SkiaSharp

SkiaSharp is a cross-platform, managed binding for the
Skia Graphics Library (https://skia.org/)
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's
Skia Graphics Library (https://skia.org/). It provides a comprehensive 2D API that can
be used across mobile, server and desktop models to render images.

## What is Included

Expand Down
38 changes: 38 additions & 0 deletions binding/Binding/SKPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,51 @@ public void MoveTo (float x, float y)
SkiaApi.sk_path_move_to (Handle, x, y);
}

public void RMoveTo (float dx, float dy)
{
SkiaApi.sk_path_rmove_to (Handle, dx, dy);
}

public void LineTo (float x, float y)
{
SkiaApi.sk_path_line_to (Handle, x, y);
}

public void RLineTo (float dx, float dy)
{
SkiaApi.sk_path_rline_to (Handle, dx, dy);
}

public void QuadTo (float x0, float y0, float x1, float y1)
{
SkiaApi.sk_path_quad_to (Handle, x0, y0, x1, y1);
}

public void RQuadTo (float dx0, float dy0, float dx1, float dy1)
{
SkiaApi.sk_path_rquad_to (Handle, dx0, dy0, dx1, dy1);
}

public void ConicTo (float x0, float y0, float x1, float y1, float w)
{
SkiaApi.sk_path_conic_to (Handle, x0, y0, x1, y1, w);
}

public void RConicTo (float dx0, float dy0, float dx1, float dy1, float w)
{
SkiaApi.sk_path_rconic_to (Handle, dx0, dy0, dx1, dy1, w);
}

public void CubicTo (float x0, float y0, float x1, float y1, float x2, float y2)
{
SkiaApi.sk_path_cubic_to (Handle, x0, y0, x1, y1, x2, y2);
}

public void RCubicTo (float dx0, float dy0, float dx1, float dy1, float dx2, float dy2)
{
SkiaApi.sk_path_rcubic_to (Handle, dx0, dy0, dx1, dy1, dx2, dy2);
}

public void Close ()
{
SkiaApi.sk_path_close (Handle);
Expand All @@ -76,11 +101,24 @@ public void AddRect (SKRect rect, SKPathDirection direction)
SkiaApi.sk_path_add_rect (Handle, ref rect, direction);
}

public void AddRect (SKRect rect, SKPathDirection direction, uint startIndex)
{
if (startIndex > 3)
throw new ArgumentOutOfRangeException ("startIndex", "startIndex must be 0 - 3");

SkiaApi.sk_path_add_rect_start (Handle, ref rect, direction, startIndex);
}

public void AddOval (SKRect rect, SKPathDirection direction)
{
SkiaApi.sk_path_add_oval (Handle, ref rect, direction);
}

public void AddArc (SKRect oval, float startAngle, float sweepAngle)
{
SkiaApi.sk_path_add_arc (Handle, ref oval, startAngle, sweepAngle);
}

public bool GetBounds (out SKRect rect)
{
return SkiaApi.sk_path_get_bounds (Handle, out rect);
Expand Down
14 changes: 14 additions & 0 deletions binding/Binding/SkiaApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,34 @@ internal static class SkiaApi
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_move_to(sk_path_t t, float x, float y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rmove_to(sk_path_t t, float dx, float dy);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_line_to(sk_path_t t, float x, float y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rline_to(sk_path_t t, float dx, float dy);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_quad_to(sk_path_t t, float x0, float y0, float x1, float y1);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rquad_to(sk_path_t t, float dx0, float dy0, float dx1, float dy1);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_conic_to(sk_path_t t, float x0, float y0, float x1, float y1, float w);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rconic_to(sk_path_t t, float dx0, float dy0, float dx1, float dy1, float w);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_cubic_to(sk_path_t t, float x0, float y0, float x1, float y1, float x2, float y2);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_rcubic_to(sk_path_t t, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_close(sk_path_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_rect(sk_path_t t, ref SKRect rect, SKPathDirection direction);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_rect_start(sk_path_t t, ref SKRect rect, SKPathDirection direction, uint startIndex);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_oval(sk_path_t t, ref SKRect rect, SKPathDirection direction);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_add_arc(sk_path_t t, ref SKRect rect, float startAngle, float sweepAngle);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static bool sk_path_get_bounds(sk_path_t t, out SKRect rect);
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SKPathFillType sk_path_get_filltype (sk_path_t t);
Expand Down
205 changes: 195 additions & 10 deletions docs/en/SkiaSharp/SKPath.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
</Base>
<Interfaces />
<Docs>
<summary>Compound geometric paths.</summary>
<summary>
<para>Same as <see cref="M:SkiaSharp.SKPath.ConicTo" /> but the coordinates are considered relative to the last point on this contour.</para>
</summary>
<remarks>
<para>The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves.</para>
<para> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</para>
</remarks>
</Docs>
<Members>
Expand All @@ -31,6 +33,31 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AddArc">
<MemberSignature Language="C#" Value="public void AddArc (SkiaSharp.SKRect oval, float startAngle, float sweepAngle);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddArc(valuetype SkiaSharp.SKRect oval, float32 startAngle, float32 sweepAngle) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="oval" Type="SkiaSharp.SKRect" />
<Parameter Name="startAngle" Type="System.Single" />
<Parameter Name="sweepAngle" Type="System.Single" />
</Parameters>
<Docs>
<param name="oval">The bounds of oval used to define the size of the arc.</param>
<param name="startAngle">Starting angle (in degrees) where the arc begins.</param>
<param name="sweepAngle">Sweep angle (in degrees) measured clockwise.</param>
<summary>Add the specified arc to the path as a new contour.</summary>
<remarks>
<para />
</remarks>
</Docs>
</Member>
<Member MemberName="AddOval">
<MemberSignature Language="C#" Value="public void AddOval (SkiaSharp.SKRect rect, SkiaSharp.SKPathDirection direction);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddOval(valuetype SkiaSharp.SKRect rect, valuetype SkiaSharp.SKPathDirection direction) cil managed" />
Expand All @@ -51,7 +78,7 @@
<param name="direction">The direction to wind the oval's contour.</param>
<summary>Adds an oval to the current path.</summary>
<remarks>
<para />
<para></para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -79,6 +106,29 @@
</remarks>
</Docs>
</Member>
<Member MemberName="AddRect">
<MemberSignature Language="C#" Value="public void AddRect (SkiaSharp.SKRect rect, SkiaSharp.SKPathDirection direction, uint startIndex);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRect(valuetype SkiaSharp.SKRect rect, valuetype SkiaSharp.SKPathDirection direction, unsigned int32 startIndex) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rect" Type="SkiaSharp.SKRect" />
<Parameter Name="direction" Type="SkiaSharp.SKPathDirection" />
<Parameter Name="startIndex" Type="System.UInt32" />
</Parameters>
<Docs>
<param name="rect">The rectangle to add as a closed contour to the path</param>
<param name="direction">The direction to wind the rectangle's contour.</param>
<param name="startIndex">Initial point of the contour (initial moveTo), expressed as a corner index, starting in the upper-left position, clock-wise.  Must be 0-3.</param>
<summary>Add a closed rectangle contour to the path.</summary>
<remarks>Add a closed rectangle contour to the path with an initial point of the contour (startIndex) expressed as a corner index.</remarks>
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Close() cil managed" />
Expand Down Expand Up @@ -117,13 +167,16 @@
<Parameter Name="w" Type="System.Single" />
</Parameters>
<Docs>
<param name="x0">To be added.</param>
<param name="y0">To be added.</param>
<param name="x1">To be added.</param>
<param name="y1">To be added.</param>
<param name="w">To be added.</param>
<param name="x0">The x-coordinate of the control point of the conic curve.</param>
<param name="y0">The y-coordinate of the control point of the conic curve.</param>
<param name="x1">The x-coordinate of the end point of the conic curve.</param>
<param name="y1">The y-coordinate of the end point of the conic curve.</param>
<param name="w">The weight of the conic curve.</param>
<summary>Add a conic path from the last point.</summary>
<remarks>To be added.</remarks>
<remarks>
<para> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</para>
<para></para>
</remarks>
</Docs>
</Member>
<Member MemberName="CubicTo">
Expand Down Expand Up @@ -271,7 +324,7 @@
<param name="y">The y-coordinate of the start of a new contour</param>
<summary>Set the beginning of the next contour to the point.</summary>
<remarks>
<para />
<para></para>
</remarks>
</Docs>
</Member>
Expand Down Expand Up @@ -303,5 +356,137 @@
</remarks>
</Docs>
</Member>
<Member MemberName="RConicTo">
<MemberSignature Language="C#" Value="public void RConicTo (float dx0, float dy0, float dx1, float dy1, float w);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RConicTo(float32 dx0, float32 dy0, float32 dx1, float32 dy1, float32 w) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dx0" Type="System.Single" />
<Parameter Name="dy0" Type="System.Single" />
<Parameter Name="dx1" Type="System.Single" />
<Parameter Name="dy1" Type="System.Single" />
<Parameter Name="w" Type="System.Single" />
</Parameters>
<Docs>
<param name="dx0">The amount to add to the x-coordinate of the last point on this contour, to specify the control point of the conic curve.</param>
<param name="dy0">The amount to add to the y-coordinate of the last point on this contour, to specify the control point of the conic curve.</param>
<param name="dx1">The amount to add to the x-coordinate of the last point on this contour, to specify the end point of the conic curve.</param>
<param name="dy1">The amount to add to the y-coordinate of the last point on this contour, to specify the end point of the conic curve.</param>
<param name="w">The weight of the conic curve.</param>
<summary>
<para>Same as <see cref="M:SkiaSharp.SKPath.ConicTo" /> but the coordinates are considered relative to the last point on this contour.</para>
</summary>
<remarks>
<para> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</para>
</remarks>
</Docs>
</Member>
<Member MemberName="RCubicTo">
<MemberSignature Language="C#" Value="public void RCubicTo (float dx0, float dy0, float dx1, float dy1, float dx2, float dy2);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RCubicTo(float32 dx0, float32 dy0, float32 dx1, float32 dy1, float32 dx2, float32 dy2) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dx0" Type="System.Single" />
<Parameter Name="dy0" Type="System.Single" />
<Parameter Name="dx1" Type="System.Single" />
<Parameter Name="dy1" Type="System.Single" />
<Parameter Name="dx2" Type="System.Single" />
<Parameter Name="dy2" Type="System.Single" />
</Parameters>
<Docs>
<param name="dx0">The amount to add to the x-coordinate of the last point on this contour, to specify the 1st control point on a cubic curve.</param>
<param name="dy0">The amount to add to the y-coordinate of the last point on this contour, to specify the 1st control point on a cubic curve.</param>
<param name="dx1">The amount to add to the x-coordinate of the last point on this contour, to specify the 2nd control point on a cubic curve.</param>
<param name="dy1">The amount to add to the y-coordinate of the last point on this contour, to specify the 2nd control point on a cubic curve.</param>
<param name="dx2">The amount to add to the x-coordinate of the last point on this contour, to specify the end point on a cubic curve.</param>
<param name="dy2">The amount to add to the y-coordinate of the last point on this contour, to specify the end point on a cubic curve.</param>
<summary>Same as <see cref="M:SkiaSharp.SKPath.CubicTo" /> but the coordinates are considered relative to the last point on this contour.</summary>
<remarks>
<para> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</para>
<para></para>
</remarks>
</Docs>
</Member>
<Member MemberName="RLineTo">
<MemberSignature Language="C#" Value="public void RLineTo (float dx, float dy);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RLineTo(float32 dx, float32 dy) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dx" Type="System.Single" />
<Parameter Name="dy" Type="System.Single" />
</Parameters>
<Docs>
<param name="dx">The amount to add to the x-coordinate of the last point on this contour, to specify the end of a line.</param>
<param name="dy">The amount to add to the y-coordinate of the last point on this contour, to specify the end of a line.</param>
<summary>Same as <see cref="M:SkiaSharp.SKPath.LineTo" /> but the coordinates are considered relative to the last point on this contour.</summary>
<remarks> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</remarks>
</Docs>
</Member>
<Member MemberName="RMoveTo">
<MemberSignature Language="C#" Value="public void RMoveTo (float dx, float dy);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RMoveTo(float32 dx, float32 dy) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dx" Type="System.Single" />
<Parameter Name="dy" Type="System.Single" />
</Parameters>
<Docs>
<param name="dx">The amount to add to the x-coordinate of the last point on this contour, to specify the start of a new contour.</param>
<param name="dy">The amount to add to the x-coordinate of the last point on this contour, to specify the start of a new contour.</param>
<summary>Same as <see cref="M:SkiaSharp.SKPath.MoveTo" /> but the coordinates are considered relative to the last point on this contour.</summary>
<remarks>
<para></para>
</remarks>
</Docs>
</Member>
<Member MemberName="RQuadTo">
<MemberSignature Language="C#" Value="public void RQuadTo (float dx0, float dy0, float dx1, float dy1);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RQuadTo(float32 dx0, float32 dy0, float32 dx1, float32 dy1) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.49.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dx0" Type="System.Single" />
<Parameter Name="dy0" Type="System.Single" />
<Parameter Name="dx1" Type="System.Single" />
<Parameter Name="dy1" Type="System.Single" />
</Parameters>
<Docs>
<param name="dx0">The amount to add to the x-coordinate of the last point on this contour, to specify the control point on a quadratic curve.</param>
<param name="dy0">The amount to add to the y-coordinate of the last point on this contour, to specify the control point on a quadratic curve.</param>
<param name="dx1">The amount to add to the x-coordinate of the last point on this contour, to specify end point on a quadratic curve.</param>
<param name="dy1">The amount to add to the y-coordinate of the last point on this contour, to specify end point on a quadratic curve.</param>
<summary>Same as <see cref="M:SkiaSharp.SKPath.QuadTo" /> but the coordinates are considered relative to the last point on this contour.</summary>
<remarks> If no <see cref="M:SkiaSharp.SKPath.MoveTo" /> call has been made for this contour, the first point is automatically set to (0,0).</remarks>
</Docs>
</Member>
</Members>
</Type>
Loading

0 comments on commit f2b88b1

Please sign in to comment.