Exemple #1
0
 public void DrawRectangle(double x, double y, double width, double height,
                           PDFColor stroke, PDFColor fill, double lineWidth)
 {
     WriteColor(fill, false);
     WriteColor(stroke, true);
     WriteLineWidth(stroke, lineWidth);
     AppendToContentStream(
         $"{ PDFReal.RealToString(x) } { PDFReal.RealToString(-y) } { PDFReal.RealToString(width) } { PDFReal.RealToString(-height) } re\r\n");
     WritePaintOp(stroke, fill);
 }
Exemple #2
0
 private void WritePaintOp(PDFColor stroke, PDFColor fill)
 {
     if (stroke != null && fill != null)
     {
         AppendToContentStream("B\r\n");
     }
     else if (stroke != null)
     {
         AppendToContentStream("S\r\n");
     }
     else if (fill != null)
     {
         AppendToContentStream("f\r\n");
     }
 }
Exemple #3
0
        public void DrawLine(double x0, double y0, double x1, double y1,
                             PDFColor stroke, double lineWidth)
        {
            if (stroke == null)
            {
                return;
            }

            WriteColor(stroke, true);
            WriteLineWidth(stroke, lineWidth);
            AppendToContentStream(
                $"{ PDFReal.RealToString(x0) } { PDFReal.RealToString(-y0) } m\r\n" +
                $"{ PDFReal.RealToString(x1) } { PDFReal.RealToString(-y1) } l\r\n");
            AppendToContentStream("S\r\n");
        }
Exemple #4
0
        public void DrawCurve(double x0, double y0, double x1, double y1, double x2, double y2,
                              double x3, double y3, PDFColor stroke, double lineWidth)
        {
            // TODO Fill is not yet supported for curve

            if (stroke == null)
            {
                return;
            }

            WriteColor(stroke, true);
            WriteLineWidth(stroke, lineWidth);
            AppendToContentStream(
                $"{ PDFReal.RealToString(x0) } { PDFReal.RealToString(-y0) } m\r\n" +
                $"{ PDFReal.RealToString(x1) } { PDFReal.RealToString(-y1) } " +
                $"{ PDFReal.RealToString(x2) } { PDFReal.RealToString(-y2) } " +
                $"{ PDFReal.RealToString(x3) } { PDFReal.RealToString(-y3) } c\r\n");
            AppendToContentStream("S\r\n");
        }