basicPieceGrobs | R Documentation |
basicPieceGrob
is the most common
“grob” function that grid.piece
uses
to create grid
graphical grob
objects.
picturePieceGrobFn
is a function that returns a “grob” function
that imports graphics from files found in its directory
argument.
basicPieceGrob(piece_side, suit, rank, cfg = pp_cfg())
picturePieceGrobFn(directory, filename_fn = find_pp_file)
pyramidTopGrob(piece_side, suit, rank, cfg = pp_cfg())
previewLayoutGrob(piece_side, suit, rank, cfg = pp_cfg())
piece_side |
A string with piece and side separated by a underscore e.g. "coin_face" |
suit |
Number of suit (starting from 1). |
rank |
Number of rank (starting from 1) |
cfg |
Piecepack configuration list or |
directory |
Directory that |
filename_fn |
Function that takes arguments |
if (requireNamespace("grid", quietly = TRUE) && piecepackr:::device_supports_unicode()) {
cfg <- pp_cfg(list(grob_fn.tile=basicPieceGrob, invert_colors=TRUE))
grid.piece("tile_face", suit=1, rank=3, cfg=cfg)
}
# May take more than 5 seconds on CRAN servers
try({
if (requireNamespace("grid", quietly = TRUE) && capabilities(c("cairo"))) {
cfg <- pp_cfg(list(grob_fn.tile=basicPieceGrob, invert_colors=TRUE))
directory <- tempdir()
save_piece_images(cfg, directory=directory, format="svg", angle=0)
cfg2 <- pp_cfg(list(grob_fn=picturePieceGrobFn(directory)))
grid::grid.newpage()
grid.piece("coin_back", suit=3, rank=5, cfg=cfg2)
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.