Adds a dark, rectangular background (the "panel") around a magick-image,
with an optional colored-border. The result is a larger image with
the original content centred on the panel, ready for warp_hud() or
composite_hud().
Usage
hud_panel(
img,
padding = 20,
panel_color = "#111111CC",
border_color = NA,
border_width = 2,
...
)Arguments
- img
A
magick-imageobject, typically fromrender_hud().- padding
Number of pixels to add around all four sides of
imgbefore drawing the panel frame. Default20.- panel_color
Background colour of the panel as a CSS hex string (including alpha channel). Default
"#111111CC".- border_color
Colour of the border drawn around the panel edge. Set to
NA(default) to omit the border.- border_width
Line width of the border in pixels. Defaults to
2.- ...
Additional arguments (currently unused, but reserved for future extensions).
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
img <- render_hud(p, width = 480, height = 320, bg = "transparent")
# panel with a green border
panel <- hud_panel(img,
panel_color = "#1B6B3ACC",
border_color = "#57FF8877",
border_width = 2)
} # }
