List of usage examples for com.lowagie.text.pdf PdfContentByte closePathStroke
public void closePathStroke()
From source file:br.org.archimedes.io.pdf.elements.CircleExporter.java
License:Open Source License
public void exportElement(Circle circle, Object outputObject) throws IOException { PDFWriterHelper helper = (PDFWriterHelper) outputObject; PdfContentByte cb = helper.getPdfContentByte(); Point center = helper.modelToDocument(circle.getCenter()); float centerX = (float) center.getX(); float centerY = (float) center.getY(); float radius = (float) (helper.getZoom() * circle.getRadius()); cb.circle(centerX, centerY, radius); cb.closePathStroke(); }
From source file:classroom.filmfestival_c.Movies19.java
protected static void drawMovie(PdfWriter writer, FestivalScreening screening, List<String> places, float minute, float left, float top, float row_height) throws DocumentException { FilmTitle movie = screening.getFilmTitle(); // defining the rectangle int place = places.indexOf(screening.getId().getPlace()); float llx, urx, lly, ury; llx = left + minute * getMinutesAfter930(screening); urx = llx + minute * (screening.getShortfilm() + movie.getDuration()); ury = top - place * row_height;/*from w w w . java 2 s.com*/ lly = top - ((place + 1) * row_height); // FOREGROUND PdfContentByte foreground = writer.getDirectContent(); // rectangle foreground.setColorStroke(BLACK); foreground.setLineWidth(1); foreground.moveTo(urx, lly); foreground.lineTo(llx, lly); foreground.lineTo(llx, ury); foreground.lineTo(urx, ury); foreground.closePathStroke(); // title ColumnText ct = new ColumnText(foreground); ct.setSimpleColumn(new Phrase(movie.getTitle(), SMALLEST), llx, lly, urx, ury, 14, Element.ALIGN_CENTER); ct.go(); // BACKGROUND PdfContentByte background = writer.getDirectContentUnder(); // draw background background.setColorFill(getColor(movie)); background.moveTo(urx, lly); background.lineTo(llx, lly); background.lineTo(llx, ury); background.lineTo(urx, ury); background.fill(); // draw a white P for press screenings if (screening.getPress() == 1) { background.saveState(); background.beginText(); background.setFontAndSize(FONT, 24); background.setColorFill(WHITE); background.showTextAligned(Element.ALIGN_CENTER, "P", (llx + urx) / 2f, (lly + ury) / 2f - 12, 0); background.endText(); background.restoreState(); } // draw shortfilm background.setColorStroke(WHITE); if (screening.getShortfilm() > 0) { background.moveTo(llx + (minute * screening.getShortfilm()), lly); background.lineTo(llx + (minute * screening.getShortfilm()), ury); background.stroke(); } }