Ejemplo n.º 1
0
        /// <summary>
        /// Parse and display the new input stream
        /// </summary>
        private void CreatePaths(string stream)
        {
            try
            {
                var streamGeometryParser = new StreamGeometryParser();
                var graphicPathGeometry  = streamGeometryParser.ParseGeometry(stream);

                var path = new GraphicPath();
                selectedPath   = path;
                path.Geometry  = graphicPathGeometry;
                path.FillBrush = new GraphicSolidColorBrush {
                    Color = Color.FromRgb(128, 128, 128)
                };

                ErrorIndicator.Visibility = Visibility.Collapsed;

                if (path.Geometry.Segments.Count > 0)
                {
                    ExportButton.IsEnabled = true;
                    //ExportIcoButton.IsEnabled = true;
                }
                else
                {
                    DisableExportButtons();
                }
            }
            catch
            {
                selectedPath = null;
                ErrorIndicator.Visibility = Visibility.Visible;
                DisableExportButtons();
            }

            UpdateAll();
        }
Ejemplo n.º 2
0
 public void AddGraphicPath(InfoGraphicObject currentObject, params InfoGraphicObject[] graphicObjects)
 {
     RemoveCurrentObjectHelpers(false);
     CurrentObject = currentObject;
     GraphicPath.Clear();
     GraphicPath.AddRange(graphicObjects);
 }
        /// <summary>
        /// Generate code for a path
        /// </summary>
        private void GeneratePath(GraphicPath graphicPath)
        {
            foreach (var segment in graphicPath.Geometry.Segments)
            {
                switch (segment)
                {
                case GraphicMoveSegment graphicsMove:
                {
                    BeginFigure(graphicsMove.StartPoint, true, graphicsMove.IsClosed);
                    break;
                }

                case GraphicLineSegment graphicsLineTo:
                {
                    LineTo(graphicsLineTo.To, true, true);
                    break;
                }

                case GraphicCubicBezierSegment graphicsCubicBezier:
                {
                    BezierTo(graphicsCubicBezier.ControlPoint1, graphicsCubicBezier.ControlPoint2, graphicsCubicBezier.EndPoint, true, true);
                    break;
                }

                case GraphicQuadraticBezierSegment graphicQuadraticBezier:
                {
                    QuadraticBezierTo(graphicQuadraticBezier.ControlPoint, graphicQuadraticBezier.EndPoint, true, true);
                    break;
                }

                default:
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the path
        /// </summary>
        private GraphicPath ParsePath(IPsdLayer layer, Size size)
        {
            var graphicPath = new GraphicPath();

            foreach (var resource in layer.Resources)
            {
                switch (resource)
                {
                // vector mask equals paths
                // vsmsResource inherits from smsk: we don't need to add the extra 'case'
                case vmskResource vmsk:
                {
                    ReadBezier(vmsk.Beziers, graphicPath, size);
                    break;
                }
                }
            }

            if (graphicPath.Geometry.Segments.Count == 0)
            {
                graphicPath = null;
            }

            return(graphicPath);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Parse and display the new input stream
        /// </summary>
        private void CreatePaths(string stream)
        {
            GraphicPath path;

            try
            {
                var streamGeometryParser = new StreamGeometryParser();
                var graphicPathGeometry  = streamGeometryParser.ParseGeometry(stream);

                path           = new GraphicPath();
                path.Geometry  = graphicPathGeometry;
                path.FillBrush = new GraphicSolidColorBrush {
                    Color = Color.FromRgb(128, 128, 128)
                };

                ShowError = false;
            }
            catch
            {
                path      = null;
                ShowError = true;
            }

            PreviewViewModel.SetNewGraphicPath(path);
            ResourceViewModel.SetNewGraphicVisual(path);
            XamlViewModel.SetNewGraphicVisual(path);
            CSharpViewModel.SetNewGraphicVisual(path);
            ExportViewModel.SetNewGraphicVisual(path);
        }
Ejemplo n.º 6
0
 public void AddGraphicPath(InfoGraphicObject currentObject, params InfoGraphicObject[] graphicObjects)
 {
     RemoveAnimationHelpers();
     _currentObject = currentObject;
     GraphicPath.Clear();
     GraphicPath.AddRange(graphicObjects);
     Invalidate();
 }
        /// <summary>
        /// Create a GeometryDrawing from a single graphic path
        /// </summary>
        private static Drawing GeneratePath(GraphicPath graphicPath)
        {
            var geometryDrawing = new GeometryDrawing();

            geometryDrawing.Geometry = GeometryBinaryGenerator.GenerateGeometry(graphicPath.Geometry);
            SetColors(graphicPath, geometryDrawing);

            return(geometryDrawing);
        }
Ejemplo n.º 8
0
        public void ClearObjects()
        {
            RemoveAnimationHelpers();

            _currentObject = null;
            GraphicObject.Clear();
            GraphicRelation.Clear();
            GraphicPath.Clear();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get the colors
        /// </summary>
        private void ParseColors(IPsdLayer layer, GraphicPath graphicPath)
        {
            var bounds      = graphicPath.Geometry.Bounds;
            var aspectRatio = bounds.Height / bounds.Width;

            foreach (var resource in layer.Resources)
            {
                switch (resource)
                {
                // backwards compatibility solid color
                case vscgResource vscg:
                {
                    var(color, colorPrecision) = colorManager.GetBrush(vscg.Color, aspectRatio, false);
                    graphicPath.FillBrush      = color;
                    graphicPath.ColorPrecision = colorPrecision;
                    break;
                }

                // solid color
                case SoCoResource soCo:
                {
                    var(color, colorPrecision) = colorManager.GetBrush(soCo.Color, aspectRatio, false);
                    graphicPath.FillBrush      = color;
                    graphicPath.ColorPrecision = colorPrecision;
                    break;
                }

                // pattern fill
                case PtFlResource ptFl:
                {
                    var(color, colorPrecision) = colorManager.GetBrush(ptFl.Color, aspectRatio, false);
                    graphicPath.FillBrush      = color;
                    graphicPath.ColorPrecision = colorPrecision;
                    break;
                }

                // gradient fill
                case GdFlResource gdFl:
                {
                    var(color, colorPrecision) = colorManager.GetBrush(gdFl.Color, aspectRatio, false);
                    graphicPath.FillBrush      = color;
                    graphicPath.ColorPrecision = colorPrecision;
                    break;
                }

                // stroke infos
                case vstkResource vstk:
                {
                    var(color, colorPrecision)  = colorManager.GetBrush(vstk.Color, aspectRatio, true);
                    graphicPath.StrokeBrush     = color;
                    graphicPath.StrokeThickness = vstk.Width;
                    graphicPath.ColorPrecision  = colorPrecision;
                    break;
                }
                }
            }
        }
        /// <summary>
        /// Create a brush from a single graphic paths
        /// </summary>
        public static Brush Generate(GraphicPath graphicPath)
        {
            var drawingBrush = new DrawingBrush();

            drawingBrush.Stretch = Stretch.Uniform;

            drawingBrush.Drawing = GeneratePath(graphicPath);

            return(drawingBrush);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Set all colors of the graphic path
 /// </summary>
 public void SetFillAndStroke(XElement path,
                              GraphicPath graphicPath,
                              Matrix currentTransformationMatrix,
                              double parentOpacity,
                              double parentFillOpacity,
                              double parentStrokeOpacity)
 {
     SetFill(path, graphicPath, currentTransformationMatrix, parentOpacity * parentFillOpacity);
     SetStroke(path, graphicPath, currentTransformationMatrix, parentOpacity * parentStrokeOpacity);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Set the colors
        /// </summary>
        private static void SetColors(GraphicPath graphicPath, XElement pathElement, XNamespace ns, XElement definitions, ref int definitionsCount)
        {
            if (graphicPath.FillBrush != null)
            {
                GenerateBrush(graphicPath.FillBrush, pathElement, ns, "fill", definitions, ref definitionsCount);
            }
            else
            {
                pathElement.Add(new XAttribute("fill", "none"));
            }

            if (graphicPath.StrokeBrush != null)
            {
                GenerateBrush(graphicPath.StrokeBrush, pathElement, ns, "stroke", definitions, ref definitionsCount);

                pathElement.Add(new XAttribute("stroke-width", DoubleUtilities.FormatString(graphicPath.StrokeThickness)));

                if (graphicPath.StrokeLineCap != GraphicLineCap.Flat)
                {
                    pathElement.Add(new XAttribute("stroke-linecap", ConvertToSvg(graphicPath.StrokeLineCap)));
                }

                if (graphicPath.StrokeLineJoin != GraphicLineJoin.Miter)
                {
                    pathElement.Add(new XAttribute("stroke-linejoin", ConvertToSvg(graphicPath.StrokeLineJoin)));
                }

                if (!DoubleUtilities.IsEqual(graphicPath.StrokeMiterLimit, 4))
                {
                    pathElement.Add(new XAttribute("stroke-miterlimit", DoubleUtilities.FormatString(graphicPath.StrokeMiterLimit)));
                }

                if (graphicPath.StrokeDashes != null)
                {
                    var result = new StringBuilder();

                    for (int i = 0; i < graphicPath.StrokeDashes.Count; i++)
                    {
                        if (i != 0)
                        {
                            result.Append(" ");
                        }

                        result.Append(DoubleUtilities.FormatString(graphicPath.StrokeDashes[i] * graphicPath.StrokeThickness));
                    }

                    pathElement.Add(new XAttribute("stroke-dasharray", result.ToString()));

                    if (!DoubleUtilities.IsZero(graphicPath.StrokeDashOffset))
                    {
                        pathElement.Add(new XAttribute("stroke-dashoffset", DoubleUtilities.FormatString(graphicPath.StrokeDashOffset * graphicPath.StrokeThickness)));
                    }
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Build up a path from the current geometry and the current fill
        /// </summary>
        private GraphicPath GetCurrentPathFilled()
        {
            var path = new GraphicPath();

            path.Geometry = currentGeometry;

            path.FillBrush      = currentGraphicsState.FillBrush.GetBrush(currentGeometry.Bounds, currentGraphicsState.SoftMask);
            path.ColorPrecision = currentGraphicsState.FillBrush.ColorPrecision;

            return(path);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Set common shape attributes
        /// </summary>
        private void SetShapeAttributes(GraphicPath graphicPath, GraphicPath normalizedPath)
        {
            normalizedPath.FillBrush = NormalizeBrush(graphicPath.FillBrush);

            normalizedPath.StrokeBrush      = NormalizeBrush(graphicPath.StrokeBrush);
            normalizedPath.StrokeThickness  = NormalizeThickness(graphicPath.StrokeThickness);
            normalizedPath.StrokeLineCap    = graphicPath.StrokeLineCap;
            normalizedPath.StrokeLineJoin   = graphicPath.StrokeLineJoin;
            normalizedPath.StrokeDashOffset = graphicPath.StrokeDashOffset;
            normalizedPath.StrokeDashes     = graphicPath.StrokeDashes;
            normalizedPath.StrokeMiterLimit = NormalizeThickness(graphicPath.StrokeMiterLimit);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Generate a shape
        /// </summary>
        private static XElement GeneratePath(GraphicPath graphicPath, XNamespace ns, XElement definitions, ref int definitionsCount)
        {
            var pathElement = new XElement(ns + "path");

            var pathStr = StreamSourceGenerator.GenerateStreamGeometry(graphicPath.Geometry, false);

            pathElement.Add(new XAttribute("d", pathStr));

            SetColors(graphicPath, pathElement, ns, definitions, ref definitionsCount);

            return(pathElement);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Set a new visual
        /// </summary>
        public void SetNewGraphicPath(GraphicPath path)
        {
            if (path == null)
            {
                Preview = null;
            }

            var geometry = GeometryBinaryGenerator.GenerateGeometry(path.Geometry);

            Preview = geometry;
            UpdatePreviewAll();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Set common shape attributes
        /// </summary>
        private void SetShapeAttributes(GraphicPath graphicPath, GraphicPath transformedPath)
        {
            transformedPath.FillBrush = TransformBrush(graphicPath.FillBrush);

            transformedPath.StrokeBrush      = TransformBrush(graphicPath.StrokeBrush);
            transformedPath.StrokeThickness  = MatrixUtilities.TransformScale(graphicPath.StrokeThickness, transformMatrix);
            transformedPath.StrokeMiterLimit = MatrixUtilities.TransformScale(graphicPath.StrokeMiterLimit, transformMatrix);
            transformedPath.StrokeLineCap    = graphicPath.StrokeLineCap;
            transformedPath.StrokeLineJoin   = graphicPath.StrokeLineJoin;
            transformedPath.StrokeDashOffset = graphicPath.StrokeDashOffset;
            transformedPath.StrokeDashes     = graphicPath.StrokeDashes;
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Generate the XAML source code (a <Path/> for a single graphic path
        /// </summary>
        public static string GenerateGeometry(GraphicPath graphicPath)
        {
            var           tag            = "Geometry";
            var           indentTag      = SourceGeneratorHelper.GetTagIndent(0);
            var           indentProperty = SourceGeneratorHelper.GetPropertyIndent(0, tag);
            StringBuilder result         = new StringBuilder();

            result.Append($"<{tag} x:Key=\"xyzIcon\">");
            result.Append(GenerateStreamGeometry(graphicPath.Geometry, false));
            result.Append($"\"</{tag}>");

            return(result.ToString());
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Parse one layer
        /// </summary>
        private GraphicPath ParseLayer(IPsdLayer layer, Size size)
        {
            GraphicPath graphicPath = ParsePath(layer, size);

            if (graphicPath == null || graphicPath.Geometry.Segments.Count == 0)
            {
                return(null);
            }

            ParseColors(layer, graphicPath);

            return(graphicPath);
        }
        /// <summary>
        /// Generate path
        /// </summary>
        private static void GeneratePath(GraphicPath graphicPath, StringBuilder result, int level)
        {
            var tag            = "GeometryDrawing";
            var indentTag      = SourceGeneratorHelper.GetTagIndent(level);
            var indentProperty = SourceGeneratorHelper.GetPropertyIndent(level, tag);

            result.Append($"{indentTag}<{tag} ");

            bool fillColorInExtendedProperties = false;

            if (graphicPath.FillBrush != null)
            {
                if (graphicPath.FillBrush is GraphicSolidColorBrush solidFillColor)
                {
                    Color color = solidFillColor.Color;
                    var   brush = string.Format("Brush=\"{0}\"", SourceGeneratorHelper.FormatColorParamter(color));
                    result.AppendLine(brush);
                    result.Append(indentProperty);
                }
                else
                {
                    fillColorInExtendedProperties = true;
                }
            }

            result.Append(string.Format("Geometry=\""));
            var stream = StreamSourceGenerator.GenerateStreamGeometry(graphicPath.Geometry);

            result.Append(stream);
            result.Append("\"");

            if (fillColorInExtendedProperties || graphicPath.StrokeBrush != null)
            {
                result.AppendLine(">");

                if (fillColorInExtendedProperties)
                {
                    SourceGeneratorHelper.GenerateBrush(result, graphicPath.FillBrush, "GeometryDrawing.Brush", level + 1);
                }

                GeneratePen(result, graphicPath, level + 1);

                result.Append(indentTag);
                result.AppendLine("</GeometryDrawing>");
            }
            else
            {
                result.AppendLine("/>");
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Set all colors of the graphic path
        /// </summary>
        private void SetStroke(XElement path, GraphicPath graphicPath, Matrix currentTransformationMatrix, double parentOpacity)
        {
            graphicPath.StrokeBrush = CreateBrush(path, "stroke", false, graphicPath, currentTransformationMatrix, parentOpacity);

            if (graphicPath.StrokeBrush != null)
            {
                graphicPath.StrokeThickness  = MatrixUtilities.TransformScale(GetLengthPercentFromCascade("stroke-width", 1), currentTransformationMatrix);
                graphicPath.StrokeMiterLimit = MatrixUtilities.TransformScale(cssStyleCascade.GetNumber("stroke-miterlimit", 4), currentTransformationMatrix);
                graphicPath.StrokeLineCap    = GetLineCap();
                graphicPath.StrokeLineJoin   = GetLineJoin();
                graphicPath.StrokeDashOffset = MatrixUtilities.TransformScale(GetLengthPercentFromCascade("stroke-dashoffset", 0), currentTransformationMatrix) / graphicPath.StrokeThickness;
                graphicPath.StrokeDashes     = GetDashes(graphicPath.StrokeThickness, currentTransformationMatrix);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Build up a path from the current geometry and the current fill
        /// </summary>
        public static void Fill(EpsInterpreter interpreter, GraphicFillRule fillRule)
        {
            GraphicsState graphicState = interpreter.GraphicState;

            graphicState.CurrentGeometry.FillRule = fillRule;
            var path = new GraphicPath();

            path.Geometry = graphicState.CurrentGeometry;

            path.FillBrush      = graphicState.FillBrush.GetBrush(graphicState.CurrentGeometry.Bounds);
            path.ColorPrecision = graphicState.FillBrush.ColorPrecision;

            interpreter.GraphicGroup.Children.Add(path);
            interpreter.ResetCurrentGeometry();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Parse a single SVG shape
        /// </summary>
        public GraphicVisual Parse(XElement shape,
                                   XNamespace svgNamespace,
                                   Matrix currentTransformationMatrix,
                                   CssStyleCascade cssStyleCascade,
                                   Dictionary <string, XElement> globalDefinitions)
        {
            GraphicVisual graphicVisual = null;

            cssStyleCascade.PushStyles(shape);

            var transform = cssStyleCascade.GetPropertyFromTop("transform");

            if (!string.IsNullOrEmpty(transform))
            {
                var transformMatrix = TransformMatrixParser.GetTransformMatrix(transform);
                currentTransformationMatrix = transformMatrix * currentTransformationMatrix;
            }

            var geometry = GeometryParser.Parse(shape, currentTransformationMatrix);

            if (geometry != null)
            {
                var graphicPath = new GraphicPath();
                graphicPath.Geometry = geometry;
                graphicVisual        = graphicPath;

                this.svgNamespace                = svgNamespace;
                this.globalDefinitions           = globalDefinitions;
                this.currentTransformationMatrix = currentTransformationMatrix;
                this.cssStyleCascade             = cssStyleCascade;

                SetFillAndStroke(shape, graphicPath);

                if (Clipping.IsClipPathSet(cssStyleCascade))
                {
                    // shapes don't support clipping, create a group around it
                    var group = new GraphicGroup();
                    graphicVisual = group;
                    group.Childreen.Add(graphicPath);

                    Clipping.SetClipPath(group, currentTransformationMatrix, cssStyleCascade, globalDefinitions);
                }

                cssStyleCascade.Pop();
            }

            return(graphicVisual);
        }
Ejemplo n.º 24
0
        public override void Execute(EpsInterpreter interpreter)
        {
            var shadingDict = interpreter.OperandStack.PopDictionary();

            GraphicsState graphicState = interpreter.GraphicState;

            var graphicPath       = new GraphicPath();
            var shadingDescriptor = ShadingActivator.CreateShading(interpreter, shadingDict);

            graphicPath.Geometry  = graphicState.ClippingPath;
            graphicPath.FillBrush = shadingDescriptor.GetBrush(graphicState.CurrentTransformationMatrix,
                                                               graphicState.ClippingPath.Bounds);
            graphicPath.ColorPrecision = shadingDescriptor.ColorPrecision;

            interpreter.GraphicGroup.Childreen.Add(graphicPath);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Build up a path from the current geometry and the current stroke
        /// </summary>
        private GraphicPath GetCurrentPathStroked()
        {
            var path = new GraphicPath();

            path.Geometry = currentGeometry;

            path.StrokeThickness = currentGraphicsState.LineWidth;
            path.StrokeBrush     = currentGraphicsState.StrokeBrush.GetBrush(currentGeometry.Bounds, currentGraphicsState.SoftMask);
            path.StrokeLineCap   = currentGraphicsState.LineCap;
            path.StrokeLineJoin  = currentGraphicsState.LineJoin;

            SetFinalDashes(path);

            path.ColorPrecision = currentGraphicsState.StrokeBrush.ColorPrecision;

            return(path);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Create a WPF Brush used as preview.
        /// We want to show any shape even more or less invisible shapes. A shape is invisible when:
        /// - there is no fill color or the fill color is almost white
        /// - there is no stroke color or the stroke color is almost white
        /// - the stroke is too thin
        /// To judge the stroke thickness we normalize the shape to the size of the preview. This also
        /// normalizes the stroke thickness.
        /// </summary>
        public static Brush GeneratePreview(GraphicPath graphicPath, Size previewSize)
        {
            var normalizer     = new NormalizeVisual();
            var normalizedPath = (GraphicPath)normalizer.Normalize(graphicPath, previewSize);

            if (!IsShapeVisible(normalizedPath))
            {
                byte gray = 0xD0;
                normalizedPath.StrokeBrush = new GraphicSolidColorBrush {
                    Color = Color.FromRgb(gray, gray, gray)
                };
                normalizedPath.StrokeThickness = 1;
            }

            var brush = DrawingBrushBinaryGenerator.Generate(normalizedPath);

            return(brush);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Set all colors of the graphic path
        /// </summary>
        private void SetFillAndStroke(XElement path, GraphicPath graphicPath)
        {
            // fill
            graphicPath.FillBrush = CreateBrush(path, "fill", true, graphicPath);

            // stroke
            graphicPath.StrokeBrush = CreateBrush(path, "stroke", false, graphicPath);

            if (graphicPath.StrokeBrush != null)
            {
                graphicPath.StrokeThickness  = MatrixUtilities.TransformScale(cssStyleCascade.GetDouble("stroke-width", 1), currentTransformationMatrix);
                graphicPath.StrokeMiterLimit = MatrixUtilities.TransformScale(cssStyleCascade.GetDouble("stroke-miterlimit", 4), currentTransformationMatrix);
                graphicPath.StrokeLineCap    = GetLineCap();
                graphicPath.StrokeLineJoin   = GetLineJoin();
                graphicPath.StrokeDashOffset = MatrixUtilities.TransformScale(cssStyleCascade.GetDouble("stroke-dashoffset", 0), currentTransformationMatrix) / graphicPath.StrokeThickness;
                graphicPath.StrokeDashes     = GetDashes(graphicPath.StrokeThickness);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Set the dashes of the final path
        /// </summary>
        /// <param name="path"></param>
        private void SetFinalDashes(GraphicPath path)
        {
            if (currentGraphicsState.Dashes == null)
            {
                return;
            }

            var relativeDashes = new List <double>();
            var thickness      = currentGraphicsState.LineWidth;

            foreach (var dash in currentGraphicsState.Dashes)
            {
                var relativeDash = dash / thickness;
                relativeDashes.Add(relativeDash);
            }

            path.StrokeDashes     = relativeDashes;
            path.StrokeDashOffset = currentGraphicsState.DashOffset / thickness;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Build up a path from the current geometry and the current fill and stroke
        /// </summary>
        private GraphicPath GetCurrentPathFilledAndStroked()
        {
            var path = new GraphicPath();

            path.Geometry = currentGeometry;

            path.FillBrush = currentGraphicsState.FillBrush.GetBrush(currentGeometry.Bounds, currentGraphicsState.SoftMask);

            path.StrokeThickness  = currentGraphicsState.LineWidth;
            path.StrokeBrush      = currentGraphicsState.StrokeBrush.GetBrush(currentGeometry.Bounds, currentGraphicsState.SoftMask);
            path.StrokeLineCap    = currentGraphicsState.LineCap;
            path.StrokeLineJoin   = currentGraphicsState.LineJoin;
            path.StrokeMiterLimit = currentGraphicsState.MiterLimit;

            SetFinalDashes(path);

            path.ColorPrecision = EvalWeakestColorPrecision(currentGraphicsState.FillBrush.ColorPrecision, currentGraphicsState.StrokeBrush.ColorPrecision);

            return(path);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Set the fill and stroke colors
        /// </summary>
        private static bool IsShapeVisible(GraphicPath graphicPath)
        {
            bool isFillVisible   = false;
            bool isStrokeVisible = false;

            if (graphicPath.FillBrush != null)
            {
                isFillVisible = IsBrushVisible(graphicPath.FillBrush);
            }

            if (graphicPath.StrokeBrush != null)
            {
                if (graphicPath.StrokeThickness > 0.1)
                {
                    isStrokeVisible = IsBrushVisible(graphicPath.StrokeBrush);
                }
            }

            return(isFillVisible || isStrokeVisible);
        }