Single source blitted to one or more locations.
nr_blit(
dst,
src,
x,
y,
xsrc = 0L,
ysrc = 0L,
w = -1L,
h = -1L,
hjust = 0.5,
vjust = 0.5,
angle = 0,
scale = 1,
respect_alpha = TRUE
)source and destination native rasters
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).
start coordiates within src
size within src. If size is negative, then the actual width/height of the src is used
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)
Rotation angle (clockwise) in radians. Default: 0
Zoom factor. Default: 1
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.
None. dst modified by-reference and returned invisibly.
nr <- nr_new(50, 50, 'grey80')
nr_blit(dst = nr, src = deer_sprites[[1]], x = 25, y = 25)
plot(nr, T)
nr <- nr_new(300, 200, 'grey80')
sq <- nr_new(20, 20, 'darkblue')
nr_blit(nr, src = sq, x = 100, y = 100, angle = pi/3, scale = 5)
plot(nr, T)
nr <- nr_new(300, 200, 'grey80')
sq <- png::readPNG(system.file("img", "Rlogo.png", package="png"), native = TRUE)
nr_blit(nr, src = sq, x = 180, y = 120, angle = pi/6, scale = 1)
plot(nr, T)