Examples of PDFColor


Examples of org.apache.fop.pdf.PDFColor

                Color c1 = cols[count];
                if (c1.getAlpha() != 255) {
                    return false// PDF can't do alpha
                }

                PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
                                               c1.getBlue());
                someColors.add(color1);
                if (count > 0 && count < cols.length - 1) {
                    theBounds.add(new Double(fractions[count]));
                }
            }

            PDFDeviceColorSpace aColorSpace;
            aColorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
            PDFPattern myPat = pdfDoc.getFactory().makeGradient(
                    resourceContext, false, aColorSpace,
                    someColors, theBounds, theCoords, theMatrix);
            currentStream.write(myPat.getColorSpaceOut(fill));

            return true;
        }
        if (paint instanceof RadialGradientPaint) {
            RadialGradientPaint rgp = (RadialGradientPaint)paint;

            // There is essentially no way to support repeate
            // in PDF for radial gradients (the one option would
            // be to 'grow' the outer circle until it fully covered
            // the bounds and then grow the stops accordingly, the
            // problem is that this may require an extremely large
            // number of stops for cases where the focus is near
            // the edge of the outer circle).  so we rasterize.
            MultipleGradientPaint.CycleMethodEnum cycle = rgp.getCycleMethod();
            if (cycle != MultipleGradientPaint.NO_CYCLE) {
                return false;
            }

            AffineTransform transform;
            transform = new AffineTransform(getBaseTransform());
            transform.concatenate(getTransform());
            transform.concatenate(rgp.getTransform());

            List theMatrix = new java.util.ArrayList();
            double [] mat = new double[6];
            transform.getMatrix(mat);
            for (int idx = 0; idx < mat.length; idx++) {
                theMatrix.add(new Double(mat[idx]));
            }

            double ar = rgp.getRadius();
            Point2D ac = rgp.getCenterPoint();
            Point2D af = rgp.getFocusPoint();

            List theCoords = new java.util.ArrayList();
            double dx = af.getX() - ac.getX();
            double dy = af.getY() - ac.getY();
            double d = Math.sqrt(dx * dx + dy * dy);
            if (d > ar) {
                // the center point af must be within the circle with
                // radius ar centered at ac so limit it to that.
                double scale = (ar * .9999) / d;
                dx = dx * scale;
                dy = dy * scale;
            }

            theCoords.add(new Double(ac.getX() + dx)); // Fx
            theCoords.add(new Double(ac.getY() + dy)); // Fy
            theCoords.add(new Double(0));
            theCoords.add(new Double(ac.getX()));
            theCoords.add(new Double(ac.getY()));
            theCoords.add(new Double(ar));

            Color[] cols = rgp.getColors();
            List someColors = new java.util.ArrayList();
            for (int count = 0; count < cols.length; count++) {
                Color cc = cols[count];
                if (cc.getAlpha() != 255) {
                    return false// PDF can't do alpha
                }

                someColors.add(new PDFColor(cc.getRed(), cc.getGreen(),
                                            cc.getBlue()));
            }

            float[] fractions = rgp.getFractions();
            List theBounds = new java.util.ArrayList();
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

                }
            }
            BitmapImage fopimg;
            fopimg = new BitmapImage("TempImage:" + pctx.toString(),
                                     devW, devH, rgb, maskRef);
            fopimg.setTransparent(new PDFColor(255, 255, 255));
            imageInfo = pdfDoc.addImage(resourceContext, fopimg);
            if (outputStream != null) {
                try {
                    this.pdfDoc.output(outputStream);
                } catch (IOException ioe) {
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);
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);
    char  fillchar = ' ';
    if ( fillshade >= 75 )
      fillchar = '#';
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);

 
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

            for (int i = 0;
                i < ((IndexColorModel) cm).getMapSize();
                i++) {
              if ((alphas[i] & 0xFF) == 0) {
                this.m_isTransparent = true;
                this.m_transparentColor = new PDFColor(
                                            (int)(reds[i] & 0xFF),
                                            (int)(greens[i] & 0xFF),
                                            (int)(blues[i] & 0xFF));
                break;
              }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

            for (int i = 0;
                i < ((IndexColorModel) cm).getMapSize();
                i++) {
              if ((alphas[i] & 0xFF) == 0) {
                this.m_isTransparent = true;
                this.m_transparentColor = new PDFColor(
                                            (int)(reds[i] & 0xFF),
                                            (int)(greens[i] & 0xFF),
                                            (int)(blues[i] & 0xFF));
                break;
              }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

            for (int i = 0;
                i < ((IndexColorModel) cm).getMapSize();
                i++) {
              if ((alphas[i] & 0xFF) == 0) {
                this.m_isTransparent = true;
                this.m_transparentColor = new PDFColor(
                                            (int)(reds[i] & 0xFF),
                                            (int)(greens[i] & 0xFF),
                                            (int)(blues[i] & 0xFF));
                break;
              }
View Full Code Here

Examples of org.apache.fop.pdf.PDFColor

    if ((w == 0) || (h == 0))
        return;
    if ( h < 0 )
      h *= -1;

    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" + (int)(100 - ((0.3f * red + 0.59f * green + 0.11f * blue) * 100f)) + "G\033*v2T");

 
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.