Ejemplo n.º 1
0
        public ContentStreamProcessor(PdfRectangle cropBox, IResourceStore resourceStore, UserSpaceUnit userSpaceUnit, PageRotationDegrees rotation,
                                      IPdfTokenScanner pdfScanner,
                                      IPageContentParser pageContentParser,
                                      IFilterProvider filterProvider,
                                      ILog log,
                                      bool clipPaths)
        {
            this.resourceStore     = resourceStore;
            this.userSpaceUnit     = userSpaceUnit;
            this.rotation          = rotation;
            this.pdfScanner        = pdfScanner ?? throw new ArgumentNullException(nameof(pdfScanner));
            this.pageContentParser = pageContentParser ?? throw new ArgumentNullException(nameof(pageContentParser));
            this.filterProvider    = filterProvider ?? throw new ArgumentNullException(nameof(filterProvider));
            this.log       = log;
            this.clipPaths = clipPaths;

            // initiate CurrentClippingPath to cropBox
            var clippingSubpath = new PdfSubpath();

            clippingSubpath.Rectangle(cropBox.BottomLeft.X, cropBox.BottomLeft.Y, cropBox.Width, cropBox.Height);
            var clippingPath = new PdfPath()
            {
                clippingSubpath
            };

            clippingPath.SetClipping(FillingRule.NonZeroWinding);

            graphicsStack.Push(new CurrentGraphicsState()
            {
                CurrentClippingPath = clippingPath
            });
            ColorSpaceContext = new ColorSpaceContext(GetCurrentState, resourceStore);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a clone with no Subpaths.
        /// </summary>
        internal PdfPath CloneEmpty()
        {
            PdfPath newPath = new PdfPath();

            if (IsClipping)
            {
                newPath.SetClipping(FillingRule);
            }
            else
            {
                if (IsFilled)
                {
                    newPath.SetFilled(FillingRule);
                    newPath.FillColor = FillColor;
                }

                if (IsStroked)
                {
                    newPath.SetStroked();
                    newPath.LineCapStyle    = LineCapStyle;
                    newPath.LineDashPattern = LineDashPattern;
                    newPath.LineJoinStyle   = LineJoinStyle;
                    newPath.LineWidth       = LineWidth;
                    newPath.StrokeColor     = StrokeColor;
                }
            }
            return(newPath);
        }
Ejemplo n.º 3
0
        public void BeginSubpath()
        {
            if (CurrentPath != null && CurrentPath.Commands.Count > 0 && !paths.Contains(CurrentPath))
            {
                paths.Add(CurrentPath);
            }

            CurrentPath = new PdfPath();
        }
Ejemplo n.º 4
0
        public void BeginSubpath()
        {
            if (CurrentPath == null)
            {
                CurrentPath = new PdfPath();
            }

            AddCurrentSubpath();
            CurrentSubpath = new PdfSubpath();
        }
Ejemplo n.º 5
0
        public void BeginSubpath()
        {
            if (CurrentPath != null && CurrentPath.Commands.Count > 0 && !currentPathAdded)
            {
                paths.Add(CurrentPath);
            }

            CurrentPath      = new PdfPath();
            currentPathAdded = false;
        }
Ejemplo n.º 6
0
 public void AddPath(PdfPath path)
 {
     top?.AddPath(path);
 }
Ejemplo n.º 7
0
 public void AddPath(PdfPath path)
 {
     paths.Add(path);
 }
Ejemplo n.º 8
0
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath(CurrentTransformationMatrix);
 }
Ejemplo n.º 9
0
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath();
 }