This is a custom function to draw lots of rectangles within C with a single call from R. Use this function when you want to draw lots of rectangles and need to speed up the creation of the final image.

cairo_rectangle_vec(cr, x, y, width, height, r, g, b, a, sr, sg, sb, sa)

Arguments

cr

cairo_t *

x

double

y

double

width

double

height

double

r, g, b, a

fill colour values in range [0,1]. Set a = 0 to disable filling

sr, sg, sb, sa

stroke colour values in range [0,1]. Set sa = 0 to disable drawing the stroke

Details

Besides the cr context, all arguments should either be the same length as the initial argument (xc) or have a length of 1.

Vectors which have a length of 1 will be considered to have a constant value for all objects

See also

Examples

if (FALSE) { # Draw 10 rectangles of the same size, with red fill and no outline N <- 10 x <- runif(N) y <- runif(N) width <- 20 height <- 10 cairo_rectangle_vec(cr, x, y, width, height, 1, 0, 0, 1, 0, 0, 0, 0) }