You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Ankit Khanal (JIRA)" <ji...@apache.org> on 2014/11/18 19:54:33 UTC

[jira] [Created] (PDFBOX-2506) Antialiasing Hints set into Graphics2D does not seem to work after it was already used.

Ankit Khanal created PDFBOX-2506:
------------------------------------

             Summary: Antialiasing Hints set into Graphics2D does not seem to work after it was already used.
                 Key: PDFBOX-2506
                 URL: https://issues.apache.org/jira/browse/PDFBOX-2506
             Project: PDFBox
          Issue Type: Bug
            Reporter: Ankit Khanal


The following in Pagedrawer.java does not seem to work.

public void drawPage( Graphics g, PDPage p, Dimension pageDimension ) throws IOException
    {
        graphics = (Graphics2D)g;
//hints set here does not seem to work
        graphics.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
        graphics.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON );

In PDPage.java, the Graphics2D object is first manipulated before bing passed over to PageDrawer. Setting of hints into Graphics2D in PageDrawer does not seem to work.

    public BufferedImage convertToImage(int imageType, int resolution) throws IOException
    {
        Graphics2D graphics = (Graphics2D)retval.getGraphics();
//possible fix: hints set here works
        graphics.setBackground( TRANSPARENT_WHITE );
        graphics.clearRect( 0, 0, retval.getWidth(), retval.getHeight() );
        graphics.translate(translateX,translateY);
        graphics.rotate((float)Math.toRadians(rotationAngle));
        graphics.scale( scaling, scaling );
        PageDrawer drawer = new PageDrawer();
        drawer.drawPage( graphics, this, pageDimension );
        drawer.dispose();
        graphics.dispose();
        return retval;
    }




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)