private SKPath ToPath(IToolContext context, IBaseShape shape) { var fillType = SKPathFillType.Winding; if (shape is PathShape pathShape) { fillType = SkiaHelper.ToSKPathFillType(pathShape.FillType); } var geometry = new SKPath() { FillType = fillType }; if (SkiaHelper.AddShape(context, shape, 0.0, 0.0, geometry) == true) { return(geometry); } else { geometry.Dispose(); } return(null); }
private IList <SKPath> ToPaths(IToolContext context, IList <IBaseShape> shapes) { if (shapes == null || shapes.Count <= 0) { return(null); } var paths = new List <SKPath>(); for (int i = 0; i < shapes.Count; i++) { var fillType = SKPathFillType.Winding; if (shapes[i] is PathShape pathShape) { fillType = SkiaHelper.ToSKPathFillType(pathShape.FillType); } var path = new SKPath() { FillType = fillType }; var result = SkiaHelper.AddShape(context, shapes[i], 0.0, 0.0, path); if (result == true && path.IsEmpty == false) { paths.Add(path); } else { path.Dispose(); } } return(paths); }
public void DrawPath(object dc, PathShape path, string styleId, double dx, double dy, double scale) { var geometry = new SKPath() { FillType = SkiaHelper.ToSKPathFillType(path.FillType) }; SkiaHelper.AddPath(null, path, dx, dy, geometry); _rootNodes[_currentRootNode].Children.Add(new ChildNode(path, styleId, dx, dy, scale, geometry)); }