Esempio n. 1
0
        public void                                Draw(PdfStyleLine lineStyle, PdfStyleFill fillStyle, PdfPoint begin, PdfSize[] sizes, bool closePath)
        {
            if (_textMode)
            {
                opEndText();
            }

            if (lineStyle != null)
            {
                SetLineStyle(lineStyle);
            }

            if (fillStyle != null)
            {
                SetFillStyle(fillStyle);
            }

            opMoveTo(begin);

            if (sizes != null)
            {
                PdfPoint Pos = begin;

                for (int i = 0; i < sizes.Length; ++i)
                {
                    Pos += sizes[i];
                    opLineTo(Pos);
                }
            }

            if (closePath)
            {
                if (lineStyle != null & fillStyle != null)
                {
                    opCloseFillStroke();
                }
                else
                if (lineStyle != null)
                {
                    opCloseStroke();
                }
                else
                if (fillStyle != null)
                {
                    opClosePath();
                    opFill();
                }
            }
            else
            {
                if (fillStyle != null)
                {
                    throw new PdfException("Can't fill a non closed path.");
                }

                opStroke();
            }
        }
Esempio n. 2
0
        public PdfStyleFill(PdfStyleFill style)
        {
            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            _fillColor = style._fillColor;
            _locked    = false;
        }
Esempio n. 3
0
        public void                                SetFillStyle(PdfStyleFill style)
        {
            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            if (style.FillColor != _curNonStrokeColor)
            {
                if (style.FillColor.ColorSpace != _curNonStrokeColorSpace)
                {
                    opSetNonStrokeColorSpace(style.FillColor.ColorSpace);
                }

                opSetNonStrokeColor(style.FillColor);
            }
        }
Esempio n. 4
0
        public void                                DrawRectangle(PdfStyleLine lineStyle, PdfStyleFill fillStyle, PdfPoint begin, PdfSize size)
        {
            if (_textMode)
            {
                opEndText();
            }

            if (lineStyle != null)
            {
                SetLineStyle(lineStyle);
            }

            if (fillStyle != null)
            {
                SetFillStyle(fillStyle);
            }

            opRectangle(begin, size);

            if (lineStyle != null & fillStyle != null)
            {
                opFillStroke();
            }
            else
            if (lineStyle != null)
            {
                opStroke();
            }
            else
            if (fillStyle != null)
            {
                opFill();
            }
        }