% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pattern-both-hatch.R
\name{grid.pattern_hatch}
\alias{grid.pattern_hatch}
\alias{names_hatch}
\title{Heraldic color hatching patterned grobs}
\usage{
grid.pattern_hatch(
  x = c(0, 0, 1, 1),
  y = c(1, 0, 0, 1),
  id = 1L,
  ...,
  type = "gules",
  subtype = "combinatorial",
  colour = gp$col \%||\% "grey20",
  spacing = 0.05,
  xoffset = 0,
  yoffset = 0,
  units = "snpc",
  alpha = gp$alpha \%||\% NA_real_,
  lineend = gp$lineend \%||\% "round",
  linewidth = size \%||\% gp$lwd \%||\% 1,
  size = NULL,
  use_R4.1_masks = getOption("ggpattern_use_R4.1_masks",
    getOption("ggpattern_use_R4.1_features")),
  png_device = NULL,
  res = getOption("ggpattern_res", 72),
  default.units = "npc",
  name = NULL,
  gp = gpar(),
  draw = TRUE,
  vp = NULL
)

names_hatch(
  subtype = c("combinatorial", "fox-davies", "goodman", "unicode"),
  accent = FALSE
)
}
\arguments{
\item{x}{A numeric vector or unit object specifying x-locations of the pattern boundary.}

\item{y}{A numeric vector or unit object specifying y-locations of the pattern boundary.}

\item{id}{A numeric vector used to separate locations in x, y into multiple boundaries.
All locations within the same \code{id} belong to the same boundary.}

\item{...}{Currently ignored.}

\item{type}{A tincture or color name.  \code{names_hatch()} lists supported values.
Both traditional tincture names (e.g. \code{"gules"}) and modern color equivalents
(e.g. \code{"red"}) are accepted.  Matching is case-insensitive and ignores hyphens
and spaces.}

\item{subtype}{A string with one of
\itemize{
\item \code{"combinatorial"} (default): an extension of the seven standard Petra Sancta hatchings with systematically derived mixed-color hatchings.
\item \code{"fox-davies"}: the hatchings in Fox-Davies' \emph{A Complete Guide to Heraldry}.
\item \code{"goodman"}: the hatchings in David Goodman's \emph{Heraldic Tincture} reference.
\item \code{"unicode"}: the hatchings used in Unicode character charts.
}

The string is case-insensitive and hyphens and spaces are ignored.}

\item{colour}{Stroke colour(s).}

\item{spacing}{Spacing between repetitions of pattern (in \code{units} units).}

\item{xoffset}{Shift pattern along x axis (in \code{units} units).}

\item{yoffset}{Shift pattern along y axis (in \code{units} units).}

\item{units}{\code{\link[grid:unit]{grid::unit()}} units for \code{spacing}, \code{xoffset}, and \code{yoffset} parameters.}

\item{alpha}{Alpha (between 0 and 1) or \code{NA} (default, preserves colors' alpha value).}

\item{lineend}{Line end style, one of \code{"round"} (default), \code{"butt"}, or \code{"square"}.}

\item{linewidth}{Stroke linewidth.}

\item{size}{For backwards compatibility can be used to set \code{linewidth}.}

\item{use_R4.1_masks}{If \code{TRUE} use the grid mask feature introduced in R v4.1.0.
If \code{FALSE} do a \code{rasterGrob} approximation.
If \code{NULL} try to guess an appropriate choice.
Note not all graphic devices support the grid mask feature.}

\item{png_device}{\dQuote{png} graphics device to save intermediate raster data with if \code{use_R4.1_masks} is \code{FALSE}.
If \code{NULL} and suggested package \code{ragg} is available
and versions are high enough we directly capture masked raster via \code{\link[ragg:agg_capture]{ragg::agg_capture()}}.
Otherwise we will use \code{png_device}
(default \code{\link[ragg:agg_png]{ragg::agg_png()}} if available else \code{\link[grDevices:png]{grDevices::png()}}) and \code{\link[png:readPNG]{png::readPNG()}}
to manually compute a masked raster.}

\item{res}{Resolution of desired \code{rasterGrob} in pixels per inch if \code{use_R4.1_masks} is \code{FALSE}.}

\item{default.units}{A string indicating the default units to use if \code{x} or \code{y}
are only given as numeric vectors.}

\item{name}{ A character identifier. }

\item{gp}{An object of class \code{"gpar"}, typically the output
    from a call to the function \code{\link[grid]{gpar}}.  This is basically
    a list of graphical parameter settings.}

\item{draw}{A logical value indicating whether graphics output
    should be produced.}

\item{vp}{A Grid viewport object (or NULL).}

\item{accent}{If \code{TRUE}, return tincture names using their traditional
accented spellings where applicable (e.g. \code{"tenn\\u00e9"}, \code{"brun\\u00e2tre"}).
Defaults to \code{FALSE}.}
}
\value{
A grid grob object invisibly.  If \code{draw} is \code{TRUE} then also draws to the graphic device as a side effect.
}
\description{
\code{grid.pattern_hatch()} draws a heraldic color hatching patterns onto the graphic device.
\code{names_hatch()} returns a character vector of supported \code{type} values.
}
\examples{
x_hex <- 0.5 + 0.5 * cos(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
y_hex <- 0.5 + 0.5 * sin(seq(2 * pi / 4, by = 2 * pi / 6, length.out = 6))
if (capabilities("png") || guess_has_R4.1_features("masks")) {
  grid::grid.newpage()
  grid.pattern_hatch(x_hex, y_hex, type = "azure", colour = "blue")
}
if (capabilities("png") || guess_has_R4.1_features("masks")) {
  grid::grid.newpage()
  grid.pattern_hatch(x_hex, y_hex, type = "cendree", colour = "grey", spacing = 0.1)
}
print(names_hatch())
print(names_hatch("fox-davies"))
print(names_hatch("goodman"))
print(names_hatch("unicode"))
}
\seealso{
\code{\link[=grid.pattern_line]{grid.pattern_line()}} for single-direction lines,
\code{\link[=grid.pattern_crosshatch]{grid.pattern_crosshatch()}} for perpendicular lines.
\code{vignette("hatching", package = "gridpattern")} for a visual overview of all subtypes.
\url{https://en.wikisource.org/wiki/A_Complete_Guide_to_Heraldry/Chapter_7#74} for Fox-Davies'
\emph{A Complete Guide to Heraldry}.
\url{https://david.goodman.graphics/portfolio/item/crests-heraldry-and-coats-of-arms/} for
David Goodman's Heraldic Tincture reference.
}
