Bug 43357 - PDFGraphics2D addImage method: image in PDF look as very low resolution image
Summary: PDFGraphics2D addImage method: image in PDF look as very low resolution image
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: all
Hardware: All All
: P3 minor
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-11 17:47 UTC by Fabio Sassi
Modified: 2007-09-18 15:37 UTC (History)
0 users



Attachments
patch file (947 bytes, patch)
2007-09-11 17:49 UTC, Fabio Sassi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Sassi 2007-09-11 17:47:40 UTC
[PATCH]

In PDFGraphics2D image are rescaled 2 times in the same way.
First is rescaled by java.awt.Graphics2D and put in BufferedImage 
that will used to write PDF code. Second is rescaled by trasformation 
matrix in PDF code.

This will cause a resulting image that have very low resolution (pixelized). 

Before look at PDFGraphics2D code I try also to change DPI but this has 
not effect. 

Patch File:

Index: PDFGraphics2D.java
===================================================================
--- PDFGraphics2D.java  (revision 574734)
+++ PDFGraphics2D.java  (working copy)
@@ -522,14 +522,15 @@
         if (imageInfo == null) {
             // OK, have to build and add a PDF image
 
-            Dimension size = new Dimension(width, height);
+            Dimension size = new Dimension(img.getWidth(observer), 
+                                       img.getHeight(observer));
             BufferedImage buf = buildBufferedImage(size);
 
             java.awt.Graphics2D g = buf.createGraphics();
             g.setComposite(AlphaComposite.SrcOver);
             g.setBackground(new Color(1, 1, 1, 0));
             g.setPaint(new Color(1, 1, 1, 0));
-            g.fillRect(0, 0, width, height);
+            g.fillRect(0, 0, size.width, size.height);
             g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight()));
             g.setComposite(gc.getComposite());
Comment 1 Fabio Sassi 2007-09-11 17:49:46 UTC
Created attachment 20792 [details]
patch file