Exemplo n.º 1
0
 /** @see Graphics#create() */
 public Graphics create() {
   PdfGraphics2D g2 = new PdfGraphics2D();
   g2.onlyShapes = this.onlyShapes;
   g2.transform = new AffineTransform(this.transform);
   g2.baseFonts = this.baseFonts;
   g2.fontMapper = this.fontMapper;
   g2.kids = this.kids;
   g2.paint = this.paint;
   g2.fillGState = this.fillGState;
   g2.strokeGState = this.strokeGState;
   g2.background = this.background;
   g2.mediaTracker = this.mediaTracker;
   g2.convertImagesToJPEG = this.convertImagesToJPEG;
   g2.jpegQuality = this.jpegQuality;
   g2.setFont(this.font);
   g2.cb = this.cb.getDuplicate();
   g2.cb.saveState();
   g2.width = this.width;
   g2.height = this.height;
   g2.followPath(new Area(new Rectangle2D.Float(0, 0, width, height)), CLIP);
   if (this.clip != null) g2.clip = new Area(this.clip);
   g2.stroke = stroke;
   g2.originalStroke = originalStroke;
   g2.strokeOne = (BasicStroke) g2.transformStroke(g2.strokeOne);
   g2.oldStroke = g2.strokeOne;
   g2.setStrokeDiff(g2.oldStroke, null);
   g2.cb.saveState();
   if (g2.clip != null) g2.followPath(g2.clip, CLIP);
   g2.kid = true;
   synchronized (kids) {
     kids.add(g2);
   }
   return g2;
 }
Exemplo n.º 2
0
 /** Constructor for PDFGraphics2D. */
 PdfGraphics2D(
     PdfContentByte cb,
     float width,
     float height,
     FontMapper fontMapper,
     boolean onlyShapes,
     boolean convertImagesToJPEG,
     float quality) {
   super();
   dg2.setRenderingHint(
       RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
   setRenderingHint(
       RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
   // ssteward: no com.sun.image.codec.jpeg.JPEGCodec for libgcj
   convertImagesToJPEG = false;
   /* ssteward
          try {
              Class.forName("com.sun.image.codec.jpeg.JPEGCodec");
          }
          catch (Throwable t) {
              convertImagesToJPEG = false;
          }
   */
   this.convertImagesToJPEG = convertImagesToJPEG;
   this.jpegQuality = quality;
   this.onlyShapes = onlyShapes;
   this.transform = new AffineTransform();
   this.baseFonts = new HashMap();
   if (!onlyShapes) {
     this.fontMapper = fontMapper;
     if (this.fontMapper == null) this.fontMapper = new DefaultFontMapper();
   }
   this.kids = new ArrayList();
   paint = Color.black;
   background = Color.white;
   setFont(new Font("sanserif", Font.PLAIN, 12));
   this.cb = cb;
   cb.saveState();
   this.width = width;
   this.height = height;
   clip = new Area(new Rectangle2D.Float(0, 0, width, height));
   clip(clip);
   originalStroke = stroke = oldStroke = strokeOne;
   setStrokeDiff(stroke, null);
   cb.saveState();
 }
Exemplo n.º 3
0
 /** @see Graphics#create() */
 public Graphics create() {
   PdfGraphics2D g2 = new PdfGraphics2D();
   g2.rhints.putAll(this.rhints);
   g2.onlyShapes = this.onlyShapes;
   g2.transform = new AffineTransform(this.transform);
   g2.baseFonts = this.baseFonts;
   g2.fontMapper = this.fontMapper;
   g2.paint = this.paint;
   g2.fillGState = this.fillGState;
   g2.currentFillGState = this.currentFillGState;
   g2.strokeGState = this.strokeGState;
   g2.background = this.background;
   g2.mediaTracker = this.mediaTracker;
   g2.convertImagesToJPEG = this.convertImagesToJPEG;
   g2.jpegQuality = this.jpegQuality;
   g2.setFont(this.font);
   g2.cb = this.cb.getDuplicate();
   g2.cb.saveState();
   g2.width = this.width;
   g2.height = this.height;
   g2.followPath(new Area(new Rectangle2D.Float(0, 0, width, height)), CLIP);
   if (this.clip != null) g2.clip = new Area(this.clip);
   g2.composite = composite;
   g2.stroke = stroke;
   g2.originalStroke = originalStroke;
   g2.strokeOne = (BasicStroke) g2.transformStroke(g2.strokeOne);
   g2.oldStroke = g2.strokeOne;
   g2.setStrokeDiff(g2.oldStroke, null);
   g2.cb.saveState();
   if (g2.clip != null) g2.followPath(g2.clip, CLIP);
   g2.kid = true;
   if (this.kids == null) this.kids = new ArrayList();
   this.kids.add(new Integer(cb.getInternalBuffer().size()));
   this.kids.add(g2);
   return g2;
 }
Exemplo n.º 4
0
 /** @see Graphics#clipRect(int, int, int, int) */
 public void clipRect(int x, int y, int width, int height) {
   Rectangle2D rect = new Rectangle2D.Double(x, y, width, height);
   clip(rect);
 }