Examples of PDFPaint


Examples of org.jpedal.color.PdfPaint

   
    protected void applyGraphicsStateToPath(GraphicsState gs){
        int fillType = gs.getFillType();

        if(fillType==GraphicsState.FILL || fillType==GraphicsState.FILLSTROKE) {
            PdfPaint col = gs.getNonstrokeColor();

//            if(isSinglePixelFill){ //special case to make sure appears in javaFx if w or h of shape is 1
                pathCommands.add("\tpath_"+shapeCount+".setStroke(Color."+ rgbToCSSColor(col.getRGB()) + ");");
//            }else{ //add new fillStyle only if color changed
//                if(col.getRGB() != currentColor) {                   
                    pathCommands.add("\tpath_"+shapeCount+".setFill(Color."+ rgbToCSSColor(col.getRGB()) + ");");
                    currentColor = col.getRGB();
//                }
//                pathCommands.add("\tpath_"+shapeCount+".setFill(Color."+ rgbToCSSColor(col.getRGB()) + ");");
            }
//        }

        if(fillType==GraphicsState.STROKE || fillType==GraphicsState.FILLSTROKE) {
            BasicStroke stroke = (BasicStroke) gs.getStroke();

            if(stroke.getLineWidth()!=1) { //attribute double lineWidth; (default 1)
                pathCommands.add("\tpath_"+shapeCount+".setStrokeWidth(" + ((double) stroke.getLineWidth()*scaling) + ");");
            }

            if(stroke.getMiterLimit()!=10) {  //attribute double miterLimit; // (default 10)
              pathCommands.add("\tpath_"+shapeCount+".setStrokeMiterLimit(" + ((double) stroke.getLineWidth()*scaling) + ");");
            }

            pathCommands.add("\tpath_"+shapeCount+".setStrokeLineCap(StrokeLineCap." + determineLineCap(stroke) + ");");
            pathCommands.add("\tpath_"+shapeCount+".setStrokeLineJoin(StrokeLineJoin." + determineLineJoin(stroke) + ");");
            PdfPaint col = gs.getStrokeColor();
            pathCommands.add("\tpath_"+shapeCount+".setStroke(Color."+ rgbToCSSColor(col.getRGB()) + ");");
        }
    }
View Full Code Here

Examples of org.jpedal.color.PdfPaint

      return;

    AffineTransform scalingTransform = new AffineTransform();
    scalingTransform.scale(scaling, scaling);

    PdfPaint col = gs.getNonstrokeColor();
    Rectangle bounds = currentShape.getBounds();
    bounds.setSize((int) (bounds.width * scaling), (int) (bounds.height * scaling));//dont like this cast
    if(col.isPattern()) {
      PaintContext context = col.createContext(null, bounds, bounds, scalingTransform, null);
      Raster raster = context.getRaster(bounds.x, bounds.y, bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1);

      BufferedImage img = new BufferedImage(bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1, BufferedImage.TYPE_4BYTE_ABGR);
      img.setData(raster);

View Full Code Here

Examples of org.jpedal.color.PdfPaint


    int fillType = gs.getFillType();

    if(fillType==GraphicsState.FILL || fillType==GraphicsState.FILLSTROKE) {
      PdfPaint col = gs.getNonstrokeColor();

      String hexColor = hexColor(col);

      //            if(isSinglePixelFill){ //special case to make sure appears in javaFx if w or h of shape is 1
      //      pathCommands.add("\tpath_"+shapeCount+".setStroke(Color."+ rgbToCSSColor(col.getRGB()) + ");");
      setStrokeColor=true;
      if(setStrokeColor)
        strokeColor = " stroke="+"\""+hexColor+"\"";

      //            }else{ //add new fillStyle only if color changed
      //                if(col.getRGB() != currentColor) {                   
      //      pathCommands.add("\tpath_"+shapeCount+".setFill(Color."+ rgbToCSSColor(col.getRGB()) + ");");
      currentColor = col.getRGB();
      setFillColor=true;
      if(setFillColor)
        fillColor = " fill="+"\""+hexColor+"\"";
      //                }
      //                pathCommands.add("\tpath_"+shapeCount+".setFill(Color."+ rgbToCSSColor(col.getRGB()) + ");");
    }
    //        }

    if(fillType==GraphicsState.STROKE || fillType==GraphicsState.FILLSTROKE) {
      BasicStroke stroke = (BasicStroke) gs.getStroke();

      if(stroke.getLineWidth()!=1) { //attribute double lineWidth; (default 1)
        //        pathCommands.add("\tpath_"+shapeCount+".setStrokeWidth(" + ((double) stroke.getLineWidth()*scaling) + ");");
        setStrokeWidth=true;
        if(setStrokeWidth)
          strokeWidth = " strokeWidth="+"\""+((double) stroke.getLineWidth()*scaling)+"\"";
      }

      if(stroke.getMiterLimit()!=10) {  //attribute double miterLimit; // (default 10)
        //        pathCommands.add("\tpath_"+shapeCount+".setStrokeMiterLimit(" + ((double) stroke.getLineWidth()*scaling) + ");");
        setStrokeMiterLimit=true;
        if(setStrokeMiterLimit)
          strokeMiterLimit = " strokeMiterLimit="+"\""+((double) stroke.getLineWidth()*scaling)+"\"";
      }

      //      pathCommands.add("\tpath_"+shapeCount+".setStrokeLineCap(StrokeLineCap." + determineLineCap(stroke) + ");");
      setStrokeLineCap=true;
      if(setStrokeLineCap)
        strokeLineCap = " strokeLineCap="+"\""+ determineLineCap(stroke) +"\"";
      //      pathCommands.add("\tpath_"+shapeCount+".setStrokeLineJoin(StrokeLineJoin." + determineLineJoin(stroke) + ");");
      setStrokeLineJoin=true;
      if(setStrokeLineJoin)
        strokeLineJoin = " strokeLineJoin="+"\""+ determineLineJoin(stroke) +"\"";

      PdfPaint col = gs.getStrokeColor();

      String hexColor = hexColor(col);     


      //      pathCommands.add("\tpath_"+shapeCount+".setStroke(Color."+ rgbToCSSColor(col.getRGB()) + ");");
View Full Code Here

Examples of org.jpedal.color.PdfPaint

    //        return;

    AffineTransform scalingTransform = new AffineTransform();
    scalingTransform.scale(scaling, scaling);

    PdfPaint col = gs.getNonstrokeColor();
    Rectangle bounds = currentShape.getBounds();
    bounds.setSize((int) (bounds.width * scaling), (int) (bounds.height * scaling));//dont like this cast
    if(col.isPattern()) {
      PaintContext context = col.createContext(null, bounds, bounds, scalingTransform, null);
      Raster raster = context.getRaster(bounds.x, bounds.y, bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1);

      BufferedImage img = new BufferedImage(bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1, BufferedImage.TYPE_4BYTE_ABGR);
      img.setData(raster);

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.