Do the PDF scan conversion rules have an impact on anti-aliasing?

The scan conversion rules in PDF are special in the sense that none of the publically available graphics libraries implements them. On the other side almost every PDF rendering engine implements an anti-aliasing mechanism to support low and medium resolution bitmaps. The question that immediately arieses is: how do these two mechanisms relate to each other?

Let's first understand how anti-aliasing is usually implemented in a PDF rendering engine. The PDF standard defines the notion of 'shape'. The shape is a number ranging from 0 to 1 which defines the contribution of the graphic element's color to the result at each pixel location. Conceptually, it can be regarded as an additional color component. As an example if you draw a rectangle on a page then inside that rectangle the shape value is 1 and outside it is 0. At the edges it might be something in between 0 and 1 depending on the area of the pixel which is covered by the rectangle.

Secondly, the PDF standard states: "A shape shall be scan-converted by painting any pixel whose half-open square region intersects the shape, no matter how small the intersection is." This rule applies in particular when the intersection is zero.

Now let's compare both rules. According to anti-aliasing rule the shape would be 0 if the area of intersection of a graphic element and a pixel is 0. According to the scan conversion rule the shape would be 1 however.

Obviously, the scan conversion rule goes back to the PostScript area when anti-aliasing wasn't an issue. And, the rule is easy to implement if anti-aliasing isn't needed. But, since anti-aliasing is a must in many of todays application areas, the implementor of a rendering engine has to find a solution. Is it using a minimum shape value? Or, a special pre-processing of the graphic paths?

I would be glad to learn about your approach. Please, post your comment!

No comments :

Post a Comment