fill_rule
Mojo module 🡭
fill_rule
Fill rules: how fill_polygon/fill_path and their gradient variants decide which regions of a self-intersecting or multi-sub-path shape count as inside.
EVEN_ODD, the default when the parameter is not passed, counts the edge crossings to a point’s left and calls the point inside when that count is odd. Where two loops of the same shape overlap, the count is even, so the overlap reads as outside and shows up as a hole.
NONZERO tracks a signed count instead: an edge contributes +1 or -1 depending on whether it crosses the scanline downward or upward, and a point is inside whenever the total is nonzero. Same-direction loops fill as their union, and each pixel of the overlap takes one set_pixel call rather than two, so a translucent fill does not double-blend there.