Examples of PDFColor


Examples of org.apache.fop.pdf.PDFColor

        // a line with thickness 0 is still displayed
        if (th != 0) {
            switch (st) {
            case org.apache.fop.fo.properties.RuleStyle.DOUBLE:
                addLine(rx, ry, rx + w, ry, th / 3, st,
                        new PDFColor(area.getRed(), area.getGreen(),
                                     area.getBlue()));
                addLine(rx, ry + (2 * th / 3), rx + w, ry + (2 * th / 3),
                        th / 3, st,
                        new PDFColor(area.getRed(), area.getGreen(),
                                     area.getBlue()));
                break;
            case org.apache.fop.fo.properties.RuleStyle.GROOVE:
                addLine(rx, ry, rx + w, ry, th / 2, st,
                        new PDFColor(area.getRed(), area.getGreen(),
                                     area.getBlue()));
                addLine(rx, ry + (th / 2), rx + w, ry + (th / 2), th / 2, st,
                        new PDFColor(255, 255, 255));
                break;
            case org.apache.fop.fo.properties.RuleStyle.RIDGE:
                addLine(rx, ry, rx + w, ry, th / 2, st,
                        new PDFColor(255, 255, 255));
                addLine(rx, ry + (th / 2), rx + w, ry + (th / 2), th / 2, st,
                        new PDFColor(area.getRed(), area.getGreen(),
                                     area.getBlue()));
                break;
            default:
                addLine(rx, ry, rx + w, ry, th, st,
                        new PDFColor(area.getRed(), area.getGreen(),
                                     area.getBlue()));
            }
            this.currentXPosition += area.getContentWidth();
            this.currentYPosition += th;
        }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

     * @param rs the rule style
     * @param stroke the line color
     */
    protected void addLine(int x1, int y1, int x2, int y2, int th, int rs,
                           PDFPathPaint stroke) {
        PDFColor lstroke = null;
        if (rs == org.apache.fop.fo.properties.RuleStyle.DOTTED)
            lstroke = new PDFColor(0.7f, 0.7f, 0.7f);
        else
            lstroke = (PDFColor)stroke;
        if (x1 == x2) {
            addRect(x1, y1, th, y2 - y1 + 1, lstroke, lstroke);
        } else if (y1 == y2) {
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

            h *= -1;

        int row = (int)((pageHeight - (y / 100)) * 100 * yFactor);
        int col = (int)(x * xFactor);

        PDFColor sc = (PDFColor)stroke;
        PDFColor fc = (PDFColor)fill;

        sc.setColorSpace(ColorSpace.DEVICE_RGB);
        fc.setColorSpace(ColorSpace.DEVICE_RGB);

        int lineshade =
            (int)(100
                  - ((0.3f * sc.red() + 0.59f * sc.green() + 0.11f * sc.blue())
                     * 100f));
        int fillshade =
            (int)(100
                  - ((0.3f * fc.red() + 0.59f * fc.green() + 0.11f * fc.blue())
                     * 100f));
        if (debug)
            System.out.println("TXTRenderer.addRect(" + x + ", " + y + ", "
                               + w + ", " + h + ", " + stroke + ", " + fill
                               + ") fillshade=" + fillshade);
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

    boolean printBMP(FopImage img, int x, int y, int w,
                     int h) throws FopImageException {
        if (debug)
            System.out.println("TXTRenderer.printBMP(" + img + ", " + x
                               + ", " + y + ", " + w + ", " + h + ")");
        addRect(x, y, w, h, new PDFColor(1f, 1f, 1f),
                new PDFColor(0f, 0f, 0f));
        int nameh = (int)(h * yFactor / 2);
        if (nameh > 0) {
            int namew = (int)(w * xFactor);

            if (namew > 4) {
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

            h *= -1;
        else
            y += h;


        PDFColor sc = (PDFColor)stroke;
        PDFColor fc = (PDFColor)fill;

        sc.setColorSpace(ColorSpace.DEVICE_RGB);
        fc.setColorSpace(ColorSpace.DEVICE_RGB);

        int lineshade =
            (int)(100
                  - ((0.3f * sc.red() + 0.59f * sc.green() + 0.11f * sc.blue())
                     * 100f));
        int fillshade =
            (int)(100
                  - ((0.3f * fc.red() + 0.59f * fc.green() + 0.11f * fc.blue())
                     * 100f));

        int xpos = xoffset + (x / 100);
        if (xpos < 0) {
            xpos = 0;
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

        int size = area.getFontState().getFontSize();

        float red = area.getRed();
        float green = area.getGreen();
        float blue = area.getBlue();
        PDFColor theAreaColor = new PDFColor((double)area.getRed(),
                                             (double)area.getGreen(),
                                             (double)area.getBlue());

        // currentStream.add("\033*c" + (int)(100 - ((0.3f * red + 0.59f * green + 0.11f * blue) * 100f)) + "G\033*v2T");
        currentStream.add("\033*v1O\033*c"
 
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

     * Rather than leaving it as the default white.
     * @param col the background colour to fill
     */
    public void setBackgroundColor(Color col) {
        Color c = col;
        PDFColor currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
        currentStream.write("q\n");
        currentStream.write(currentColour.getColorSpaceOut(true));

        currentStream.write("0 0 " + width + " " + height + " re\n");

        currentStream.write("f\n");
        currentStream.write("Q\n");
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

        ColorModel cm = getEffectiveColorModel();
        if (cm instanceof IndexColorModel) {
            IndexColorModel icm = (IndexColorModel)cm;
            if (cm.getTransparency() == IndexColorModel.TRANSLUCENT) {
                int transPixel = icm.getTransparentPixel();
                return new PDFColor(
                        icm.getRed(transPixel),
                        icm.getGreen(transPixel),
                        icm.getBlue(transPixel));
            }
        }
        return new PDFColor(getImage().getTransparentColor());
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

     * @param fill true to set the fill color, false for the foreground color
     * @param pdf StringBuffer to write the PDF code to, if null, the code is
     *     written to the current stream.
     */
    protected void setColor(Color col, boolean fill, StringBuffer pdf) {
        PDFColor color = new PDFColor(this.pdfDoc, col);

        closeText();
       
        if (pdf != null) {
            pdf.append(color.getColorSpaceOut(fill));
        } else {
            currentStream.add(color.getColorSpaceOut(fill));
        }
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

    protected void applyColor(Color col, boolean fill) {
        preparePainting();

        Color c = col;
        if (col instanceof ColorExt) {
            PDFColor currentColour = new PDFColor(this.pdfDoc, col);
            currentStream.write(currentColour.getColorSpaceOut(fill));
        } else if (c.getColorSpace().getType()
                == ColorSpace.TYPE_RGB) {
            PDFColor currentColour = new PDFColor(c.getRed(), c.getGreen(),
                                         c.getBlue());
            currentStream.write(currentColour.getColorSpaceOut(fill));
        } else if (c.getColorSpace().getType()
                   == ColorSpace.TYPE_CMYK) {
            if (pdfDoc.getProfile().getPDFAMode().isPDFA1LevelB()) {
                //See PDF/A-1, ISO 19005:1:2005(E), 6.2.3.3
                //FOP is currently restricted to DeviceRGB if PDF/A-1 is active.
                throw new PDFConformanceException(
                        "PDF/A-1 does not allow mixing DeviceRGB and DeviceCMYK.");
            }
            float[] cComps = c.getColorComponents(new float[3]);
            double[] cmyk = new double[3];
            for (int i = 0; i < 3; i++) {
                // convert the float elements to doubles for pdf
                cmyk[i] = cComps[i];
            }
            PDFColor currentColour = new PDFColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
            currentStream.write(currentColour.getColorSpaceOut(fill));
        } else if (c.getColorSpace().getType()
                   == ColorSpace.TYPE_2CLR) {
            // used for black/magenta
            float[] cComps = c.getColorComponents(new float[1]);
            double[] blackMagenta = new double[1];
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.