Set the active mypaintr brush
Usage
set_brush(
brush = NULL,
type = c("both", "stroke", "fill"),
auto_solid_bg = NULL
)Arguments
- brush
Brush specification created with
tweak_brush(), an installed brush name,.mybfile path, JSON brush string, orNULLto switch the selected type back to solid rendering.- type
Which rendering channel to update:
"both","stroke", or"fill".- auto_solid_bg
Optional override for background-like fills.
Value
NULL, invisibly. If the active graphics device is not
mypaint_device(), this emits a warning and has no effect.
See also
Other brush management:
brush_dirs(),
brush_inputs(),
brush_settings(),
brushes(),
load_brush(),
tweak_brush()
Examples
ex_file <- tempfile(fileext = ".png")
mypaint_device(ex_file)
plot.new()
plot.window(c(0, 10), c(0, 10))
brushes <- c("classic/pen", "classic/charcoal", "classic/ink_blot",
"ramon/2B_pencil")
for (idx in seq_along(brushes)) {
set_brush(brushes[idx])
lines(c(1, 9), c(2 * idx, 2 * idx), lwd = 2)
}
dev.off()
#> agg_record_1d9546cc7d52
#> 2
img <- png::readPNG(ex_file)
grid::grid.raster(img)