diff --git a/README.md b/README.md
index a23c9c58..25ca4b34 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,10 @@ to create your native libraries.
Check our getting [started guide](https://developer.xamarin.com/guides/cross-platform/drawing/)
+# Extensions for SkiaSharp
+
+Windows/WPF users might find the [SkiaSharpWPFExtensions](https://github.com/impsnldavid/skiasharpwpfextensions) useful.
+
## Building SkiaSharp
First clone the repository:
@@ -44,15 +48,20 @@ Run from Bash
$ ./bootstrapper.sh -t libs
+This runs the build process by using the `libs` build target.
+
### Windows
You need Python 2.7 in `PATH` environment variable. Then you can build it:
> .\bootstrapper.ps1 -Target libs
+This runs the build process by using the `libs` build target.
+
### Build Targets
-There are several targets available:
+There are several targets available, you can specify the target as the argument to the `-t` command line
+option in the bootstrapper script.
- `Everything` - builds everything for the current platform
- `externals` - builds all the native libraries
diff --git a/binding/Binding/Binding.projitems b/binding/Binding/Binding.projitems
index 6f1c338b..14a1f7a2 100644
--- a/binding/Binding/Binding.projitems
+++ b/binding/Binding/Binding.projitems
@@ -16,6 +16,7 @@
+
diff --git a/binding/Binding/Definitions.cs b/binding/Binding/Definitions.cs
index 635049b2..6992b4c5 100644
--- a/binding/Binding/Definitions.cs
+++ b/binding/Binding/Definitions.cs
@@ -96,7 +96,7 @@ namespace SkiaSharp
public SKColor (byte red, byte green, byte blue)
{
- color = (uint)(0xff000000 | (red << 16) | (green << 8) | blue);
+ color = (uint)(0xff000000u | (red << 16) | (green << 8) | blue);
}
public SKColor WithAlpha (byte alpha)
@@ -1141,12 +1141,49 @@ namespace SkiaSharp
public float SkewY, ScaleY, TransY;
public float Persp0, Persp1, Persp2;
+#if OPTIMIZED_SKMATRIX
+
+ //
+ // If we manage to get an sk_matrix_t that contains the extra
+ // the fTypeMask flag, we could accelerate various operations
+ // as well, as this caches state of what is needed to be done.
+ //
+
+ [Flags]
+ enum Mask : uint {
+ Identity = 0,
+ Translate = 1,
+ Scale = 2,
+ Affine = 4,
+ Perspective = 8,
+ RectStaysRect = 0x10,
+ OnlyPerspectiveValid = 0x40,
+ Unknown = 0x80,
+ OrableMasks = Translate | Scale | Affine | Perspective,
+ AllMasks = OrableMasks | RectStaysRect
+ }
+ Mask typeMask;
+
+ Mask GetMask ()
+ {
+ if (typeMask.HasFlag (Mask.Unknown))
+ typeMask = (Mask) SkiaApi.sk_matrix_get_type (ref this);
+
+ // only return the public masks
+ return (Mask) ((uint)typeMask & 0xf);
+ }
+#endif
+
static float sdot (float a, float b, float c, float d) => a * b + c * d;
static float scross(float a, float b, float c, float d) => a * b - c * d;
public static SKMatrix MakeIdentity ()
{
- return new SKMatrix () { ScaleX = 1, ScaleY = 1, Persp2 = 1 };
+ return new SKMatrix () { ScaleX = 1, ScaleY = 1, Persp2 = 1
+#if OPTIMIZED_SKMATRIX
+ , typeMask = Mask.Identity | Mask.RectStaysRect
+#endif
+ };
}
public void SetScaleTranslate (float sx, float sy, float tx, float ty)
@@ -1162,13 +1199,23 @@ namespace SkiaSharp
Persp0 = 0;
Persp1 = 0;
Persp2 = 1;
+
+#if OPTIMIZED_SKMATRIX
+ typeMask = Mask.RectStaysRect |
+ ((sx != 1 || sy != 1) ? Mask.Scale : 0) |
+ ((tx != 0 || ty != 0) ? Mask.Translate : 0);
+#endif
}
public static SKMatrix MakeScale (float sx, float sy)
{
if (sx == 1 && sy == 1)
return MakeIdentity ();
- return new SKMatrix () { ScaleX = sx, ScaleY = sy, Persp2 = 1 };
+ return new SKMatrix () { ScaleX = sx, ScaleY = sy, Persp2 = 1,
+#if OPTIMIZED_SKMATRIX
+typeMask = Mask.Scale | Mask.RectStaysRect
+#endif
+ };
}
@@ -1180,41 +1227,132 @@ namespace SkiaSharp
{
if (sx == 1 && sy == 1)
return MakeIdentity ();
- //this->setScaleTranslate(sx, sy, px - sx * px, py - sy * py);
+ float tx = pivotX - sx * pivotX;
+ float ty = pivotY - sy * pivotY;
+#if OPTIMIZED_SKMATRIX
+ Mask mask = Mask.RectStaysRect |
+ ((sx != 1 || sy != 1) ? Mask.Scale : 0) |
+ ((tx != 0 || ty != 0) ? Mask.Translate : 0);
+#endif
return new SKMatrix () {
ScaleX = sx, ScaleY = sy,
- TransX = pivotX - sx * pivotX,
- TransY = pivotY - sy * pivotY,
- Persp2 = 1
+ TransX = tx,
+ TransY = ty,
+ Persp2 = 1,
+#if OPTIMIZED_SKMATRIX
+ typeMask = mask
+#endif
};
}
public static SKMatrix MakeTranslation (float dx, float dy)
{
+ if (dx == 0 && dy == 0)
+ return MakeIdentity ();
+
return new SKMatrix () {
ScaleX = 1, ScaleY = 1,
TransX = dx, TransY = dy,
- Persp2 = 1
+ Persp2 = 1,
+#if OPTIMIZED_SKMATRIX
+ typeMask = Mask.Translate | Mask.RectStaysRect
+#endif
};
}
public static SKMatrix MakeRotation (float radians)
{
var sin = (float) Math.Sin (radians);
- var cos = (float)Math.Cos (radians);
+ var cos = (float) Math.Cos (radians);
- return new SKMatrix () {
- ScaleX = cos,
- SkewX = -sin,
- TransX = 0,
- SkewY = sin,
- ScaleY = cos,
- TransY = 0,
- Persp0 = 0,
- Persp1 = 0,
- Persp2 = 1
- };
+ var matrix = new SKMatrix ();
+ SetSinCos (ref matrix, sin, cos);
+ return matrix;
+ }
+
+ public static SKMatrix MakeRotation (float radians, float pivotx, float pivoty)
+ {
+ var sin = (float) Math.Sin (radians);
+ var cos = (float) Math.Cos (radians);
+
+ var matrix = new SKMatrix ();
+ SetSinCos (ref matrix, sin, cos, pivotx, pivoty);
+ return matrix;
+ }
+
+ const float degToRad = (float)System.Math.PI / 180.0f;
+
+ public static SKMatrix MakeRotationDegrees (float degrees)
+ {
+ return MakeRotation (degrees * degToRad);
+ }
+
+ public static SKMatrix MakeRotationDegrees (float degrees, float pivotx, float pivoty)
+ {
+ return MakeRotation (degrees * degToRad, pivotx, pivoty);
+ }
+
+ static void SetSinCos (ref SKMatrix matrix, float sin, float cos)
+ {
+ matrix.ScaleX = cos;
+ matrix.SkewX = -sin;
+ matrix.TransX = 0;
+ matrix.SkewY = sin;
+ matrix.ScaleY = cos;
+ matrix.TransY = 0;
+ matrix.Persp0 = 0;
+ matrix.Persp1 = 0;
+ matrix.Persp2 = 1;
+#if OPTIMIZED_SKMATRIX
+ matrix.typeMask = Mask.Unknown | Mask.OnlyPerspectiveValid;
+#endif
+ }
+
+ static void SetSinCos (ref SKMatrix matrix, float sin, float cos, float pivotx, float pivoty)
+ {
+ float oneMinusCos = 1-cos;
+
+ matrix.ScaleX = cos;
+ matrix.SkewX = -sin;
+ matrix.TransX = sdot(sin, pivoty, oneMinusCos, pivotx);
+ matrix.SkewY = sin;
+ matrix.ScaleY = cos;
+ matrix.TransY = sdot(-sin, pivotx, oneMinusCos, pivoty);
+ matrix.Persp0 = 0;
+ matrix.Persp1 = 0;
+ matrix.Persp2 = 1;
+#if OPTIMIZED_SKMATRIX
+ matrix.typeMask = Mask.Unknown | Mask.OnlyPerspectiveValid;
+#endif
+ }
+
+ public static void Rotate (ref SKMatrix matrix, float radians, float pivotx, float pivoty)
+ {
+ var sin = (float) Math.Sin (radians);
+ var cos = (float) Math.Cos (radians);
+ SetSinCos (ref matrix, sin, cos, pivotx, pivoty);
+ }
+
+ public static void RotateDegrees (ref SKMatrix matrix, float degrees, float pivotx, float pivoty)
+ {
+ var sin = (float) Math.Sin (degrees * degToRad);
+ var cos = (float) Math.Cos (degrees * degToRad);
+ SetSinCos (ref matrix, sin, cos, pivotx, pivoty);
+ }
+
+ public static void Rotate (ref SKMatrix matrix, float radians)
+ {
+ var sin = (float) Math.Sin (radians);
+ var cos = (float) Math.Cos (radians);
+ SetSinCos (ref matrix, sin, cos);
+ }
+
+ public static void RotateDegrees (ref SKMatrix matrix, float degrees)
+ {
+ var sin = (float) Math.Sin (degrees * degToRad);
+ var cos = (float) Math.Cos (degrees * degToRad);
+ SetSinCos (ref matrix, sin, cos);
}
public static SKMatrix MakeSkew (float sx, float sy)
@@ -1228,9 +1366,120 @@ namespace SkiaSharp
TransY = 0,
Persp0 = 0,
Persp1 = 0,
- Persp2 = 1
+ Persp2 = 1,
+#if OPTIMIZED_SKMATRIX
+ typeMask = Mask.Unknown | Mask.OnlyPerspectiveValid
+#endif
};
}
+
+ public bool TryInvert (out SKMatrix inverse)
+ {
+ return SkiaApi.sk_matrix_try_invert (ref this, out inverse) != 0;
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_concat")]
+ public extern static void Concat (ref SKMatrix target, ref SKMatrix first, ref SKMatrix second);
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_pre_concat")]
+ public extern static void PreConcat (ref SKMatrix target, ref SKMatrix matrix);
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_post_concat")]
+ public extern static void PostConcat (ref SKMatrix target, ref SKMatrix matrix);
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl, EntryPoint="sk_matrix_map_rect")]
+ extern static void MapRect (ref SKMatrix matrix, out SKRect dest, ref SKRect source);
+
+ public SKRect MapRect (SKRect source)
+ {
+ SKRect result;
+ MapRect (ref this, out result, ref source);
+ return result;
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
+ extern static void sk_matrix_map_points (ref SKMatrix matrix, IntPtr dst, IntPtr src, int count);
+
+ public void MapPoints (SKPoint [] result, SKPoint [] points)
+ {
+ if (result == null)
+ throw new ArgumentNullException ("result");
+ if (points == null)
+ throw new ArgumentNullException ("points");
+ int dl = result.Length;
+ if (dl != points.Length)
+ throw new ArgumentException ("buffers must be the same size");
+ unsafe {
+ fixed (SKPoint *rp = &result[0]){
+ fixed (SKPoint *pp = &points[0]){
+ sk_matrix_map_points (ref this, (IntPtr) rp, (IntPtr) pp, dl);
+ }
+ }
+ }
+ }
+
+ public SKPoint [] MapPoints (SKPoint [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+ var res = new SKPoint [points.Length];
+ MapPoints (res, points);
+ return res;
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
+ extern static void sk_matrix_map_vectors (ref SKMatrix matrix, IntPtr dst, IntPtr src, int count);
+
+ public void MapVectors (SKPoint [] result, SKPoint [] vectors)
+ {
+ if (result == null)
+ throw new ArgumentNullException ("result");
+ if (vectors == null)
+ throw new ArgumentNullException ("vectors");
+ int dl = result.Length;
+ if (dl != vectors.Length)
+ throw new ArgumentException ("buffers must be the same size");
+ unsafe {
+ fixed (SKPoint *rp = &result[0]){
+ fixed (SKPoint *pp = &vectors[0]){
+ sk_matrix_map_vectors (ref this, (IntPtr) rp, (IntPtr) pp, dl);
+ }
+ }
+ }
+ }
+
+ public SKPoint [] MapVectors (SKPoint [] vectors)
+ {
+ if (vectors == null)
+ throw new ArgumentNullException ("vectors");
+ var res = new SKPoint [vectors.Length];
+ MapVectors (res, vectors);
+ return res;
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
+ extern static SKPoint sk_matrix_map_xy (ref SKMatrix matrix, float x, float y);
+
+ public SKPoint MapXY (float x, float y)
+ {
+ return sk_matrix_map_xy (ref this, x, y);
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
+ extern static SKPoint sk_matrix_map_vector (ref SKMatrix matrix, float x, float y);
+
+ public SKPoint MapVector (float x, float y)
+ {
+ return sk_matrix_map_vector (ref this, x, y);
+ }
+
+ [DllImport(SkiaApi.SKIA, CallingConvention = CallingConvention.Cdecl)]
+ extern static float sk_matrix_map_radius (ref SKMatrix matrix, float radius);
+
+ public float MapRadius (float radius)
+ {
+ return sk_matrix_map_radius (ref this, radius);
+ }
}
[StructLayout(LayoutKind.Sequential)]
diff --git a/binding/Binding/SKCanvas.cs b/binding/Binding/SKCanvas.cs
index 76aa35e5..4681dc82 100644
--- a/binding/Binding/SKCanvas.cs
+++ b/binding/Binding/SKCanvas.cs
@@ -163,6 +163,13 @@ namespace SkiaSharp
throw new ArgumentNullException ("paint");
SkiaApi.sk_canvas_draw_oval (Handle, ref rect, paint.Handle);
}
+
+ public void DrawCircle (float cx, float cy, float radius, SKPaint paint)
+ {
+ if (paint == null)
+ throw new ArgumentNullException ("paint");
+ SkiaApi.sk_canvas_draw_circle (Handle, cx, cy, radius, paint.Handle);
+ }
public void DrawPath (SKPath path, SKPaint paint)
{
diff --git a/binding/Binding/SKPaint.cs b/binding/Binding/SKPaint.cs
index 008abe94..82aa4681 100644
--- a/binding/Binding/SKPaint.cs
+++ b/binding/Binding/SKPaint.cs
@@ -227,6 +227,15 @@ namespace SkiaSharp
}
}
+ public SKPathEffect PathEffect {
+ get {
+ return GetObject (SkiaApi.sk_paint_get_path_effect(Handle));
+ }
+ set {
+ SkiaApi.sk_paint_set_path_effect (Handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+ }
+
public float MeasureText (string text)
{
if (text == null)
diff --git a/binding/Binding/SKPath.cs b/binding/Binding/SKPath.cs
index 7fefde50..778a10e8 100644
--- a/binding/Binding/SKPath.cs
+++ b/binding/Binding/SKPath.cs
@@ -12,6 +12,16 @@ namespace SkiaSharp
{
public class SKPath : SKObject
{
+ public enum Verb {
+ Move, Line, Quad, Conic, Cubic, Close, Done
+ }
+
+ public enum AddMode {
+ Append,
+ Extend
+ }
+
+
[Preserve]
internal SKPath (IntPtr handle, bool owns)
: base (handle, owns)
@@ -107,6 +117,16 @@ namespace SkiaSharp
SkiaApi.sk_path_close (Handle);
}
+ public void Rewind()
+ {
+ SkiaApi.sk_path_rewind(Handle);
+ }
+
+ public void Reset()
+ {
+ SkiaApi.sk_path_reset(Handle);
+ }
+
public void AddRect (SKRect rect, SKPathDirection direction)
{
SkiaApi.sk_path_add_rect (Handle, ref rect, direction);
@@ -139,6 +159,137 @@ namespace SkiaSharp
{
SkiaApi.sk_path_transform (Handle, ref matrix);
}
+
+ public void AddPath (SKPath other, float dx, float dy, AddMode mode = AddMode.Append)
+ {
+ if (other == null)
+ throw new ArgumentNullException (nameof (other));
+
+ SkiaApi.sk_path_add_path_offset (Handle, other.Handle, dx, dy, mode);
+ }
+
+ public void AddPath (SKPath other, ref SKMatrix matrix, AddMode mode = AddMode.Append)
+ {
+ if (other == null)
+ throw new ArgumentNullException (nameof (other));
+
+ SkiaApi.sk_path_add_path_matrix (Handle, other.Handle, ref matrix, mode);
+ }
+
+ public void AddPath (SKPath other, AddMode mode = AddMode.Append)
+ {
+ if (other == null)
+ throw new ArgumentNullException (nameof (other));
+
+ SkiaApi.sk_path_add_path (Handle, other.Handle, mode);
+ }
+
+ public void AddPathReverse (SKPath other)
+ {
+ if (other == null)
+ throw new ArgumentNullException (nameof (other));
+
+ SkiaApi.sk_path_add_path_reverse (Handle, other.Handle);
+ }
+
+ public Iterator CreateIterator (bool forceClose)
+ {
+ return new Iterator (this, SkiaApi.sk_path_create_iter (Handle, forceClose ? 1 : 0));
+ }
+
+ public RawIterator CreateRawIterator ()
+ {
+ return new RawIterator (this, SkiaApi.sk_path_create_rawiter (Handle));
+ }
+
+ public class Iterator : IDisposable {
+ SKPath Path => path;
+ SKPath path;
+ IntPtr handle;
+
+ internal Iterator (SKPath path, IntPtr handle)
+ {
+ this.path = path;
+ this.handle = handle;
+ }
+
+ ~Iterator ()
+ {
+ Dispose (false);
+ }
+
+ void Dispose (bool disposing)
+ {
+ if (handle != IntPtr.Zero){
+ // safe to call from a background thread to release resources.
+ SkiaApi.sk_path_iter_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public Verb Next (SKPoint [] points, bool doConsumeDegenerates = true, bool exact = false)
+ {
+ if (points == null)
+ throw new ArgumentNullException (nameof (points));
+ if (points.Length != 4)
+ throw new ArgumentException ("Must be an array of four elements", nameof (points));
+ return SkiaApi.sk_path_iter_next (handle, points, doConsumeDegenerates ? 1 : 0, exact ? 1 : 0);
+ }
+
+ public float ConicWeight () => SkiaApi.sk_path_iter_conic_weight (handle);
+ public bool IsCloseLine () => SkiaApi.sk_path_iter_is_close_line (handle) != 0;
+ public bool IsCloseContour () => SkiaApi.sk_path_iter_is_close_countour (handle) != 0;
+ }
+
+ public class RawIterator : IDisposable {
+ SKPath Path => path;
+ SKPath path;
+ IntPtr handle;
+
+ internal RawIterator (SKPath path, IntPtr handle)
+ {
+ this.path = path;
+ this.handle = handle;
+ }
+
+ ~RawIterator ()
+ {
+ Dispose (false);
+ }
+
+ void Dispose (bool disposing)
+ {
+ if (handle != IntPtr.Zero){
+ // safe to call from a background thread to release resources.
+ SkiaApi.sk_path_rawiter_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ public Verb Next (SKPoint [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException (nameof (points));
+ if (points.Length != 4)
+ throw new ArgumentException ("Must be an array of four elements", nameof (points));
+ return SkiaApi.sk_path_rawiter_next (handle, points);
+ }
+
+ public float ConicWeight () => SkiaApi.sk_path_rawiter_conic_weight (handle);
+ public Verb Peek () => SkiaApi.sk_path_rawiter_peek (handle);
+ }
}
}
diff --git a/binding/Binding/SKPathEffect.cs b/binding/Binding/SKPathEffect.cs
new file mode 100644
index 00000000..8be53be4
--- /dev/null
+++ b/binding/Binding/SKPathEffect.cs
@@ -0,0 +1,84 @@
+//
+// Bindings for SKPath
+//
+// Author:
+// Matthew Leibowitz
+//
+// Copyright 2016 Xamarin Inc
+//
+using System;
+
+namespace SkiaSharp
+{
+ public enum SkPath1DPathEffectStyle
+ {
+ Translate,
+ Rotate,
+ Morph,
+ }
+
+ public class SKPathEffect : SKObject
+ {
+ [Preserve]
+ internal SKPathEffect (IntPtr handle)
+ : base (handle)
+ {
+ }
+
+ public static SKPathEffect CreateCompose(SKPathEffect outer, SKPathEffect inner)
+ {
+ if (outer == null)
+ throw new ArgumentNullException(nameof(outer));
+ if (inner == null)
+ throw new ArgumentNullException(nameof(inner));
+ return GetObject(SkiaApi.sk_path_effect_create_compose(outer.Handle, inner.Handle));
+ }
+
+ public static SKPathEffect CreateSum(SKPathEffect first, SKPathEffect second)
+ {
+ if (first == null)
+ throw new ArgumentNullException(nameof(first));
+ if (second == null)
+ throw new ArgumentNullException(nameof(second));
+ return GetObject(SkiaApi.sk_path_effect_create_sum(first.Handle, second.Handle));
+ }
+
+ public static SKPathEffect CreateDiscrete(float segLength, float deviation, UInt32 seedAssist = 0)
+ {
+ return GetObject(SkiaApi.sk_path_effect_create_discrete(segLength, deviation, seedAssist));
+ }
+
+ public static SKPathEffect CreateCorner(float radius)
+ {
+ return GetObject(SkiaApi.sk_path_effect_create_corner(radius));
+ }
+
+ public static SKPathEffect Create1DPath(SKPath path, float advance, float phase, SkPath1DPathEffectStyle style)
+ {
+ if (path == null)
+ throw new ArgumentNullException(nameof(path));
+ return GetObject(SkiaApi.sk_path_effect_create_1d_path(path.Handle, advance, phase, style));
+ }
+
+ public static SKPathEffect Create2DLine(float width, SKMatrix matrix)
+ {
+ return GetObject(SkiaApi.sk_path_effect_create_2d_line(width, matrix));
+ }
+
+ public static SKPathEffect Create2DPath(SKMatrix matrix, SKPath path)
+ {
+ if (path == null)
+ throw new ArgumentNullException(nameof(path));
+ return GetObject(SkiaApi.sk_path_effect_create_2d_path(matrix, path.Handle));
+ }
+
+ public static SKPathEffect CreateDash(float[] intervals, float phase)
+ {
+ if (intervals == null)
+ throw new ArgumentNullException(nameof(intervals));
+ return GetObject(SkiaApi.sk_path_effect_create_dash(intervals, intervals.Length, phase));
+ }
+
+ }
+}
+
diff --git a/binding/Binding/SKTypeface.cs b/binding/Binding/SKTypeface.cs
index cefc6d5c..10baf39d 100644
--- a/binding/Binding/SKTypeface.cs
+++ b/binding/Binding/SKTypeface.cs
@@ -107,7 +107,7 @@ namespace SkiaSharp
glyphs = new ushort[n];
fixed (ushort *gp = &glyphs [0]){
- return SkiaApi.sk_typeface_chars_to_glyphs (Handle, str, SKEncoding.Utf16, (IntPtr) gp, n);
+ return SkiaApi.sk_typeface_chars_to_glyphs (Handle, str, encoding, (IntPtr) gp, n);
}
}
}
diff --git a/binding/Binding/SkiaApi.cs b/binding/Binding/SkiaApi.cs
index 5db4e278..a4b057c6 100755
--- a/binding/Binding/SkiaApi.cs
+++ b/binding/Binding/SkiaApi.cs
@@ -38,25 +38,27 @@ using sk_imagefilter_t = System.IntPtr;
using sk_colorfilter_t = System.IntPtr;
using sk_document_t = System.IntPtr;
using sk_colorspace_t = System.IntPtr;
+using sk_path_iterator_t = System.IntPtr;
+using sk_path_effect_t = System.IntPtr;
namespace SkiaSharp
{
internal static class SkiaApi
{
#if __TVOS__ && __UNIFIED__
- const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
+ public const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __IOS__ && __UNIFIED__
- const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
+ public const string SKIA = "@rpath/libSkiaSharp.framework/libSkiaSharp";
#elif __ANDROID__
- const string SKIA = "libSkiaSharp.so";
+ public const string SKIA = "libSkiaSharp.so";
#elif XAMARIN_MAC
- const string SKIA = "libSkiaSharp.dylib";
+ public const string SKIA = "libSkiaSharp.dylib";
#elif DESKTOP
- const string SKIA = "libSkiaSharp.dll"; // redirected using .dll.config to 'libSkiaSharp.dylib' on OS X
+ public const string SKIA = "libSkiaSharp.dll"; // redirected using .dll.config to 'libSkiaSharp.dylib' on OS X
#elif WINDOWS_UWP
- const string SKIA = "libSkiaSharp.dll";
+ public const string SKIA = "libSkiaSharp.dll";
#else
- const string SKIA = "libSkiaSharp";
+ public const string SKIA = "libSkiaSharp";
#endif
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
@@ -111,6 +113,8 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_draw_oval(sk_canvas_t t, ref SKRect rect, sk_paint_t paint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_canvas_draw_circle(sk_canvas_t t, float cx, float cy, float radius, sk_paint_t paint);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_draw_path(sk_canvas_t t, sk_path_t path, sk_paint_t paint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_draw_image(sk_canvas_t t, sk_image_t image, float x, float y, sk_paint_t paint);
@@ -284,6 +288,11 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static float sk_paint_get_fontmetrics(sk_paint_t t, out SKFontMetrics fontMetrics, float scale);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_paint_get_path_effect(sk_paint_t cpaint);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_paint_set_path_effect(sk_paint_t cpaint, sk_path_effect_t effect);
+
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_image_t sk_image_new_raster_copy(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
@@ -332,6 +341,10 @@ namespace SkiaSharp
[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_rewind(sk_path_t t);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_reset(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);
@@ -340,6 +353,14 @@ namespace SkiaSharp
[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 void sk_path_add_path_offset (sk_path_t t, sk_path_t other, float dx, float dy, SKPath.AddMode mode);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_add_path_matrix (sk_path_t t, sk_path_t other, ref SKMatrix matrix, SKPath.AddMode mode);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_add_path (sk_path_t t, sk_path_t other, SKPath.AddMode mode);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_add_path_reverse (sk_path_t t, sk_path_t other);
+ [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);
@@ -350,6 +371,32 @@ namespace SkiaSharp
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_path_t sk_path_transform (sk_path_t t, ref SKMatrix matrix);
+ // iterator
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_iterator_t sk_path_create_iter (sk_path_t path, int forceClose);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static SKPath.Verb sk_path_iter_next (sk_path_iterator_t iterator, [Out] SKPoint [] points, int doConsumeDegenerates, int exact);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static float sk_path_iter_conic_weight (sk_path_iterator_t iterator);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static int sk_path_iter_is_close_line (sk_path_iterator_t iterator);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static int sk_path_iter_is_close_countour (sk_path_iterator_t iterator);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_iter_destroy (sk_path_t path);
+
+ // Raw iterator
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_iterator_t sk_path_create_rawiter (sk_path_t path);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static SKPath.Verb sk_path_rawiter_next (sk_path_iterator_t iterator, [Out] SKPoint [] points);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static SKPath.Verb sk_path_rawiter_peek (sk_path_iterator_t iterator);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static float sk_path_rawiter_conic_weight (sk_path_iterator_t iterator);
+ [DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static void sk_path_rawiter_destroy (sk_path_t path);
+
// SkMaskFilter
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_maskfilter_unref(sk_maskfilter_t t);
@@ -788,6 +835,26 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static bool sk_bitmap_try_alloc_pixels(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, IntPtr rowBytes);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static int sk_matrix_try_invert(ref SKMatrix matrix, out SKMatrix result);
+
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_compose(sk_path_effect_t outer, sk_path_effect_t inner);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_sum(sk_path_effect_t first, sk_path_effect_t second);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_discrete(float segLength, float deviation, UInt32 seedAssist /*0*/);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_corner(float radius);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_1d_path(sk_path_t path, float advance, float phase, SkPath1DPathEffectStyle style);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_2d_line(float width, SKMatrix matrix);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_2d_path(SKMatrix matrix, sk_path_t path);
+ [DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
+ public extern static sk_path_effect_t sk_path_effect_create_dash(float[] intervals, int count, float phase);
+
}
}
diff --git a/docs/en/SkiaSharp/SKBitmap.xml b/docs/en/SkiaSharp/SKBitmap.xml
index ea2567c2..78c7094f 100644
--- a/docs/en/SkiaSharp/SKBitmap.xml
+++ b/docs/en/SkiaSharp/SKBitmap.xml
@@ -135,7 +135,8 @@
Returns the configured alpha type for the bitmap.
-
+
+
This determines the kind of encoding used for the alpha channel, opaque, premultiplied or unpremultiplied.
diff --git a/docs/en/SkiaSharp/SKCanvas.xml b/docs/en/SkiaSharp/SKCanvas.xml
index 8d188078..b4c37138 100644
--- a/docs/en/SkiaSharp/SKCanvas.xml
+++ b/docs/en/SkiaSharp/SKCanvas.xml
@@ -306,6 +306,31 @@
To be added.
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ Center X coordinate.
+ Center Y coordinate.
+ Radius for the circle.
+ The paint used to draw the bitmap.
+ Draws a circle on the canvas.
+ To be added.
+
+
diff --git a/docs/en/SkiaSharp/SKImage.xml b/docs/en/SkiaSharp/SKImage.xml
index 8c5f10ca..078cb424 100644
--- a/docs/en/SkiaSharp/SKImage.xml
+++ b/docs/en/SkiaSharp/SKImage.xml
@@ -85,7 +85,8 @@
Encodes an image, multiple file formats supported
SKData wrapping the encoded image as a PNG.
-
+
+
diff --git a/docs/en/SkiaSharp/SKMatrix.xml b/docs/en/SkiaSharp/SKMatrix.xml
index 5482fa05..20a94a52 100644
--- a/docs/en/SkiaSharp/SKMatrix.xml
+++ b/docs/en/SkiaSharp/SKMatrix.xml
@@ -14,11 +14,35 @@
2D Transformation matrix with perspective.
The SKMatrix is a full 3x3 matrix.
-
+
+
It extends the traditional 2D affine transformation matrix with three perspective components that allow simple 3D effects to be created with it. Those components must be manually set by using the , , fields of the matrix.
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+ The result matrix value.
+ The first matrix to concatenate.
+ The second matrix to concatenate.
+ Concatenates the specified matrices into the resulting target matrix.
+ Either source matrices can also be the target matrix.
+
+
@@ -52,12 +76,87 @@
- To be added.
+ The angle for the rotation, in radians.
Creates a rotation matrix
To be added.
To be added.
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKMatrix
+
+
+
+
+
+
+
+ The angle for the rotation, in radians.
+ The X coordiate for the rotation pivot.
+ The Y coordiate for the rotation pivot.
+ Creates an that represents a specific rotation in radians with a specific pivot point.
+ Returns a new matrix with the specific rotation at the pivot point.
+
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKMatrix
+
+
+
+
+
+
+ The angle for the rotation, in degrees.
+
+
+
+ Creates an that represents a specific rotation in degrees.
+ Returns a new matrix with the specific rotation in degrees.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKMatrix
+
+
+
+
+
+
+
+ The angle for the rotation, in degrees.
+ The X coordiate for the rotation pivot.
+ The Y coordiate for the rotation pivot.
+ Creates an that represents a specific rotation in degrees.
+ To be added.
+ To be added.
+
+
@@ -74,10 +173,10 @@
- To be added.
- To be added.
+ Scale X component.
+ Scale Y component.
Creates a scaling matrix.
- To be added.
+ Returns a new matrix with the specific scale factor.
To be added.
@@ -99,12 +198,12 @@
- To be added.
- To be added.
- To be added.
- To be added.
+ Scale X component.
+ Scale Y component.
+ The X coordiate for the rotation pivot.
+ The Y coordiate for the rotation pivot.
Creates a scaling matrix with a pivot point.
- To be added.
+ Returns a new matrix with the specific scale factor at the pivot point.
To be added.
@@ -124,10 +223,10 @@
- To be added.
- To be added.
+ Skew X component.
+ Skew Y component.
Creates a skewing matrix.
- To be added.
+ Returns a new matrix with the specific skewing factor.
To be added.
@@ -147,10 +246,189 @@
- To be added.
- To be added.
+ The X offset for the translation.
+ The Y offset for the translation.
Creates a translation matrix.
- To be added.
+ Returns a new matrix with the specific translation factor.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPoint[]
+
+
+
+
+
+ An array of points that you want to map.
+
+ Apply the to the array of points and return the mapped results.
+
+ New array allocated with the mapped results.
+
+ Mapping points uses all components of the matrix. If you want to ignore the translation, use MapVectors.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Array where the mapped results will be stored, the array needs to have the same number of elements of the array.
+ Source array with the points to convert.
+ Apply the to the array of points and return the mapped results.
+
+ Mapping points uses all components of the matrix. If you want to ignore the translation, use MapVectors.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Single
+
+
+
+
+
+ Radius to map.
+
+ Return the mean radius of a circle after it has been mapped by this matrix
+
+ Return the mean radius of a circle after it has been mapped by this matrix
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKRect
+
+
+
+
+
+ Source recatngle to map.
+ Apply the matrix to the source rectangle and return the mapped rectangle.
+ The rectangle with the matrix.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPoint
+
+
+
+
+
+
+ X component of the vector.
+ Y component of the vector.
+ Applies the matrix to a vector.
+ Returns the mapped point.
+ Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapXY.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPoint[]
+
+
+
+
+
+ An array of vectors that you want to map.
+ Apply the to the array of vectors and return the mapped results..
+ New array allocated with the mapped results.
+ Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapPoints.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Array where the mapped results will be stored, the array needs to have the same number of elements of the array.
+ To be added.
+ An array of vectors that you want to map.
+ Apply the to the array of vectors and return the mapped results..
+ Mapping vectors ignores the translation component in the matrix. If you want to take the translation into consideration, use MapPoints.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPoint
+
+
+
+
+
+
+ X coordinate.
+ Y coordinate.
+ Applies the matrix to a point.
+ Returns the mapped point.
To be added.
@@ -202,6 +480,140 @@
To be added.
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Target matrix.
+ The matrix to be post-concatenated.
+ Post-concatenates the matrix to the target matrix
+ This represents newTarget = matrix * target
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Target matrix.
+ The matrix to be post-concatenated.
+ Pre-concatenates the matrix to the target matrix
+ This represents newTarget = target * matrix
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Target matrix.
+ The angle for the rotation, in radians.
+ Rotates the spefixied matrix by the specified radians.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ Target matrix.
+ The angle for the rotation, in radians.
+ The X coordiate for the rotation pivot.
+ The Y coordiate for the rotation pivot.
+ Rotates the spefixied matrix by the specified radians.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ Target matrix.
+ The angle for the rotation, in degrees.
+ Rotates the spefixied matrix by the specified degrees.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ Target matrix.
+ The angle for the rotation, in degrees.
+ The X coordiate for the rotation pivot.
+ The Y coordiate for the rotation pivot.
+ Rotates the spefixied matrix by the specified degrees.
+ To be added.
+
+
@@ -214,7 +626,7 @@
System.Single
- To be added.
+ The ScaleX component of the SKMatrix.
To be added.
@@ -230,7 +642,7 @@
System.Single
- To be added.
+ The ScaleY component of the SKMatrix.
To be added.
@@ -272,7 +684,7 @@
System.Single
- To be added.
+ The SkewX component of the SKMatrix.
To be added.
@@ -288,7 +700,7 @@
System.Single
- To be added.
+ The SkewY component of the SKMatrix.
To be added.
@@ -304,7 +716,7 @@
System.Single
- To be added.
+ The TransX component of the SKMatrix.
To be added.
@@ -320,7 +732,27 @@
System.Single
- To be added.
+ The TransY component of the SKMatrix.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ The destination value to store the inverted matrix if the matrix can be inverted.
+ Attempts to invert the matrix, if possible the inverse matrix contains the result.
+ True if the matrix can be inverted, and the inverse parameter is initialized with the inverted matrix, false otherwise.
To be added.
diff --git a/docs/en/SkiaSharp/SKPath+AddMode.xml b/docs/en/SkiaSharp/SKPath+AddMode.xml
new file mode 100644
index 00000000..748e8fe1
--- /dev/null
+++ b/docs/en/SkiaSharp/SKPath+AddMode.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ SkiaSharp
+ 1.49.0.0
+
+
+ System.Enum
+
+
+ Controls how a path is added to another path.
+
+
+
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+AddMode
+
+
+ Source path contours are added as new contours.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+AddMode
+
+
+
+ Path is added by extending the last contour of the destination path with the first contour of the source path. If the last contour of the destination path is closed, then it will not be extended.
+
+ Instead, the start of source path will be extended by a straight line to the end point of the destination path.
+
+
+
+
+
diff --git a/docs/en/SkiaSharp/SKPath+Iterator.xml b/docs/en/SkiaSharp/SKPath+Iterator.xml
new file mode 100644
index 00000000..6ff3cee1
--- /dev/null
+++ b/docs/en/SkiaSharp/SKPath+Iterator.xml
@@ -0,0 +1,147 @@
+
+
+
+
+ SkiaSharp
+ 1.49.0.0
+
+
+ System.Object
+
+
+
+ System.IDisposable
+
+
+
+ Iterator object to scan the all of the segments (lines, quadratics, cubics) of each contours in a path.
+ Iterators are created by calling the method.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Single
+
+
+
+
+ Return the weight for the current conic. Only valid if the current segment return by was a conic.
+
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ Releases the iterator.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ To be added.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Boolean
+
+
+
+ Returns true if the current contour is closed (has a ).
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Boolean
+
+
+
+ If the last call to returns a line, returns true if the line was the result of a command.
+ If the last call to returns a line, returns true if the line was the result of a command.
+ If the call to Next returned a different value than Line, the result is undefined.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+
+
+
+
+
+ Outgoing parameter, should be an array of four points, on return this contains points representing the current verb and/or segment.
+
+ If , first scan for segments that are deemed degenerate (too short) and skip those.
+
+
+ if is and exact is true, skip only degenerate elements with lengths exactly equal to zero. If exact is , skip degenerate elements with lengths close to zero. If is , exact has no effect.
+
+ Return the next verb in this iteration of the path.
+ The verb of the current segment.
+
+ When all segments have been visited, returns Verb.Done
+
+
+
+
+
diff --git a/docs/en/SkiaSharp/SKPath+RawIterator.xml b/docs/en/SkiaSharp/SKPath+RawIterator.xml
new file mode 100644
index 00000000..6dfabc3e
--- /dev/null
+++ b/docs/en/SkiaSharp/SKPath+RawIterator.xml
@@ -0,0 +1,116 @@
+
+
+
+
+ SkiaSharp
+ 1.49.0.0
+
+
+ System.Object
+
+
+
+ System.IDisposable
+
+
+
+ To be added.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Single
+
+
+
+ Return the weight for the current conic. Only valid if the current segment return by was a conic.
+
+
+
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ Releases the iterator.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ To be added.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+
+
+
+ Outgoing parameter, should be an array of four points, on return this contains points representing the current verb and/or segment.
+ Return the next verb in this iteration of the path.
+ The verb of the current segment.
+ To be added.
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+
+ Return what the next verb will be, but do not visit the next segment.
+ The verb for the next segment
+
+
+
+
+
+
+
diff --git a/docs/en/SkiaSharp/SKPath+Verb.xml b/docs/en/SkiaSharp/SKPath+Verb.xml
new file mode 100644
index 00000000..e0e5991f
--- /dev/null
+++ b/docs/en/SkiaSharp/SKPath+Verb.xml
@@ -0,0 +1,115 @@
+
+
+
+
+ SkiaSharp
+ 1.49.0.0
+
+
+ System.Enum
+
+
+ Verbs contained in an .
+ In the description below, the number of points returned represents the number of valid entries on the return array of SKPoints that is passed to the Next method on the iterator.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Close path, a call to the iterator’s Next() method will return one point (countour’s MoveTo point).
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Conic path, a call to the iterator’s Next() method will return three points, plus the ConicWeight point.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Cubic path, a call to the iterator’s Next() method will return four points
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ The path is completed, points will not contain any data.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Line path, a call to the iterator’s Next() method will return two points.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Move command, a call to the iterator’s Next() method will return a single point.
+
+
+
+
+
+ Field
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Verb
+
+
+ Quad command, a call to the iterator’s Next() method will return three points.
+
+
+
+
diff --git a/docs/en/SkiaSharp/SKPath.xml b/docs/en/SkiaSharp/SKPath.xml
index cf8b4cf0..d820e0e0 100644
--- a/docs/en/SkiaSharp/SKPath.xml
+++ b/docs/en/SkiaSharp/SKPath.xml
@@ -44,9 +44,9 @@
- To be added.
- To be added.
- To be added.
+ The path to clone.
+ Creates an SKPath by making a copy of an existing path
+ This constructor can throw InvalidOperationException if there is a problem copying the source path.
@@ -94,8 +94,103 @@
The direction to wind the oval's contour.
Adds an oval to the current path.
-
-
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The path containing the elements to be added to the current path.
+ Determines how the path contours are added to the path. On Append mode, contours are added as new contours. On Extend mode, the last contour of the path is extended with the first contour of the path.
+ Extends the current path with the path elements from another path, using the specified extension mode.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+ The path containing the elements to be added to the current path.
+ Transformation applied to the path.
+ Determines how the path contours are added to the path. On Append mode, contours are added as new contours. On Extend mode, the last contour of the path is extended with the first contour of the path.
+ Extends the current path with the path elements from another path, by applying the specified transformation matrix, using the specified extension mode.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+
+
+
+ The path containing the elements to be added to the current path.
+ The amount to translate the path in X as it is added.
+ The amount to translate the path in Y as it is added.
+ Determines how the path contours are added to the path. On Append mode, contours are added as new contours. On Extend mode, the last contour of the path is extended with the first contour of the path.
+ Extends the current path with the path elements from another path offset by (, ), using the specified extension mode.
+
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+
+
+ The path containing the elements to be added to the current path.
+ Extends the current path with the path elements from another path in reverse.
+
+
@@ -192,11 +287,51 @@
Add a conic path from the last point.
If no call has been made for this contour, the first point is automatically set to (0,0).
-
-
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+Iterator
+
+
+
+
+
+
+ When this is true, each contour (as defined by a new starting move command) will be completed with a close verb regardless of the contour's contents.
+
+ Creates an iterator object to scan the all of the segments (lines, quadratics, cubics) of each contours in a path.
+ An object that can be used to iterate over the various elements of the path.
+
+ This iterator is able to clean up the path as the values are returned. If you do not desire to get verbs that have been cleaned up, use the method instead.
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ SkiaSharp.SKPath+RawIterator
+
+
+
+ Creates a raw iterator object to scan the all of the segments (lines, quadratics, cubics) of each contours in a path.
+ An object that can be used to iterate over the various elements of the path.
+ Unlike the method, this iterator does not clean up or normalize the values in the path. It returns the raw elements contained in the path.
+
+
@@ -342,8 +477,7 @@
The y-coordinate of the start of a new contour
Set the beginning of the next contour to the point.
-
-
+
@@ -434,8 +568,47 @@
Same as but the coordinates are considered relative to the last point on this contour.
If no call has been made for this contour, the first point is automatically set to (0,0).
-
-
+
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ Clear any lines and curves from the path, making it empty.
+
+ This frees up internal storage associated with those segments.
+
+ On Android, does not change fSourcePath.
+
+
+
+
+
+
+ Method
+
+ 1.49.0.0
+
+
+ System.Void
+
+
+
+ Clear any lines and curves from the path, making it empty.
+
+ However, any internal storage for those lines/curves is retained, making reuse of the path potentially faster.
+
+ On Android, does not change fSourcePath.
@@ -479,8 +652,7 @@
The amount to add to the x-coordinate of the last point on this contour, to specify the start of a new contour.
Same as but the coordinates are considered relative to the last point on this contour.
-
-
+
@@ -524,7 +696,7 @@
To be added.
- To be added.
+ Applies a transformation matrix to the all the elements in the path.
To be added.
diff --git a/docs/en/SkiaSharp/SKTypeface.xml b/docs/en/SkiaSharp/SKTypeface.xml
index bd6935cc..9372b7d0 100644
--- a/docs/en/SkiaSharp/SKTypeface.xml
+++ b/docs/en/SkiaSharp/SKTypeface.xml
@@ -14,10 +14,18 @@
The SkTypeface class specifies the typeface and intrinsic style of a font.
The SkTypeface class specifies the typeface and intrinsic style of a font.
- This is used in the paint, along with optionally algorithmic settings like textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specifyhow text appears when drawn (and measured).
+ This is used in the paint, along with optionally algorithmic settings like textSize, textSkewX, textScaleX, FakeBoldText, to specifyhow text appears when drawn (and measured).
Typeface objects are immutable, and so they can be shared between threads.
+ If you want to create type faces with specific weights not covered by the SKTypefaceStyle, you can pass a suffix to the font family name to trigger this, like this:
+
+
+
+
+
+
+
diff --git a/docs/en/SkiaSharp/SKTypefaceStyle.xml b/docs/en/SkiaSharp/SKTypefaceStyle.xml
index 6132e876..36953e51 100644
--- a/docs/en/SkiaSharp/SKTypefaceStyle.xml
+++ b/docs/en/SkiaSharp/SKTypefaceStyle.xml
@@ -10,10 +10,15 @@
System.Enum
- Specifies the intrinsic style attributes of a given typeface
+ Specifies the intrinsic style attributes of a given typeface.
+ While the API does not surface enumeration values for other thin, light, ultra-light, heavy and black, you can achieve the same result by creating an SKTypeface with the suffix “-light”, “-thin” and so on.
+ Like this:
+
+
+
diff --git a/docs/en/index.xml b/docs/en/index.xml
index 9d4149e4..ff12f646 100644
--- a/docs/en/index.xml
+++ b/docs/en/index.xml
@@ -3,7 +3,7 @@
- System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)
+ System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.DisableOptimizations | System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)
System.Reflection.AssemblyCompany("")
@@ -21,7 +21,7 @@
System.Reflection.AssemblyFileVersion("1.49.4.0")
- System.Reflection.AssemblyInformationalVersion("1.49.4.0")
+ System.Reflection.AssemblyInformationalVersion("1.49.4.0-{GIT_SHA}")
System.Reflection.AssemblyProduct("SkiaSharp")
@@ -82,6 +82,10 @@
+
+
+
+
diff --git a/native-builds/libSkiaSharp_ios/libSkiaSharp.xcodeproj/project.pbxproj b/native-builds/libSkiaSharp_ios/libSkiaSharp.xcodeproj/project.pbxproj
index 0c6e8efc..fadbfaa7 100644
--- a/native-builds/libSkiaSharp_ios/libSkiaSharp.xcodeproj/project.pbxproj
+++ b/native-builds/libSkiaSharp_ios/libSkiaSharp.xcodeproj/project.pbxproj
@@ -1143,6 +1143,8 @@
TargetAttributes = {
21FD2B2F1C014C000023CFAE = {
CreatedOnToolsVersion = 7.1.1;
+ DevelopmentTeam = PJQC57N853;
+ DevelopmentTeamName = "Miguel De Icaza";
};
};
};
diff --git a/native-builds/src/SkiaKeeper.c b/native-builds/src/SkiaKeeper.c
index 6daa05c9..8015d0b0 100644
--- a/native-builds/src/SkiaKeeper.c
+++ b/native-builds/src/SkiaKeeper.c
@@ -31,6 +31,7 @@
#include "xamarin/sk_x_maskfilter.h"
#include "xamarin/sk_x_paint.h"
#include "xamarin/sk_x_path.h"
+#include "xamarin/sk_x_patheffect.h"
#include "xamarin/sk_x_shader.h"
#include "xamarin/sk_x_stream.h"
#include "xamarin/sk_x_typeface.h"
@@ -75,6 +76,7 @@ void** KeepSkiaCSymbols ()
(void*)sk_string_new_empty,
(void*)sk_document_unref,
(void*)sk_wstream_write,
+ (void*)sk_path_effect_create_dash,
// Xamarin
(void*)sk_managedstream_new,
diff --git a/samples/SharedDemo/SkiaSharp.Demos.cs b/samples/SharedDemo/SkiaSharp.Demos.cs
index 0a72f78f..3d3ae062 100644
--- a/samples/SharedDemo/SkiaSharp.Demos.cs
+++ b/samples/SharedDemo/SkiaSharp.Demos.cs
@@ -992,6 +992,40 @@ namespace SkiaSharp
OpenFileDelegate?.Invoke ("document.pdf");
}
+ public static void PathEffects (SKCanvas canvas, int width, int height)
+ {
+ canvas.Clear (SKColors.White);
+
+ var step = height / 4;
+
+ using (var paint = new SKPaint ())
+ using (var effect = SKPathEffect.CreateDash (new [] { 15f, 5f }, 0)) {
+ paint.IsStroke = true;
+ paint.StrokeWidth = 4;
+ paint.PathEffect = effect;
+ canvas.DrawLine (10, step, width - 10 - 10, step, paint);
+ }
+
+ using (var paint = new SKPaint ())
+ using (var effect = SKPathEffect.CreateDiscrete (10, 10)) {
+ paint.IsStroke = true;
+ paint.StrokeWidth = 4;
+ paint.PathEffect = effect;
+ canvas.DrawLine (10, step * 2, width - 10 - 10, step * 2, paint);
+ }
+
+ using (var paint = new SKPaint ())
+ using (var dashEffect = SKPathEffect.CreateDash (new [] { 15f, 5f }, 0))
+ using (var discreteEffect = SKPathEffect.CreateDiscrete (10, 10))
+ using (var effect = SKPathEffect.CreateCompose (dashEffect, discreteEffect)) {
+ paint.IsStroke = true;
+ paint.StrokeWidth = 4;
+ paint.PathEffect = effect;
+ canvas.DrawLine (10, step * 3, width - 10 - 10, step * 3, paint);
+ }
+
+ }
+
[Flags]
public enum Platform
@@ -1059,6 +1093,7 @@ namespace SkiaSharp
new Sample {Title="Chained Image Filter", Method = ChainedImageFilter, Platform = Platform.All},
new Sample {Title="Measure Text Sample", Method = MeasureTextSample, Platform = Platform.All},
new Sample {Title="Create PDF", Method = CreatePdfSample, Platform = Platform.All, TapMethod = CreatePdfSampleTapped},
+ new Sample {Title="Path Effects", Method = PathEffects, Platform = Platform.All},
};
}
}
diff --git a/skia b/skia
index c2a03e93..7234fc47 160000
--- a/skia
+++ b/skia
@@ -1 +1 @@
-Subproject commit c2a03e939a4a0b53c147a78c1fa349c8b2a3034f
+Subproject commit 7234fc471549f9b6d694bd71a75261840afd18e9