Bug 694971 - Incorrect path stroking rendering for GrahicsAlphaBits greater than 1
Summary: Incorrect path stroking rendering for GrahicsAlphaBits greater than 1
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Vectors (show other bugs)
Version: 9.10
Hardware: PC All
: P4 normal
Assignee: Robin Watts
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-24 02:59 UTC by Piotr Strzelczyk
Modified: 2018-07-06 19:12 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Simple example of bad rendering (8.10 KB, application/zip)
2014-01-24 02:59 UTC, Piotr Strzelczyk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Strzelczyk 2014-01-24 02:59:32 UTC
Created attachment 10612 [details]
Simple example of bad rendering

Simple PostScript path (8-point circle) stroked with large pen is rendered properly by Ghostcript unless the GraphicAlpha bits is set, then the output looks more like outline (only small fragments of circle are filled).

Command line for attached example was:
gs -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=png256 -sOutputFile=alphabitsbug4gs.png -dGraphicsAlphaBits#4 alphabitsbug4gs.eps

The result is device independent, and basically the same on Linux and Windows.
Comment 1 Marcos H. Woehrmann 2015-11-26 22:19:17 UTC
This is a regression.  Commits before 0b3979609afc406b240c9f5480debc856b9b3920 produce correct output with and without -dGraphicsAlphaBits=4, however a couple of other commits change the output as well: 71292b79fadd65af864bd1710f32536d8c275abd and 48d948a7c4f8e65fdc7ffe12dc1765eb46677f07
Comment 2 Robin Watts 2018-07-06 19:12:03 UTC
Fixed. I believe by one of these:

commit fd63655e199fbfcda8e52c873b3a28bf27914c93
Author: Robin Watts <robin.watts@artifex.com>
Date:   Thu Jan 21 10:48:54 2016 +0000

    Enable "accurate curves" by default.

    This helps to address bug 696466 (and it's earlier related
    bug 688434).

commit e25594f98886a164f4465505595691aca8136deb
Author: Robin Watts <robin.watts@artifex.com>
Date:   Thu Jan 21 18:09:09 2016 +0000

    Bug 696466: Preliminary work on setaccuratecurves.

    If accurate curves are enabled, and the same path is filled
    and then stroked, we can get very different results when the
    flatness is high.

    This can look very odd. Ensure that we flatten paths in the
    same way for both fills and strokes when accurate curves is
    enabled.

commit 064559beaa05329b1d9e6283e6d17a8c87765e7f
Author: Robin Watts <robin.watts@artifex.com>
Date:   Wed Jan 20 20:15:42 2016 +0000

    Bug 696466: Fix incorrect line joins in strokes.

    When we flatten a path for stroking, we keep 'notes' on each
    line to tell us whether each line was present in the original
    path, or whether it was generated by the flattening process.

    We further note which lines were generated by the flattening
    process, and are NOT the first one in a given curve. We do this
    so that we can apply the 'curve join' to the start of such line
    segments.

    The "curve_join" is an optimisation to speed path drawing. When
    we've flattened a curve, it makes no sense to draw (say) a round
    join between each flattened line, because they will be almost
    parallel, and the join will be visually indistinguishable from
    a simple bevel (in most cases).

    It's still important that we draw the correct curve between any
    preceeding line and the first line in the curve though.

    Sometimes, (especially when setaccuratecurves is turned on), the
    first line in a flattened curve may be degenerate (i.e. 0 length).
    The stroker spots degenerate sections and skips them. Unfortunately
    that means it also skips the note about it being the first line
    from a curve, and the wrong join is used.

    The fix implemented here is to alter the stroker so that when
    it skips a degenerate section, it checks for the 'first line
    from an arc' flag and carries it forwards.