[
https://issues.apache.org/jira/browse/PDFBOX-1094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14116905#comment-14116905
]
John Hewson commented on PDFBOX-1094:
-------------------------------------
I figured it out, as you say getAnchorRect() is the 2nd parameter in the
constructor, so we're already passing a Rectangle2D.Float as the anchor
rectangle which AWT uses to do the tiling. So we're not limited to integer
tilings, which means that the issue is that we're creating the raster too
small, we just need to use Math.ceil when sizing the raster:
Replace:
{code}
Rectangle2D rect = getTransformedRect(pattern, matrix);
int width = (int)Math.ceil((float) rect.getWidth());
int height = (int)Math.ceil((float) rect.getHeight());
int rasterWidth = (int) (width * Math.abs(xform.getScaleX()));
int rasterHeight = (int) (height * Math.abs(xform.getScaleY()));
if (rasterWidth < 1)
{
rasterWidth = 1;
}
if (rasterHeight < 1)
{
rasterHeight = 1;
}
{code}
With:
{code}
Rectangle2D rect = getTransformedRect(pattern, matrix);
float width = (float)rect.getWidth();
float height = (float)rect.getHeight();
int rasterWidth = Math.max(1, (int)Math.ceil(width *
Math.abs(xform.getScaleX())));
int rasterHeight = Math.max(1, (int)Math.ceil(height *
Math.abs(xform.getScaleY())));
{code}
> Pattern colorspace support
> --------------------------
>
> Key: PDFBOX-1094
> URL: https://issues.apache.org/jira/browse/PDFBOX-1094
> Project: PDFBox
> Issue Type: Improvement
> Components: Rendering
> Affects Versions: 1.6.0
> Reporter: Andreas Lehmkühler
> Priority: Minor
> Attachments: ColoredTilingPaint.patch, PATTYP1.pdf, PATTYP2.pdf,
> PDF32000_2008_pg737.pdf, PDFBOX-1094-065514-XStep32767.pdf,
> PDFBOX-1094-094730.pdf, PDFBOX-1094-096213-p18.pdf,
> PDFBOX-1861-tracemonkey13.png, PDFStreamEngine.patch, PageDrawer.patch,
> _pdfbox-1094-tiling_pattern.pdf-1-blurry.png, gs-bugzilla693653.pdf,
> jagpdf_doc_patterns.pdf, jagpdf_doc_patterns.pdf-1.png,
> pdfbox-1094-pdf32000_2008_pg737.pdf-1.png,
> pdfbox-1094-pdf32000_2008_pg737.pdf-1.png,
> pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1094-tiling_pattern.pdf-1.png,
> pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1861-tracemonkey.pdf-13.png,
> pdfbox-1861-tracemonkey.pdf-13.png, tiling_pattern.pdf
>
>
> PDFBox doesn't support PDPattern colorspaces
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)