Exemple #1
0
        /**
         * add a rectangle to the current stream
         *
         * @param x the x position of left edge in millipoints
         * @param y the y position of top edge in millipoints
         * @param w the width in millipoints
         * @param h the height in millipoints
         * @param stroke the stroke color/gradient
         */

        private void AddRect(int x, int y, int w, int h, PdfColor stroke)
        {
            CloseText();
            currentStream.Write("ET\nq\n" + stroke.getColorSpaceOut(false)
                                + PdfNumber.doubleOut(x / 1000f) + " " + PdfNumber.doubleOut(y / 1000f) + " "
                                + PdfNumber.doubleOut(w / 1000f) + " " + PdfNumber.doubleOut(h / 1000f) + " re s\n"
                                + "Q\nBT\n");
        }
Exemple #2
0
        /**
         * add a filled rectangle to the current stream
         *
         * @param x the x position of left edge in millipoints
         * @param y the y position of top edge in millipoints
         * @param w the width in millipoints
         * @param h the height in millipoints
         * @param fill the fill color/gradient
         */

        private void AddFilledRect(int x, int y, int w, int h,
                                   PdfColor fill)
        {
            CloseText();
            currentStream.Write("ET\nq\n" + fill.getColorSpaceOut(true)
                                + PdfNumber.doubleOut(x / 1000f) + " " + PdfNumber.doubleOut(y / 1000f) + " "
                                + PdfNumber.doubleOut(w / 1000f) + " " + PdfNumber.doubleOut(h / 1000f) + " re f\n"
                                + "Q\nBT\n");
        }
Exemple #3
0
        /**
         * add a line to the current stream
         *
         * @param x1 the start x location in millipoints
         * @param y1 the start y location in millipoints
         * @param x2 the end x location in millipoints
         * @param y2 the end y location in millipoints
         * @param th the thickness in millipoints
         * @param rs the rule style
         * @param r the red component
         * @param g the green component
         * @param b the blue component
         */

        private void AddLine(int x1, int y1, int x2, int y2, int th, int rs,
                             PdfColor stroke)
        {
            CloseText();
            currentStream.Write("ET\nq\n" + stroke.getColorSpaceOut(false)
                                + SetRuleStylePattern(rs) + PdfNumber.doubleOut(x1 / 1000f) + " "
                                + PdfNumber.doubleOut(y1 / 1000f) + " m " + PdfNumber.doubleOut(x2 / 1000f) + " "
                                + PdfNumber.doubleOut(y2 / 1000f) + " l " + PdfNumber.doubleOut(th / 1000f) + " w S\n"
                                + "Q\nBT\n");
        }