[gs-devel] How to prevent interpolating artefacts when drawing transformed PDF
andreas at falkenhahn.com
Sun Feb 17 13:07:24 UTC 2013
On 17.02.2013 at 02:53 Robin Watts wrote:
>> See here for a screenshot that shows what it looks like:
> Right, except how is the background red?
The red background color serves just as an illustration for any arbitrary background
color or pattern.
>> Is there any way to get rid of these artefacts? I would like to have pixmap that I can draw
>> to any arbitrary background (e.g. red, green, yellow colored...) but I do not know the color
>> of the background at the time of calling fz_run_page(). Thus, I somehow need to prevent MuPDF
>> from interpolating pixels by blending with the current pixmap background color.
> Right, so you want to start with every pixel being blank and transparent.
>  = 0
>  = 0
>  = 0
>  = 0
> Then what you are left with is a pixmap where the edge pixels are not
> blended with anything - when you plot it, *you* must do the blending.
Yes, that's exactly what I want to do! But the problem when working with a 0-prefilled
pixmap is that mupdf does *not* draw the white page background of the PDF file. It just
draws the actual objects like text, images... but it doesn't draw the background. It simply
draws on top of the background that is in the passed pixmap. Have a look at this picture:
The upper part of the page should appear in white color. But here it appears in red because
I use a 0-prefill. If I want this area to appear in white, then I have to do a 0xff prefill
but then I face the problem that there are white artefacts at the edge pixels and I cannot
smoothly draw the page to backgrounds other than white.
Is there a way around this? The only thing that comes to my mind is to hack mupdf to
draw a white rectangle having the size of the entire page as the very first thing for
every page. But that's surely not a very nice solution :/
More information about the gs-devel