-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnr_rect.Rd
58 lines (50 loc) · 1.43 KB
/
nr_rect.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nr-draw.R
\name{nr_rect}
\alias{nr_rect}
\title{Draw rectangles on a \code{nativeRaster} image}
\usage{
nr_rect(
nr,
x,
y,
w,
h,
fill = "black",
color = NA,
hjust = 0,
vjust = 0,
linewidth = 1,
mode = draw_mode$respect_alpha
)
}
\arguments{
\item{nr}{\code{nativeRaster}}
\item{x, y}{coordinates of lower left corner of rectangle. [vector]}
\item{w, h}{width and height of rectangle. [vector]}
\item{fill}{interior fill color [vector]}
\item{color}{outline color. Default: NA. [vector]}
\item{hjust, vjust}{specify horizontal and vertical justification of the
\code{src} image. e.g. \code{hjust = vjust = 0} the blitting
starts at the top-left of the image. Use \code{hjust = vjust = 0.5}
to treat the centre of the \code{src_} as the blitting origin.
Default (0, 0)}
\item{linewidth}{Line linewidth. Default: 1. If \code{linewidth = 1} then a
naive version of Bresenham is used to draw the points. If linewidth
is greater than 1, then the line is convert to a triangle strip and
rendered as polygons.}
\item{mode}{drawing mode.}
}
\value{
Original \code{nativeRaster} modified in-place
}
\description{
Draw rectangles on a \code{nativeRaster} image
}
\examples{
N <- 200
nr <- nr_new(N, N, 'grey80')
nr_rect(nr, x = c(0, N/2 - 1), y = c(0, N/2 - 1), w = N/2, h = N/4,
fill = 'blue', color = c('red', 'green'), linewidth = 3)
plot(nr, TRUE)
}