Uses Bresenham's algorithm to draw lines. No antialiasing.

nr_line(nr, x0, y0, x1, y1, color = "black")

Arguments

nr

nativeRaster

x0, y0, x1, y1

Vectors of coordinates of endpoints of line

color

Color as a character string. Either a standard R color (e.g. 'blue', 'white') or a hex color of the form #rrggbbaa, #rrggbb, #rgba or #rgb

Value

Original nativeRaster modified in-place

Examples

N <- 20
nr <- nr_new(N, N, 'grey80')
nr_line(nr, x0 = c(1, N), y0 = c(1, 1), x1 = c(N, 1), y1 = c(N, N), 
        color = c('red', 'black'))
plot(nr)