plot_with_hand <- function(...) {
null <- length(list(...)) &&is.null(list(...)[[1]])
title <- deparse(substitute(list(...)))
title <- if (! null) {
sub("list\\((.*)\\)", "human_hand(\\1)", title)
} else {
"NULL"
}
plot.new()
plot.window(c(0, 10), c(0, 10))
title(title)
set_brush(NULL)
if (null)
hand <- NULL
else
hand <- human_hand(seed = 1, ...)
set_hand(hand)
rect(1, 1, 4, 4)
draw_rough_rect(6, 6, 9, 9, col = "green4", hand = hand)
draw_rough_rect(1, 6, 4, 9, col = "darkred",
fill_pattern = zigzag(),
hand = hand)
draw_rough_rect(6, 1, 9, 4, lwd = 2, border = "navy",
col = "slateblue3",
fill_pattern = jumble(density = 12),
hand = hand)
arrows(1, 5, 9, 5, lwd = 6)
}
Pressure using mypaint_device() and brushes
set_brush("classic/pen")
#> Warning in system2(pkg_config_bin, c("--variable=brushesdir",
#> "mypaint-brushes-2.0"), : running command ''/usr/bin/pkg-config'
#> --variable=brushesdir mypaint-brushes-2.0 2>/dev/null' had status 1 and error
#> message 'Function not implemented'
plot_with_hand(pressure = pressure_flat())

set_brush("classic/pen")
#> Warning in system2(pkg_config_bin, c("--variable=brushesdir",
#> "mypaint-brushes-2.0"), : running command ''/usr/bin/pkg-config'
#> --variable=brushesdir mypaint-brushes-2.0 2>/dev/null' had status 1 and error
#> message 'Function not implemented'
plot_with_hand(pressure = pressure_smooth())

set_brush("ramon/Marker")
#> Warning in system2(pkg_config_bin, c("--variable=brushesdir",
#> "mypaint-brushes-2.0"), : running command ''/usr/bin/pkg-config'
#> --variable=brushesdir mypaint-brushes-2.0 2>/dev/null' had status 1 and error
#> message 'Function not implemented'
plot_with_hand(pressure = pressure_flat())

set_brush("ramon/Marker")
#> Warning in system2(pkg_config_bin, c("--variable=brushesdir",
#> "mypaint-brushes-2.0"), : running command ''/usr/bin/pkg-config'
#> --variable=brushesdir mypaint-brushes-2.0 2>/dev/null' had status 1 and error
#> message 'Function not implemented'
plot_with_hand(pressure = pressure_smooth())

set_brush("ramon/Marker")
#> Warning in system2(pkg_config_bin, c("--variable=brushesdir",
#> "mypaint-brushes-2.0"), : running command ''/usr/bin/pkg-config'
#> --variable=brushesdir mypaint-brushes-2.0 2>/dev/null' had status 1 and error
#> message 'Function not implemented'
plot_with_hand(pressure = pressure_human())
