Closed trevorld closed 2 years ago
After some light testing it seems "alpha mask" clipping may be more robust than "clipping path" clipping for pathGrob()
. Will write gridpattern::maskGrob()
and then use that instead of gridpattern::clippingPathGrob()
to clip holed polygons (pathGrob()
).
E-mail from Prof. Murrell implies that if we wanted to keep using the "clipping path" feature than whenever {sf}
converts an sf
object to a pathGrob
that uses an "evenodd" rule (or we receive an "evenodd" rule from geom_polygon_pattern()
) then we'd need detect which rule it uses and if it is the "evenodd" rule we'd need to explicitly use the new R4.2 function as.path()
and explicitly set its rule argument to "evenodd" (if it uses the "winding" rule we don't need to use as.path()
[but could if we wanted to]). This is because the R 4.1 clipping path function considers all clipping paths to follow the "winding" rule by default (even if it is a pathGrob()
with an "evenodd" rule).
Would using an R 4.1 "alpha" mask work better than an R 4.1 "clipping path" for clipping/masking patterns with a
{sf}
generatedpathGrob()
in order to draw holed polygons such as needed bygeom_sf_pattern()
?Would this solve #68 (and be more robust when using
grDevices
devices)?Would this have any impact on #60 ?
Probably wouldn't solve #59 , the R 4.1 graphic feature references mention there is a limit to the number of clipping paths as well as a limit on number of masks in cairo graphic devices.
Any difference in speed? You'd think applying an alpha mask (both clipping and adjusting colors) would be more time consuming than just clipping...
References on R 4.1/4.2 masks as well as R 4.1 features in general:
https://www.stat.auckland.ac.nz/~paul/Reports/GraphicsEngine/masks/masks.html
https://www.stat.auckland.ac.nz/~paul/Reports/GraphicsEngine/definitions/definitions.html