% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/render_alpha_outline.R
\name{render_alpha_outline}
\alias{render_alpha_outline}
\title{Render Alpha Outline}
\usage{
render_alpha_outline(
  image = NULL,
  mask = NULL,
  expand = 0,
  edge_softness = 0.1,
  blur = 0,
  gap_fill = 1,
  gap_fill_alpha_threshold = 0.25,
  color = "black",
  alpha = 1,
  pad = 0,
  composite = TRUE,
  filename = NULL,
  preview = FALSE
)
}
\arguments{
\item{image}{Default \code{NULL}. Image whose alpha channel will be used as the
mask. If \code{mask} is supplied, \code{image} is only used for metadata.}

\item{mask}{Default \code{NULL}. Optional logical or numeric matrix to use as the
outline mask instead of \code{image} alpha.}

\item{expand}{Default \code{0}. Number of pixels to expand the mask.}

\item{edge_softness}{Default \code{0.1}. Width of the softened halo edge
transition, in pixels.}

\item{blur}{Default \code{0}. Gaussian blur standard deviation applied to the
final outline alpha.}

\item{gap_fill}{Default \code{1}. Maximum alpha gap width, in pixels, to bridge
in the expanded outline alpha. This fills border-connected breaks and notches
caused by discrete distance quantization. Set to \code{0} to disable.}

\item{gap_fill_alpha_threshold}{Default \code{0.25}. Alpha threshold used to
classify border gaps. Gap filling only modifies pixels below this threshold
that are connected to the image exterior; enclosed interior holes surrounded
by pixels at or above this threshold are left unchanged.}

\item{color}{Default \code{"black"}. Outline color.}

\item{alpha}{Default \code{1}. Overall outline alpha multiplier.}

\item{pad}{Default \code{0}. Padding in pixels before computing the outline. If
\code{NULL}, padding is computed from \code{expand}, \code{edge_softness}, and \code{blur}.}

\item{composite}{Default \code{TRUE}. If \code{TRUE} and \code{image} is supplied, composite
the outline below the original image. Set to \code{FALSE} to return the outline
alone.}

\item{filename}{Default \code{NULL}. File to save the image to. If \code{NULL} and
\code{preview = FALSE}, returns the output image.}

\item{preview}{Default \code{FALSE}. If \code{TRUE}, display the outline image.}
}
\value{
A \code{rayimg} RGBA output image with a \code{padding} attribute.
}
\description{
Creates a colored RGBA outline or halo from an image alpha
channel or a supplied mask. When \code{image} is supplied, the original image is
composited over the outline by default.
}
\examples{
\dontshow{if (interactive() || identical(Sys.getenv("IN_PKGDOWN"), "true")) withAutoprint(\{ # examplesIf}
txt = render_text_image("\U0001F409",  size = 120, background_alpha = 0)
render_alpha_outline(txt, expand = 2, blur = 1, color = "purple") |>
 plot_image()

#Make a rainbow outline 
render_alpha_outline(txt, expand = 2, blur = 0.1, color = "darkgreen") |>
 render_alpha_outline(expand = 2, blur = 0.1, color = "yellow") |>
 render_alpha_outline(expand = 2, blur = 0.1, color = "orange") |>
 render_alpha_outline(expand = 2, blur = 0.1, color = "red") |>
 render_alpha_outline(expand = 2, blur = 0.1, color = "purple") |>
 render_alpha_outline(expand = 2, blur = 0.1, color = "blue") |>
 plot_image()
\dontshow{\}) # examplesIf}
}
