Cuts out a rectangle of size width x height from the location (x, y) of an x3p object. x and y specify the bottom right corner of the rectangle. In case the dimensions of the surface matrix do not allow for the full dimensions of the rectangle cutout the dimensions are adjusted accordingly.
Value
x3p object of the cropped location expanded by list element offset
that contains the coordinates of the cropped piece within the parent.
Examples
logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
# crop the x3p file to just the CSAFE logo
logo_only <- x3p_crop(logo, x=20, y=50, width = 255 ,height =310)
logo_only <- x3p_crop(logo, x=20, y=50, width = 255 ,height =510)
#> Warning: Specified dimension are adjusted to fit within range of the surface matrix: 255 x 370
# x3p_image(logo_only, size=c(500,500), zoom = 1)