x3p_crop: Crop an x3p object to a specified width and height

Description Usage Arguments Examples

View source: R/x3p_crop.R

Description

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.

Usage

1
x3p_crop(x3p, x = 1, y = 1, width = 128, height = 128)

Arguments

x3p

x3p object

x

integer, location (in pixels) of the leftmost side of the rectangle,

y

integer, location (in pixels) of the leftmost side of the rectangle,

width

integer, width (in pixels) of the rectangle,

height

integer, height (in pixels) of the rectangle,

Examples

1
2
3
4
5
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)
# x3p_image(logo_only, size=c(500,500), zoom = 1)

x3ptools documentation built on Nov. 27, 2021, 1:06 a.m.