private void internalDispose(ByteBuffer buf) { int last = 0; int pos = 0; ByteBuffer buf2 = cb.getInternalBuffer(); if (kids != null) { for (int k = 0; k < kids.size(); k += 2) { pos = ((Integer) kids.get(k)).intValue(); PdfGraphics2D g2 = (PdfGraphics2D) kids.get(k + 1); g2.cb.restoreState(); g2.cb.restoreState(); buf.append(buf2.getBuffer(), last, pos - last); g2.dg2.dispose(); g2.dg2 = null; g2.internalDispose(buf); last = pos; } } buf.append(buf2.getBuffer(), last, buf2.size() - last); }
/** @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; }
/** @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; }