popContext
) is popped. Alternatively it can also be
applied to grobs.
mask(grob, x = unit(0.5, "npc"), y = unit(0.5, "npc"), width = unit(1, "npc"), height = unit(1, "npc"), default.units = "npc", just = "centre", hjust = NULL, vjust = NULL)
registerMask(label, mask = NULL, ...)
x
, y
,
width
, or height
are only given as numeric vectors.
"left"
, "right"
,
"centre"
, "center"
, "bottom"
, and "top"
.
For numeric values, 0 means left alignment and 1 means right
alignment.
just
setting.
just
setting.
mask
object that defines the mask.
mask
.
mask
, a mask
object.
When referring to an opacity mask, the masked content will be opaque at the same coordinates that the mask is opaque. The same applies when there is any level of transparency, as any transparency in the mask will also apply in the same corresponding region of the masked object.
The mask's opacity is defined as being the level of luminance present
in the mask. This means anything black is fully transparent, while
anything white is completely opaque. The background is assumed to be
black (i.e. fully transparent). The alpha
value in a mask will
still be used, but its effect is combined with the computed opacity
from the luminance of the mask.
By using an opacity mask it is possible to have a grob with
non-uniform opacity. In other words, rather than specifying an opacity
via gpar
's alpha
parameter, which is uniform
across the grob, we can define varying opacities on a grob via an
opacity mask.
The x
, y
, width
, height
parameters
determine the location and dimensions of the area to apply the mask
to. This means we can apply a mask to any rectangular region, relative
to the viewport in which it is defined (via registerMask
).
grid.mask
, pushMask
,
popContext
.