We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Generated images:
Reproduction code:
public class javaAndFreeHepPDFGraphicsTest {
public static String javaGraphicsFilePath = "C:\\java_graphics_test.png"; public static String pdfGraphicsFilePath = "C:\\java_graphics_test.pdf"; public static void main(String[] args) throws FileNotFoundException { testJavaGraphics(); testPdfGraphics(); } public static void testPdfGraphics() throws FileNotFoundException { Properties p = new Properties(); p.setProperty("PageSize", "A4"); VectorGraphics g = new PDFGraphics2D(new File(pdfGraphicsFilePath), new Dimension(200, 200)); g.setProperties(p); g.startExport(); paintToGraphics(g); g.dispose(); g.endExport(); } public static void testJavaGraphics() { BufferedImage bi = new BufferedImage(200, 200, BufferedImage.TYPE_INT_ARGB); Graphics2D g = bi.createGraphics(); paintToGraphics(g); g.dispose(); File outputfile = new File(javaGraphicsFilePath); try { ImageIO.write(bi, "png", outputfile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } static void paintToGraphics(Graphics2D g) { g.setClip(0, 0, 200, 200); g.setColor(Color.BLUE); g.fillRect(0, 0, 200, 200); g.translate(50, 50); Graphics2D g2 = (Graphics2D) g.create(50, 50, 100, 100); g2.setClip(0, 0, 100, 100); Shape clip = g2.getClip(); Shape oval = new Ellipse2D.Double(0, 0, 100, 100); Area areaOval = new Area(oval); Area clipArea = new Area(clip); clipArea.subtract(areaOval); g2.setClip(clipArea); g2.setColor(Color.RED); g2.fillRect(0, 0, 100, 100); g2.dispose(); }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Generated images:
Reproduction code:
public class javaAndFreeHepPDFGraphicsTest {
}
The text was updated successfully, but these errors were encountered: