% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nr-mask.R
\name{nr_mask_begin}
\alias{nr_mask_begin}
\alias{nr_mask_end}
\title{Start/end region of masked drawing}
\usage{
nr_mask_begin(nr, mask)

nr_mask_end(nr)
}
\arguments{
\item{nr}{native raster image}

\item{mask}{native raster image to use as mask. Must be the same size as
\code{nr}.}
}
\value{
Invisibly return the original native raster image which has been 
        modified in-place
}
\description{
These functions are used to globally set a mask which determines where
pixels are affected by drawing functions.
}
\details{
Drawing operations between
\code{nr_mask_begin()} and \code{nr_mask_end()} calls will only affect pixels
where the \code{mask} is not transparent.
}
\examples{
\dontshow{if (interactive()) withAutoprint(\{ # examplesIf}
mask <- deer[[1]] |> nr_resize(600, 400)
plot(mask)
nr <- nr_new_from(mask)

nr_mask_begin(nr, mask = mask)
nr_circle(nr, 300, 200, 200, fill = 'blue', color = 'black')
nr_circle(nr, 350, 200, 100, fill = 'darkgreen', color = 'black')
nr_mask_end(nr)

plot(nr)
\dontshow{\}) # examplesIf}
}
