Region method
A constructor to an object describes a rectangular region at a particular coordinate.
Syntax
let obj = new Region(region);
let obj = new Region(location, size);
let obj = new Region(x, y, width, height);
Parameters
- region
- Type:RegionPlain
- The object provided as a parameter specifies both the top-left of the new region and its dimensions.
Type definitions
- RegionPlain
- Used to describe a position and rectangular region in an image. RegionPlain is defined as: LocationPlain&RectangleSizePlain
- location
- Type:LocationPlain
- The object passed as a parameter specifies the top-left of the new region.
You can pass any object that has the following fields:
{x: number, y: number}
- size
- Type:RectangleSizePlain
- The object provided as a parameter specifies dimensions of the region.
You can pass any object that has the following fields:
{width: number, height: number}
- x
- Type:number
- The X coordinate of the left edge of the region in pixels.
- y
- Type:number
- The Y coordinate of the top edge of the region in pixels.
- width
- Type:number
- The width of the region in pixels.
- height
- Type:number
- The height of the region in pixels.
Return value
- Type: Region