grid.cropmark: Crop Mark Grob

View source: R/cropmarkGrob.R

grid.cropmarkR Documentation

Crop Mark Grob

Description

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 = NULL,
  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 to cropmarkGrob().

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_cfg object, a list of pp_cfg objects, or a character vector referring to names in envir or a character vector referring to object names that can be retrieved by base::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 grid viewport object (or NULL).

bleed

Bleed zone size to assume:

  • If bleed is a grid::unit() simply use it

  • If bleed is numeric then convert via grid::unit(bleed, default.units)

  • If bleed is TRUE assume 1/8 inch bleed zone size

  • If bleed is FALSE assume 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.

Value

A grid grob.

Examples

if (require("grid")) {
  cfg <- pp_cfg(list(mat_color = "pink", mat_width=0.05, border_color=NA))
  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)

  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)
}

trevorld/piecepack documentation built on Nov. 5, 2022, 5:56 p.m.