Implementing zero winding

In the last chapter Zero winding vs. even odd rule we have shown that the scanFill algorithm can be easily adapted to deal both with zero winding and even odd fill rules. So we first use the new scanfill function with a zerowind parameter.

Javascript Editor

And we rewrite the rawDevice, implementing the zerowind as true for fill and as false for the eofill method. We profit to rewrite stroke. If it uses zerowind, the transfer layer we have introduced is not necessary any more.

Javascript Editor

We will have to extend all devices with eofill.

Javascript Editor

And we add an eofill operator. We fix also the closepath operator. A last line segment is now of type "Z" instead of "L" so that the devices can properly close the stroke path.

Javascript Editor

Test fill

Javascript Editor

Test eofill

Javascript Editor

Test stroke

Javascript Editor

ps20241117.js 3525 lines 130 KB

My Journey to PostScript