DynaPDF Manual - Page 67

Previous Page 66 Index Next Page 68

Path Painting and Construction

Page 67 of 787

For a path composed of two concentric circles, the areas enclosed by both circles are considered

to be inside, provided that both are drawn in the same direction. If the circles are drawn in

opposite directions, only the "doughnut" shape between them is inside, according to the rule;

the "doughnut hole" is outside (the draw direction for closed shapes can be changed with the

property Get/SetDrawDirection()).

Even-Odd Rule

An alternative to the nonzero winding number rule is the even-odd rule. This rule determines

the "insideness" of a point by drawing a ray from that point in any direction and simply

counting the number of path segments that cross the ray. If this number is odd, the point is

inside; if even, the point is outside. This yields the same results as the nonzero winding number

rule for paths with simple shapes, but produces different results for more complex shapes.

The Figure below shows the effects of applying the even-odd rule to complex paths. For the

five-pointed star, the rule considers the triangular points to be inside the path, but not the

pentagon in the center. For the two concentric circles, only the "doughnut" shape between the

two circles is considered inside, regardless of the directions in which the circles are drawn.

The rules described above are applied on vector graphics and clipping paths. DynaPDF

supports three basic functions to fill, stroke, or to mark a given path as clipping path. A clipping

path can in turn be filled, stroked, or both.

The basic path operating functions are:

• ClosePath()

• ClipPath()

• StrokePath()

ClosePath() and ClipPath() support a large set of path painting operators. Let us take a look at

the available path painting constants:

typedef enum

{

// Nonzero Winding Number Rule

fmFillNoClose,

fmStrokeNoClose,

Previous topic: Path Painting and Construction, Nonzero Winding Number Rule

Next topic: Color Spaces, Device Color Spaces