Merge branch 'master' into gpu-support

This commit is contained in:
Matthew Leibowitz 2016-08-21 00:44:18 +02:00
Родитель 1163700431 0f12502d98
Коммит 8a42feafd0
9 изменённых файлов: 285 добавлений и 2 удалений

Просмотреть файл

@ -365,6 +365,14 @@ namespace SkiaSharp
StrokeAndFill,
}
public enum SKPaintHinting
{
NoHinting = 0,
Slight = 1,
Normal = 2,
Full = 3
}
public enum SKRegionOperation
{
Difference,

Просмотреть файл

@ -19,6 +19,14 @@ namespace SkiaSharp
{
}
public SKCanvas (SKBitmap bitmap)
: this (IntPtr.Zero, true)
{
if (bitmap == null)
throw new ArgumentNullException (nameof (bitmap));
Handle = SkiaApi.sk_canvas_new_from_bitmap (bitmap.Handle);
}
public int Save ()
{
if (Handle == IntPtr.Zero)

Просмотреть файл

@ -62,6 +62,96 @@ namespace SkiaSharp
}
}
public bool IsLinearText {
get {
return SkiaApi.sk_paint_is_linear_text (Handle);
}
set {
SkiaApi.sk_paint_set_linear_text (Handle, value);
}
}
public bool SubpixelText {
get {
return SkiaApi.sk_paint_is_subpixel_text (Handle);
}
set {
SkiaApi.sk_paint_set_subpixel_text (Handle, value);
}
}
public bool LcdRenderText {
get {
return SkiaApi.sk_paint_is_lcd_render_text (Handle);
}
set {
SkiaApi.sk_paint_set_lcd_render_text (Handle, value);
}
}
public bool IsEmbeddedBitmapText {
get {
return SkiaApi.sk_paint_is_embedded_bitmap_text (Handle);
}
set {
SkiaApi.sk_paint_set_embedded_bitmap_text (Handle, value);
}
}
public bool IsAutohinted {
get {
return SkiaApi.sk_paint_is_autohinted (Handle);
}
set {
SkiaApi.sk_paint_set_autohinted (Handle, value);
}
}
public SKPaintHinting HintingLevel {
get {
return SkiaApi.sk_paint_get_hinting (Handle);
}
set {
SkiaApi.sk_paint_set_hinting (Handle, value);
}
}
public bool UnderlineText {
get {
return SkiaApi.sk_paint_is_underline_text (Handle);
}
set {
SkiaApi.sk_paint_set_underline_text (Handle, value);
}
}
public bool StrikeThruText {
get {
return SkiaApi.sk_paint_is_strikethru_text (Handle);
}
set {
SkiaApi.sk_paint_set_strikethru_text (Handle, value);
}
}
public bool FakeBoldText {
get {
return SkiaApi.sk_paint_is_fake_bold_text (Handle);
}
set {
SkiaApi.sk_paint_set_fake_bold_text (Handle, value);
}
}
public bool DeviceKerningEnabled {
get {
return SkiaApi.sk_paint_is_dev_kern_text (Handle);
}
set {
SkiaApi.sk_paint_set_dev_kern_text (Handle, value);
}
}
public bool IsStroke {
get {
return SkiaApi.sk_paint_get_style (Handle) != SKPaintStyle.Fill;

Просмотреть файл

@ -62,6 +62,43 @@ namespace SkiaSharp
}
}
public int PointCount {
get {
return SkiaApi.sk_path_count_points (Handle);
}
}
public SKPoint this [int index] {
get {
return GetPoint (index);
}
}
public SKPoint[] Points {
get {
return GetPoints (PointCount);
}
}
public SKPoint GetPoint (int index)
{
SKPoint point;
SkiaApi.sk_path_get_point (Handle, index, out point);
return point;
}
public SKPoint[] GetPoints (int max)
{
SKPoint[] points = new SKPoint [max];
GetPoints (points, max);
return points;
}
public int GetPoints (SKPoint[] points, int max)
{
return SkiaApi.sk_path_get_points (Handle, points, max);
}
public void MoveTo (float x, float y)
{
SkiaApi.sk_path_move_to (Handle, x, y);

Просмотреть файл

@ -195,10 +195,14 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_clip_path_with_operation(sk_canvas_t t, sk_path_t cpath, SKRegionOperation op, bool doAA);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_canvas_get_clip_device_bounds(sk_canvas_t t, ref SKRectI cbounds);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_canvas_get_clip_bounds(sk_canvas_t t, ref SKRect cbounds);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_canvas_t sk_canvas_new_from_bitmap(sk_bitmap_t bitmap);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_canvas_flush (sk_canvas_t canvas);
// Paint
@ -208,14 +212,17 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_delete(sk_paint_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_antialias(sk_paint_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_antialias(sk_paint_t t, bool v);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_dither(sk_paint_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_dither(sk_paint_t t, bool v);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_verticaltext(sk_paint_t t);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_verticaltext(sk_paint_t t, bool v);
@ -324,6 +331,56 @@ namespace SkiaSharp
[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)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_linear_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_linear_text(sk_paint_t cpaint, bool linearText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_subpixel_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_subpixel_text(sk_paint_t cpaint, bool subpixelText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_lcd_render_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_lcd_render_text(sk_paint_t cpaint, bool lcdText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_embedded_bitmap_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_embedded_bitmap_text(sk_paint_t cpaint, bool useEmbeddedBitmapText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_autohinted(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_autohinted(sk_paint_t cpaint, bool useAutohinter);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SKPaintHinting sk_paint_get_hinting(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_hinting(sk_paint_t cpaint, SKPaintHinting hintingLevel);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_underline_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_underline_text(sk_paint_t cpaint, bool underlineText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_strikethru_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_strikethru_text(sk_paint_t cpaint, bool strikeThruText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_fake_bold_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_fake_bold_text(sk_paint_t cpaint, bool fakeBoldText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_paint_is_dev_kern_text(sk_paint_t cpaint);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_paint_set_dev_kern_text(sk_paint_t cpaint, bool devKernText);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_image_t sk_image_new_raster_copy(ref SKImageInfo info, IntPtr pixels, IntPtr rowBytes);
@ -394,6 +451,7 @@ namespace SkiaSharp
[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)]
[return: MarshalAs(UnmanagedType.I1)]
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);
@ -411,6 +469,12 @@ namespace SkiaSharp
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);
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int sk_path_count_points (sk_path_t path);
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_path_get_point (sk_path_t path, int index, out SKPoint point);
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int sk_path_get_points (sk_path_t path, [Out] SKPoint[] points, int max);
// iterator
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
@ -678,6 +742,7 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_stream_skip(sk_stream_t stream, IntPtr size);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_is_at_end(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SByte sk_stream_read_s8(sk_stream_t stream);
@ -692,18 +757,24 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static UInt32 sk_stream_read_u32(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_bool(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_rewind(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_has_position(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_stream_get_position(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_seek(sk_stream_t stream, IntPtr position);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_move(sk_stream_t stream, long offset);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_has_length(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_stream_get_length(sk_stream_t stream);
@ -745,8 +816,10 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_stream_assetstream_t sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t cstream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write(sk_wstream_t cstream, IntPtr buffer, IntPtr size);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write(sk_wstream_t cstream, byte[] buffer, IntPtr size);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_wstream_newline(sk_wstream_t cstream);
@ -755,28 +828,40 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_wstream_bytes_written(sk_wstream_t cstream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_8(sk_wstream_t cstream, Byte value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_16(sk_wstream_t cstream, UInt16 value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_32(sk_wstream_t cstream, UInt32 value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_text(sk_wstream_t cstream, string value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_dec_as_text(sk_wstream_t cstream, Int32 value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_bigdec_as_text(sk_wstream_t cstream, Int64 value, int minDigits);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_hex_as_text(sk_wstream_t cstream, UInt32 value, int minDigits);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_scalar_as_text(sk_wstream_t cstream, float value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_bool(sk_wstream_t cstream, bool value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_scalar(sk_wstream_t cstream, float value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_packed_uint(sk_wstream_t cstream, IntPtr value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_stream(sk_wstream_t cstream, sk_stream_t input, IntPtr length);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static int sk_wstream_get_size_of_packed_uint(IntPtr value);
@ -799,6 +884,7 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_document_end_page(sk_document_t document);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_document_close(sk_document_t document);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_document_abort(sk_document_t document);
@ -849,12 +935,15 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_bitmap_get_byte_count(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_is_null(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_is_immutable(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_set_immutable(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_is_volatile(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_set_volatile(sk_bitmap_t b, bool value);
@ -869,16 +958,20 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_set_pixel_color(sk_bitmap_t cbitmap, int x, int y, SKColor color);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_copy(sk_bitmap_t cbitmap, sk_bitmap_t dst, SKColorType ct);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_can_copy_to(sk_bitmap_t cbitmap, SKColorType ct);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_lock_pixels(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_unlock_pixels(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_try_alloc_pixels(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, IntPtr rowBytes);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t cbitmap, ref SKImageInfo requestedInfo, sk_pixelref_factory_t factory, sk_colortable_t ctable);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static sk_colortable_t sk_bitmap_get_colortable(sk_bitmap_t cbitmap);

Просмотреть файл

@ -289,6 +289,9 @@ var InjectCompatibilityExternals = new Action<bool> ((inject) => {
{ "skia/third_party/externals/dng_sdk/source/dng_pthread.cpp", "#if qWinOS" },
{ "skia/third_party/externals/zlib/deflate.c", "#include <assert.h>" },
{ "skia/third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c", "#define JPEG_INTERNALS" },
{ "skia/third_party/externals/libjpeg-turbo/simd/jsimd_i386.c", "#define JPEG_INTERNALS" },
{ "skia/third_party/externals/libjpeg-turbo/simd/jsimd_arm.c", "#define JPEG_INTERNALS" },
{ "skia/third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c", "#define JPEG_INTERNALS" },
};
foreach (var filePair in files) {
var file = filePair.Key;

Просмотреть файл

@ -18,10 +18,10 @@
<AttributeName>System.Reflection.AssemblyDescription("")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Reflection.AssemblyFileVersion("1.53.1.1")</AttributeName>
<AttributeName>System.Reflection.AssemblyFileVersion("1.53.2-gpu2")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Reflection.AssemblyInformationalVersion("1.53.1.1")</AttributeName>
<AttributeName>System.Reflection.AssemblyInformationalVersion("1.53.2-gpu2")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Reflection.AssemblyProduct("SkiaSharp")</AttributeName>

Просмотреть файл

@ -103,6 +103,9 @@
<Compile Include="..\Tests\SKPaintTest.cs" >
<Link>SKPaintTest.cs</Link>
</Compile>
<Compile Include="..\Tests\SKPathTest.cs" >
<Link>SKPathTest.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\samples\SharedDemo\content-font.ttf">

41
tests/Tests/SKPathTest.cs Normal file
Просмотреть файл

@ -0,0 +1,41 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using NUnit.Framework;
namespace SkiaSharp.Tests
{
[TestFixture]
public class SKPathTest : SKTest
{
[Test]
public void PathPointsAreCorrect()
{
using (var path = new SKPath ()) {
// set up the xamagon
path.MoveTo (71.4311121f, 56f);
path.CubicTo (68.6763107f, 56.0058575f, 65.9796704f, 57.5737917f, 64.5928855f, 59.965729f);
path.LineTo (43.0238921f, 97.5342563f);
path.CubicTo (41.6587026f, 99.9325978f, 41.6587026f, 103.067402f, 43.0238921f, 105.465744f);
path.LineTo (64.5928855f, 143.034271f);
path.CubicTo (65.9798162f, 145.426228f, 68.6763107f, 146.994582f, 71.4311121f, 147f);
path.LineTo (114.568946f, 147f);
path.CubicTo (117.323748f, 146.994143f, 120.020241f, 145.426228f, 121.407172f, 143.034271f);
path.LineTo (142.976161f, 105.465744f);
path.CubicTo (144.34135f, 103.067402f, 144.341209f, 99.9325978f, 142.976161f, 97.5342563f);
path.LineTo (121.407172f, 59.965729f);
path.CubicTo (120.020241f, 57.5737917f, 117.323748f, 56.0054182f, 114.568946f, 56f);
path.LineTo (71.4311121f, 56f);
path.Close ();
// the right number/count
Assert.AreEqual (25, path.PointCount);
Assert.AreEqual (25, path.Points.Length);
// the right value
Assert.AreEqual (new SKPoint (68.6763107f, 56.0058575f), path.GetPoint (1));
Assert.AreEqual (new SKPoint (68.6763107f, 56.0058575f), path.Points [1]);
}
}
}
}