grid.cropmark() draws “crop marks” to the active graphics device.
cropmarkGrob() is its grid grob counterpart.
Intended for use in adding crop marks around
game pieces in print-and-play layouts.
Usage
cropmarkGrob(
...,
piece_side = "tile_back",
suit = NA,
rank = NA,
cfg = getOption("piecepackr.cfg", pp_cfg()),
x = unit(0.5, "npc"),
y = unit(0.5, "npc"),
angle = 0,
width = NA,
height = NA,
scale = 1,
default.units = "npc",
envir = getOption("piecepackr.envir"),
name = NULL,
gp = gpar(),
vp = NULL,
bleed = unit(0.125, "in"),
cm_select = "12345678",
cm_width = unit(0.25, "mm"),
cm_length = unit(0.125, "in")
)
grid.cropmark(..., draw = TRUE)Arguments
- ...
cropmarkGrob()ignores;grid.cropmark()passes tocropmarkGrob().- 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
pp_cfgobject, a list ofpp_cfgobjects, or a character vector referring to names inenviror a character vector referring to object names that can be retrieved bybase::dynGet().- x
Where to place piece on x axis of viewport
- y
Where to place piece on y axis of viewport
- angle
Angle (on xy plane) to draw piece at
- width
Width of piece
- height
Height of piece
- scale
Multiplicative scaling factor to apply to width, height, and depth.
- default.units
A string indicating the default units to use if 'x', 'y', 'width', and/or 'height' are only given as numeric vectors.
- envir
Environment (or named list) containing configuration list(s).
- name
A character identifier (for grid)
- gp
An object of class “gpar”.
- vp
A
gridviewport object (orNULL).- bleed
Bleed zone size to assume:
If
bleedis agrid::unit()simply use itIf
bleedis numeric then convert viagrid::unit(bleed, default.units)If
bleedisTRUEassume 1/8 inch bleed zone sizeIf
bleedisFALSEassume 0 inch bleed zone size
- cm_select
A string of integers from "1" to "8" indicating which crop marks to draw. "1" represents the top right crop mark then we proceeding clockwise to "8" which represents the top left crop mark. Default "12345678" draws all eight crop marks.
- cm_width
Width of crop mark.
- cm_length
Length of crop mark.
- draw
A logical value indicating whether graphics output should be produced.
Examples
if (requireNamespace("grid", quietly = TRUE) &&
piecepackr:::device_supports_unicode()) {
cfg <- pp_cfg(list(mat_color = "pink", mat_width=0.05, border_color=NA))
grid::grid.newpage()
df <- data.frame(piece_side = "tile_face", suit = 2, rank = 2,
x = 2, y = 2, angle = 0,
stringsAsFactors = FALSE)
pmap_piece(df, grid.cropmark, cfg = cfg, default.units = "in")
pmap_piece(df, grid.piece, cfg = cfg, default.units = "in", bleed=TRUE)
}
if (requireNamespace("grid", quietly = TRUE) &&
piecepackr:::device_supports_unicode()) {
grid::grid.newpage()
df <- data.frame(piece_side = "coin_back", suit = 2, rank = 2,
x = 2, y = 2, angle = 0,
stringsAsFactors = FALSE)
pmap_piece(df, grid.cropmark, cfg = cfg, default.units = "in", bleed=TRUE)
pmap_piece(df, grid.piece, cfg = cfg, default.units = "in", bleed=TRUE)
}