コード例 #1
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();
            }
        }
コード例 #2
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();
            }
        }
コード例 #3
0
        public void                                DrawLine(PdfStyleLine lineStyle, PdfPoint begin, PdfSize size)
        {
            if (_textMode)
            {
                opEndText();
            }

            SetLineStyle(lineStyle);
            opMoveTo(begin);
            opLineTo(begin + size);
            opStroke();
        }
コード例 #4
0
        public PdfStyleLine(PdfStyleLine style)
        {
            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            _locked     = false;
            _lineColor  = style._lineColor;
            _lineWidth  = style._lineWidth;
            _capStyle   = style._capStyle;
            _joinStyle  = style._joinStyle;
            _miterLimit = style._miterLimit;
            _dashArray  = style._dashArray;
            _dashPhase  = style._dashPhase;
        }
コード例 #5
0
        public void                                SetLineStyle(PdfStyleLine style)
        {
            if (style is null)
            {
                throw new ArgumentNullException(nameof(style));
            }

            if (style.LineColor != _curStrokeColor)
            {
                if (style.LineColor.ColorSpace != _curStrokeColorSpace)
                {
                    opSetStrokeColorSpace(style.LineColor.ColorSpace);
                }

                opSetStrokeColor(style.LineColor);
            }

            if (style.LineWidth != _curLineWidth)
            {
                opSetLineWidth(style.LineWidth);
            }

            if (style.CapStyle != _curLineCap)
            {
                opSetLineCap(style.CapStyle);
            }

            if (style.JoinStyle != _curLineJoin)
            {
                opSetLineJoin(style.JoinStyle);
            }

            if (style.MiterLimit != _curMiterLimit)
            {
                opSetMiterLimit(style.MiterLimit);
            }

            if (style.DashArray != _curDashArray || style.DashPhase != _curDashPhase)
            {
                opSetDash(style.DashArray, style.DashPhase);
            }
        }