Jumar Macato
6 years ago
No known key found for this signature in database
GPG Key ID: B19884DAC3A5BF3F
2 changed files with
31 additions and
0 deletions
-
src/Avalonia.Headless/HeadlessPlatformRenderInterface.cs
-
tests/Avalonia.UnitTests/MockStreamGeometryImpl.cs
|
|
|
@ -104,6 +104,9 @@ namespace Avalonia.Headless |
|
|
|
} |
|
|
|
|
|
|
|
public Rect Bounds { get; set; } |
|
|
|
|
|
|
|
public double ContourLength { get; } = 0; |
|
|
|
|
|
|
|
public virtual bool FillContains(Point point) => Bounds.Contains(point); |
|
|
|
|
|
|
|
public Rect GetRenderBounds(IPen pen) |
|
|
|
@ -126,6 +129,19 @@ namespace Avalonia.Headless |
|
|
|
|
|
|
|
public ITransformedGeometryImpl WithTransform(Matrix transform) => |
|
|
|
new HeadlessTransformedGeometryStub(this, transform); |
|
|
|
|
|
|
|
public bool TryGetPointAtDistance(double distance, out Point point) |
|
|
|
{ |
|
|
|
point = new Point(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGetPointAndTangentAtDistance(double distance, out Point point, out Point tangent) |
|
|
|
{ |
|
|
|
point = new Point(); |
|
|
|
tangent = new Point(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class HeadlessTransformedGeometryStub : HeadlessGeometryStub, ITransformedGeometryImpl |
|
|
|
|
|
|
|
@ -30,6 +30,8 @@ namespace Avalonia.UnitTests |
|
|
|
public IGeometryImpl SourceGeometry { get; } |
|
|
|
|
|
|
|
public Rect Bounds => _context.CalculateBounds(); |
|
|
|
|
|
|
|
public double ContourLength { get; } |
|
|
|
|
|
|
|
public Matrix Transform { get; } |
|
|
|
|
|
|
|
@ -69,6 +71,19 @@ namespace Avalonia.UnitTests |
|
|
|
return new MockStreamGeometryImpl(transform, _context); |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGetPointAtDistance(double distance, out Point point) |
|
|
|
{ |
|
|
|
point = new Point(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
public bool TryGetPointAndTangentAtDistance(double distance, out Point point, out Point tangent) |
|
|
|
{ |
|
|
|
point = new Point(); |
|
|
|
tangent = new Point(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
class MockStreamGeometryContext : IStreamGeometryContextImpl |
|
|
|
{ |
|
|
|
private List<Point> points = new List<Point>(); |
|
|
|
|