List of usage examples for com.lowagie.text.pdf PdfContentByte arc
public void arc(float x1, float y1, float x2, float y2, float startAng, float extent)
From source file:br.org.archimedes.io.pdf.elements.ArcExporter.java
License:Open Source License
public void exportElement(Arc arc, Object outputObject) throws IOException { PDFWriterHelper helper = (PDFWriterHelper) outputObject; PdfContentByte cb = helper.getPdfContentByte(); Point center = arc.getCenter(); Point initial = arc.getInitialPoint(); Point ending = arc.getEndingPoint(); float start = 0; float extent = 0; try {/*from ww w. ja va2 s .co m*/ start = (float) Geometrics.calculateAngle(center, initial); extent = (float) Geometrics.calculateAngle(center, ending); } catch (NullArgumentException e) { // Should never happen e.printStackTrace(); } start *= (180 / Math.PI); extent *= (180 / Math.PI); extent -= start; if (extent < 0) { extent += 360; } center = helper.modelToDocument(center); double radius = helper.getZoom() * arc.getRadius(); float x1 = (float) (center.getX() - radius); float y1 = (float) (center.getY() - radius); float x2 = (float) (center.getX() + radius); float y2 = (float) (center.getY() + radius); cb.arc(x1, y1, x2, y2, start, extent); cb.stroke(); }