struct

CrImage::Region

Inherits Struct < Value < Object

Represents a rectangular area on an Image from its upper left corner x and y coordinates, and a width and height.

See Operation::Crop#crop and Operation::Draw#draw_square for examples using it.

Constructors

center(x : UInt16, y : UInt16, width : UInt16, height : UInt16) : Region

Construct a new Region with x and y being the center of the region instead of the upper left corner.

Source
new(x : UInt16, y : UInt16, width : UInt16, height : UInt16)
Source

Instance methods

center

Return the {x, y} tuple of the center coordinates of this Region

Source
clone
Source
copy_with(x _x = @x, y _y = @y, width _width = @width, height _height = @height)
Source
crop(image : Image) : Image

Crop a provided Image with this region, using Operation::Crop#crop

Source
height
to_tuple

Return this Region as a x, y, width, and height tuple

Source
width
x
y