Single source blitted to one or more locations.

nr_blit(
  dst,
  src,
  x,
  y,
  x0 = 0L,
  y0 = 0L,
  w = -1L,
  h = -1L,
  hjust = 0,
  vjust = 0,
  respect_alpha = TRUE
)

Arguments

dst, src

source and destination native rasters

x, y

Where in nr to place the sprite. These values must be vectors of the same length. If the length is greater than 1, then the sprite will be pasted into nr at multiple locations. Note that the origin of nativeraster images is the top-left where the coordinates are (0, 0).

x0, y0

start coordiates within src

w, h

size within src. If size is negative, then the actual width/height of the src is used

hjust, vjust

specify horizontal and vertical justification of the src image. e.g. hjust = vjust = 0 the blitting starts at the top-left of the image. Use hjust = vjust = 0.5 to treat the centre of the src_ as the blitting origin. Default (0, 0)

respect_alpha

Should the alpha channel be respected when blitting? Default: TRUE means to carefully blend pixels at each location using alpha values. If FALSE, then contents at the dst will just be replaced with src pixels which can be much much faster.

Value

None. dst modifief by-reference and returned invisibly.

Examples

nr <- nr_new(50, 50, 'grey80')
nr_blit(dst = nr, src = deer_sprites[[1]], x = 0, y = 0)
plot(nr)