Description Usage Arguments Details See Also Examples
View source: R/cairo--bespoke.R
This is a custom function to draw lots of line segments within C with a single call from R. Use this function when you want to draw lots of segments and need to speed up the creation of the final image.
1 | cairo_segment_vec(cr, x1, y1, x2, y2, r, g, b, a)
|
cr |
|
x1, y1, x2, y2 |
coordinates of endpoints |
r, g, b, a |
colour values in range [0,1] |
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
Other bespoke:
cairo_arc_vec()
,
cairo_image_surface_create_from_array()
,
cairo_image_surface_get_array()
,
cairo_image_surface_get_raster()
,
cairo_image_surface_get_raw()
,
cairo_image_surface_write_array()
,
cairo_polygon_vec()
,
cairo_polygon()
,
cairo_rectangle_vec()
Other vectorised:
cairo_arc_vec()
,
cairo_polygon_vec()
,
cairo_rectangle_vec()
1 2 3 4 5 6 7 8 9 10 | ## Not run:
# Draw 10 lines - all black
N <- 10
x1 <- runif(N)
y1 <- runif(N)
x2 <- runif(N)
y2 <- runif(N)
cairo_segment_vec(cr, x1, y2, x2, y2, 0, 0, 0, 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.