Multiple blit operations in a single call

nr_blit_bulk(dst, src, config)

Arguments

dst

destination native raster

src

list of native raster images.

config

data.frame of configuration information for each blit. Columns in this data.frame match the arguments to nr_blit(). Requires columns:

idx

The index of the image in the src list i.e. src[[idx]]

x,y

location in dst to place src[[idx]]

Optional columns which take a default value if not present:

xsrc,ysrc

start coordinates within src. Default: (0, 0)

w,h

size within src. Default: use whole width/height

hjust,vjust

Default: (0.5, 0.5)

angle

Default: 0

scale

Zoom factor. Default: 1

use_alpha

Default: true

render

Should this given operation be rendered? Default: true

Value

Invisibly return the supplied dst native raster image which was been modified in-place

See also

Other blitting functions: nr_blit()

Examples

nr <- nr_new(90, 90, 'grey60')

config <- data.frame(
  idx = c(1, 2, 3, 4),
  x = c(10, 10, 40, 40) + 15,
  y = c(10, 40, 40, 10) + 15,
  xsrc = 0L,
  ysrc = 0L,
  w = -1L,
  h = -1L,
  hjust = 0.5,
  vjust = 0.5,
  angle = c(0, 0, 0, pi/4),
  scale = c(0.5, 1, 1, 1),
  use_alpha = TRUE,
  render = TRUE
)

nr_blit_bulk(dst = nr, src = deer, config = config)
plot(nr)