Пример #1
0
        /// <inheritdoc/>
        public IPathShape ToFillPathShape(IBaseShape shape)
        {
            var path = PathGeometryConverter.ToSKPath(shape);

            if (path == null)
            {
                return(null);
            }
            var factory = _serviceProvider.GetService <IFactory>();
            var style   = shape.Style != null ?
                          (IShapeStyle)shape.Style?.Copy(null) :
                          factory.CreateShapeStyle(ProjectEditorConfiguration.DefaulStyleName);

            using var brush = SkiaSharpDrawUtil.ToSKPaintBrush(style.Fill);
            var result = brush.GetFillPath(path, 1.0f);

            if (result != null)
            {
                if (result.IsEmpty)
                {
                    result.Dispose();
                    return(null);
                }
                var geometry  = PathGeometryConverter.ToPathGeometry(result, factory);
                var pathShape = factory.CreatePathShape(
                    "Path",
                    style,
                    geometry,
                    false,
                    true);
                result.Dispose();
                return(pathShape);
            }
            return(null);
        }
Пример #2
0
 public virtual void UpdateStyle()
 {
     Fill   = SkiaSharpDrawUtil.ToSKPaintBrush(Style.Fill);
     Stroke = SkiaSharpDrawUtil.ToSKPaintPen(Style, Style.Thickness);
 }
Пример #3
0
 public override void UpdateStyle()
 {
     Fill = SkiaSharpDrawUtil.ToSKPaintBrush(Color);
 }