You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2019/02/19 19:32:00 UTC
[jira] [Commented] (PDFBOX-4468) Incorrect tiling pattern rendering
when step smaller than bbox
[ https://issues.apache.org/jira/browse/PDFBOX-4468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16772265#comment-16772265 ]
Tilman Hausherr commented on PDFBOX-4468:
-----------------------------------------
Insert this code in TilingPaint.java just before the {{graphics.dispose()}} call:
{code:java}
float xStep = Math.abs(pattern.getXStep());
float pos = xStep;
AffineTransform savedTransform = graphics.getTransform();
while (pos < pattern.getBBox().getWidth())
{
graphics.translate(-xStep, 0);
drawer.drawTilingPattern(graphics, pattern, colorSpace, color, newPatternMatrix);
pos += xStep;
}
graphics.setTransform(savedTransform);
float yStep = Math.abs(pattern.getYStep());
pos = yStep;
while (pos < pattern.getBBox().getHeight())
{
graphics.translate(0, -yStep);
drawer.drawTilingPattern(graphics, pattern, colorSpace, color, newPatternMatrix);
pos += yStep;
}{code}
Sadly this brings a regression on PDFJS-9770-slow.pdf so I won't commit for now. Only 2 of 1082 test files show a difference in rendering. The code may have a flaw with negative steps, or with bounding boxes that have negative edges.
> Incorrect tiling pattern rendering when step smaller than bbox
> --------------------------------------------------------------
>
> Key: PDFBOX-4468
> URL: https://issues.apache.org/jira/browse/PDFBOX-4468
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.13
> Reporter: Tilman Hausherr
> Priority: Major
> Labels: Pattern
> Attachments: PDFJS-9770-slow.pdf, gs-bugzilla690487.pdf, gs-bugzilla690487.pdf-1-NEW-GOOD.png, gs-bugzilla690487.pdf-1.png, patterns-Xstep-7.pdf, patterns-Xstep10.pdf, patterns-Xstep5.pdf, patterns-Xstep7.pdf
>
>
> From a remark by Rob Wu in a PDF.js project PR, I noticed that we're not doing tiling patterns correctly when the XStep or YStep is smaller than bounding box width / height. We're doing exactly what he told not to do.
> {quote}Base pattern:
> \/
> Expected rendering of repeated pattern (recall xstep = half of width):
> \XXXX
> Actual rendering if truncating pattern width to xstep:
> \\\\\
> {quote}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org