Skip to content

Commit

Permalink
Merge commit 'ea608291c83c629d10a7a96c607b50bdecda9771'
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Sep 9, 2024
2 parents 999f3e1 + ea60829 commit 50701e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public PointPathEraserResult Finish()
var skPath = ToPath(subInkInfoForEraserPointPath);

var skiaStroke = SkiaStroke.CreateStaticStroke(InkId.NewId(), skPath, pointList, originSkiaStroke.Color,
originSkiaStroke.Width);
originSkiaStroke.InkThickness);
newStrokeList.Add(skiaStroke);
//result.Add(new SkiaStrokeDrawContext(subInkInfoForEraserPointPath.PointPath.OriginSkiaStroke.Color, skPath, skPath.Bounds.ToAvaloniaRect(), ShouldDisposePath: true));
}
Expand Down Expand Up @@ -153,7 +153,7 @@ private static SKPath ToPath(SubInkInfoForEraserPointPath subInkInfoForEraserPoi
{
var pointList = new StylusPointListSpan(originSkiaStroke.PointList, subSpan.Start, subSpan.Length);

var outlinePointList = SimpleInkRender.GetOutlinePointList(pointList.ToReadOnlyList(), originSkiaStroke.Width);
var outlinePointList = SimpleInkRender.GetOutlinePointList(pointList.ToReadOnlyList(), originSkiaStroke.InkThickness);

skPath.AddPoly(outlinePointList.Select(t => new SKPoint((float) t.X, (float) t.Y)).ToArray());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ private SkiaStroke(InkId id, SKPath path)
Path = path;
}

public InkId Id { get; init; }
public InkId Id { get; }

public SKPath Path { get; }

public SKColor Color { get; set; } = SKColors.Red;
public float Width { get; set; } = 20;
public SKColor Color { get; init; } = SKColors.Red;
public float InkThickness { get; init; } = 20;

public IReadOnlyList<StylusPoint> PointList => _pointList;
private readonly List<StylusPoint> _pointList = [];
Expand Down Expand Up @@ -67,7 +67,7 @@ public void AddPoint(StylusPoint point)

if (pointList.Count > 2)
{
var outlinePointList = SimpleInkRender.GetOutlinePointList(pointList, Width);
var outlinePointList = SimpleInkRender.GetOutlinePointList(pointList, InkThickness);

Path.Reset();
Path.AddPoly(outlinePointList.Select(t => new SKPoint((float) t.X, (float) t.Y)).ToArray());
Expand Down Expand Up @@ -141,7 +141,7 @@ public static SkiaStroke CreateStaticStroke(InkId id, SKPath path, StylusPointLi
var skiaStroke = new SkiaStroke(id, path)
{
Color = color,
Width = inkThickness,
InkThickness = inkThickness,
};

skiaStroke._pointList.EnsureCapacity(pointList.Length);
Expand All @@ -161,7 +161,7 @@ public Rect GetDrawBounds()
return _drawBounds;
}

return Path.Bounds.ToAvaloniaRect().Expand(Width);
return Path.Bounds.ToAvaloniaRect().Expand(InkThickness);
}

public void EnsureIsStaticStroke()
Expand Down

0 comments on commit 50701e5

Please sign in to comment.