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