示例#1
0
 public override void UpdateStyle()
 {
     if (Grid.GridStrokeColor != null)
     {
         Stroke = SkiaSharpDrawUtil.ToSKPaintPen(Grid.GridStrokeColor, Grid.GridStrokeThickness);
     }
     else
     {
         Stroke = null;
     }
 }
示例#2
0
        /// <inheritdoc/>
        public IPathShape ToStrokePathShape(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);
            var stroke = (IColor)style.Stroke.Copy(null);
            var fill   = (IColor)style.Fill.Copy(null);

            style.Stroke  = fill;
            style.Fill    = stroke;
            using var pen = SkiaSharpDrawUtil.ToSKPaintPen(style, style.Thickness);
            var result = pen.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,
                    true,
                    false);
                result.Dispose();
                return(pathShape);
            }
            return(null);
        }
示例#3
0
 public virtual void UpdateStyle()
 {
     Fill   = SkiaSharpDrawUtil.ToSKPaintBrush(Style.Fill);
     Stroke = SkiaSharpDrawUtil.ToSKPaintPen(Style, Style.Thickness);
 }