14 changed files with 201 additions and 22 deletions
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.Media; |
|||
|
|||
internal class ImmutableGeometry : Geometry |
|||
{ |
|||
public ImmutableGeometry(IGeometryImpl? platformImpl) |
|||
: base(platformImpl) |
|||
{ |
|||
} |
|||
|
|||
public override Geometry Clone() => new ImmutableGeometry(PlatformImpl); |
|||
|
|||
private protected override IGeometryImpl? CreateDefiningGeometry() |
|||
{ |
|||
return PlatformImpl; |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
using SkiaSharp; |
|||
|
|||
namespace Avalonia.Skia.Helpers; |
|||
|
|||
internal static class SKPathHelper |
|||
{ |
|||
public static SKPath CreateClosedPath(SKPath path) |
|||
{ |
|||
using var iter = path.CreateIterator(true); |
|||
SKPathVerb verb; |
|||
var points = new SKPoint[4]; |
|||
var rv = new SKPath(); |
|||
while ((verb = iter.Next(points)) != SKPathVerb.Done) |
|||
{ |
|||
if (verb == SKPathVerb.Move) |
|||
rv.MoveTo(points[0]); |
|||
else if (verb == SKPathVerb.Line) |
|||
rv.LineTo(points[1]); |
|||
else if (verb == SKPathVerb.Close) |
|||
rv.Close(); |
|||
else if (verb == SKPathVerb.Quad) |
|||
rv.QuadTo(points[1], points[2]); |
|||
else if (verb == SKPathVerb.Cubic) |
|||
rv.CubicTo(points[1], points[2], points[3]); |
|||
else if (verb == SKPathVerb.Conic) |
|||
rv.ConicTo(points[1], points[2], iter.ConicWeight()); |
|||
|
|||
} |
|||
|
|||
return rv; |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in new issue