[ 
https://issues.apache.org/jira/browse/PDFBOX-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-2506:
--------------------------------
    Description: 
The following in Pagedrawer.java does not seem to work.

{code}
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;
    }
{code}

  was:
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;
    }



> 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.
> {code}
> 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;
>     }
> {code}



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

Reply via email to