Bug 692081 - PostScript pattern anomalies
Summary: PostScript pattern anomalies
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Graphics Library (show other bugs)
Version: master
Hardware: PC Windows Vista
: P4 normal
Assignee: Robin Watts
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-17 12:14 UTC by Øystein Halvorsen
Modified: 2011-04-26 19:17 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Two different patterns on a read backgound (2.03 KB, application/postscript)
2011-03-17 12:14 UTC, Øystein Halvorsen
Details
Two different patterns on a read backgound (3.62 KB, application/pdf)
2011-03-17 12:16 UTC, Øystein Halvorsen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Øystein Halvorsen 2011-03-17 12:14:29 UTC
Created attachment 7382 [details]
Two different patterns on a read backgound

i) setdash in a pattern definition leaves a white line (should be transparent)
ii) thin white lines outlining pattern elements (reported before)

Open the attached pdf file in Adobe of Foxit Reader.  None of the above is shown. Open the same in GSview. White artifacts are shown around the black dots on the red background.

The PostScript file used to create the pdf (with ps2pdf) is also attached. It contains two patterns defining 45 degrees black dot screens.
Comment 1 Øystein Halvorsen 2011-03-17 12:16:13 UTC
Created attachment 7383 [details]
Two different patterns on a read backgound
Comment 2 Øystein Halvorsen 2011-03-17 12:59:38 UTC
The problem is not shown when using gswin32 directly. Sorry also for the mistyping; the title should be ...on a red background.
Comment 3 Ken Sharp 2011-03-17 13:13:41 UTC
Using the current HEAD revision of Ghostscript I can't see any problems rendering the PDF file at 96 dpi, 300 dpi or 600 dpi.

Without a Ghostscript command line to reproduce the problem, there's not really much else I can say. I do see the problem when using GSView, so I'm re-assigning to Ghostgum as a GSView problem. It may well be a GS bug, but we need the GS invocation to reproduce the problem.
Comment 4 Chris Liddell (chrisl) 2011-03-17 13:30:00 UTC
I *think* GSView always uses GrahicsAlphaBits and TextAlphaBits, so these could be anti-aliasing artifacts.
Comment 5 Ken Sharp 2011-03-17 13:42:08 UTC
(In reply to comment #4)
> I *think* GSView always uses GrahicsAlphaBits and TextAlphaBits, so these could
> be anti-aliasing artifacts.

You are correct, setting -dGraphicsAlphaBits=4 reproduces the problem at any resolution.

Now, I wonder who gets that ?....
Comment 6 Robin Watts 2011-04-11 23:34:33 UTC
Pattern tiles (apparently) have an image tile and a mask plane. To correctly do antialiasing (and transparency), they should really carry an image plane and an alpha plane.

This is a non-trivial engineering task, so will need to scheduled after more urgent work.
Comment 7 Robin Watts 2011-04-26 19:17:45 UTC
Fixed in http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=262c866a71d08c1709484d95ffb3639f53156078

The antialiasing code reduces its buffers and then calls 'copy_alpha' to copy them onto the background with appropriate blending. Unfortunately, the existing implementation deals with alphas of zero by simply sending the existing background colour unchanged.

While this is fine in many cases, it has the effect of making any device that watches what pixels are written think that that pixel is 'solid' rather than 'completely empty'. The pattern tile device is one such example; it keeps a mask bitmap of which pixels are written to, and hence gives bad results when pixels are copy_alpha's with 0 alpha values.

I have fixed this in the above commit by detecting a 0 alpha value, and 'skipping' it.

This is clearly an improvement, but it's not ideal as it leaves 'halos' around objects. The only way to fix this would be a much more invasive rewrite of the antialiasing code (possibly requiring a 'copy_color_with_alpha' device routine).

For now, this will do.