Пример #1
0
        public virtual void ParsePath(PathRenderInfo data)
        {
            var shapeOperation = (ShapeOperation)data.GetOperation();

            if (shapeOperation == ShapeOperation.None)
            {
                return;
            }
            bool evenOddRule = data.GetRule() == PdfCanvasConstants.FillingRule.EVEN_ODD;
            var  fillColor   = ColorManager.Instance.GetColor(data.GetFillColor(), data.GetGraphicsState().GetFillOpacity());

            if (shapeOperation != ShapeOperation.Stroke && (fillColor == null || fillColor == Color.Black))
            {
                return;
            }

            var strokeColor = ColorManager.Instance.GetColor(data.GetStrokeColor(), data.GetGraphicsState().GetStrokeOpacity());
            var lineWidth   = data.GetLineWidth();
            var lineCap     = data.GetLineCapStyle();
            var ctm         = data.GetCtm();
            var lines       = ConvertLines(data.GetPath(), ctm).ToArray();

            if (lines.Length == 0)
            {
                return;
            }


            var shapeDetails = new ShapeDetails
            {
                ShapeOperation = shapeOperation,
                StrokeColor    = strokeColor,
                FillColor      = fillColor,
                LineWidth      = lineWidth,
                EvenOddRule    = evenOddRule,
                Lines          = lines
            };

            if (Log.DebugSupported)
            {
                Log.Debug($"shape: {shapeDetails}");
            }
            shapes.Add(shapeDetails);
        }