Hi, Am 24.02.2014 22:54, schrieb Tilman Hausherr:
You have been using the version of the trunk, which has a scaling problem. If you use my proposed patch it looks much better (see the images I attached). I didn't check it in because Andreas had assigned the issue to himself. I might do it after having updated my local version to the current trunk, unless there is protest.
You might assign it to yourself, as I won't work on it for the next 3 weeks ....
I noticed some scaling issues too but I hadn't have the time to dig deeper into it. There are some diffs between the results of PDFReader and PDFToImage similar to johns description
Tilman
BR Andreas Lehmkühler
Am 24.02.2014 20:45, schrieb John Hewson:Hi All There’s been lots of work recently on shading and tiling patterns and I’ve been testing out some of the new rendering capabilities. However, I think I’ve discovered a fundamental problem with using AWT’s PaintContext for drawing. I noticed that the PDF from PDFBOX-1094 looks fine when rendered at the default 72dpi however if I render it at 144dpi then the tiling patterns appear pixelated. As expected, RenderUtil creates a proportionally larger BufferedImage to render to and then calls graphics#scale(x,y) so that everything drawn to the graphics is scaled. This seems to work as expected for vectors and drawImage, we get nice crisp graphics at large scales. However, for our custom PaintContext classes we get pixellated graphics. I decided to instrument the calls to ColoredTilingContext#getRaster(x, y, w, h) at 72 and 144 dpi to see if the problem is caused by up-scaling of paint *after* it is rendered to a raster. This is indeed, the cause and I observed the following calls for the PDFBOX-1094 file: 72 DPI ---------- x y w h getRaster 302 586 76 76 getRaster 396 586 76 76 getRaster 344 662 86 86 getRaster 340 623 94 82 getRaster 302 317 76 76 getRaster 396 317 76 76 getRaster 344 393 86 87 getRaster 340 355 94 82 144 DPI ————— x y w h getRaster 302 586 76 76 getRaster 396 586 76 76 getRaster 344 662 86 86 getRaster 340 623 94 82 getRaster 302 317 76 76 getRaster 396 317 76 76 getRaster 344 393 86 87 getRaster 340 355 94 82 Perhaps there is some rendering hint or Graphics setting we’re not aware of? If not we will have to migrate away from using PaintContext and do the painting ourselves using a clipping path. :-( -- John
