IShape
Interface of a shape. A shape represents a collection of pixel geometry as well as mathematical and logical parameters for rendering it (such as the presence of a contour and its width, filling, etc.)
Constructor
IShape()
Methods
Name |
Returns |
Description |
Boolean |
Checks whether the passed point is located inside the shape. |
|
Boolean |
Returns true if the passed shape is equivalent to the given one. |
|
Number[][]|null |
Returns coordinates of the two opposite corners of the area spanning the shape. The first item in the array is the corner with the smallest coordinate values relative to the rest of the points in the area; the second item is the corner with the largest coordinate values. |
|
Returns pixel geometry of a shape. |
||
getType() |
String |
Returns ID of the shape type. |
Creates a scaled copy of the shape. |
||
Creates a copy of the shape that is shifted by the specified amount. |
Methods details
contains
{Boolean} contains(position)
Checks whether the passed point is located inside the shape.
Returns true if the passed point is inside the shape.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] Coordinates of a point. |
* Mandatory parameter/option.
equals
{Boolean} equals(shape)
Returns true if the passed shape is equivalent to the given one.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IShape The shape to compare. |
* Mandatory parameter/option.
getBounds
{Number[][]|null} getBounds()
Returns coordinates of the two opposite corners of the area spanning the shape. The first item in the array is the corner with the smallest coordinate values relative to the rest of the points in the area; the second item is the corner with the largest coordinate values.
getGeometry
{IPixelGeometry} getGeometry()
Returns pixel geometry of a shape.
getType
{String} getType()
Returns ID of the shape type.
scale
{IShape} scale(factor)
Creates a scaled copy of the shape.
Returns a scaled copy of the shape.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number Scaling factor. |
* Mandatory parameter/option.
shift
{IShape} shift(offset)
Creates a copy of the shape that is shifted by the specified amount.
Returns the shifted copy of the shape.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] Amount to shift on the axes. |
* Mandatory parameter/option.
Mandatory parameter/option.