示例#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);
        }
示例#2
0
文件: PdfPath.cs 项目: xtuzy/PdfPig
        /// <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);
        }
示例#3
0
        public void BeginSubpath()
        {
            if (CurrentPath != null && CurrentPath.Commands.Count > 0 && !paths.Contains(CurrentPath))
            {
                paths.Add(CurrentPath);
            }

            CurrentPath = new PdfPath();
        }
示例#4
0
        public void BeginSubpath()
        {
            if (CurrentPath == null)
            {
                CurrentPath = new PdfPath();
            }

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

            CurrentPath      = new PdfPath();
            currentPathAdded = false;
        }
示例#6
0
 public void AddPath(PdfPath path)
 {
     top?.AddPath(path);
 }
示例#7
0
 public void AddPath(PdfPath path)
 {
     paths.Add(path);
 }
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath(CurrentTransformationMatrix);
 }
示例#9
0
 public void BeginSubpath()
 {
     CurrentPath = new PdfPath();
 }