| nr_blit | R Documentation |
Copy a whole image, or subset of an image, into the destination image and configure the angle and size of the copied image.
nr_blit(
dst,
src,
x,
y,
xsrc = 0L,
ysrc = 0L,
w = -1L,
h = -1L,
hjust = 0.5,
vjust = 0.5,
angle = 0,
scale = 1,
use_alpha = TRUE
)
dst, src |
source and destination native raster images |
x, y |
Location in |
xsrc, ysrc |
Upper-left coordinates of the bounding box within the |
w, h |
Width and height of the bounding box within the |
hjust, vjust |
specify horizontal and vertical justification of the
handle on the |
angle |
Rotation angle (clockwise) in radians. Default: 0.
If this is a vector, then the |
scale |
Zoom factor. Default: 1. IF this is a vector, then the |
use_alpha |
Use alpha channel when drawing? Logical. Default: TRUE |
This operation is vectorised such that a single src image can be
pasted multiple times into the dst image with varying location,
angle and scale.
Invisibly return the supplied dst native raster image which was been
modified in-place
Other blitting functions:
nr_blit_multi()
nr <- nr_new(50, 50, 'grey80')
nr_blit(dst = nr, src = deer[[1]], x = 25, y = 25)
plot(nr)
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)
nr <- nr_new(800, 600, 'grey80')
sq <- fastpng::read_png(system.file("image/deer-1.png", package="nara"), type = 'nativeraster')
nr_blit(nr, src = sq, x = 300, y = 240, angle = pi/2, scale = 1)
plot(nr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.