DynaPDF Manual - Page 60

Previous Page 59 Index Next Page 61

Path Painting and Construction

Page 60 of 750

Path Painting and Construction

A vector graphics in PDF consists of paths. A path can be used to draw something on screen or

to clip a specific area. A path itself is invisible until it was filled, stroked, or both. In addition,

clipping and path painting operators can be combined, e.g. a clipping path can again be stroked

or filled.

Notice:

Although the combination of clipping and path painting operators is supported in all PDF

versions, not all viewer applications support this operator combination. To avoid

unnecessary problems paths should be clipped and painted in two separate steps, also if the

same path must be output twice in this case.

When working with paths two specific rendering techniques should be known to understand

for what certain path painting operators are useful:

Nonzero Winding Number Rule

The nonzero winding number rule determines whether a given point is inside a path by

conceptually drawing a ray from that point to infinity in any direction and then examining the

places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1

each time a path segment crosses the ray from left to right and subtracts 1 each time a segment

crosses from right to left. After counting all the crossings, if the result is 0 then the point is

outside the path; otherwise it is inside.

Note: The method just described does not specify what to do if a path segment coincides with or is

tangent to the chosen ray. Since the direction of the ray is arbitrary, the rule simply chooses a ray that

does not encounter such problem intersections.

For simple convex paths, the nonzero winding number rule defines the inside and outside as

one would intuitively expect. The more interesting cases are those involving complex or self-

intersecting paths like the ones shown in Figure below. For a path consisting of a five-pointed

star, drawn with five connected straight line segments intersecting each other, the rule

considers the inside to be the entire area enclosed by the star, including the pentagon in the

center.

Previous topic: PDF/A

Next topic: Even-Odd Rule