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 | Methods

Constructor

IShape()

Methods

Name

Returns

Description

contains(position)

Boolean

Checks whether the passed point is located inside the shape.

equals(shape)

Boolean

Returns true if the passed shape is equivalent to the given one.

getBounds()

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.

getGeometry()

IPixelGeometry

Returns pixel geometry of a shape.

getType()

String

Returns ID of the shape type.

scale(factor)

IShape

Creates a scaled copy of the shape.

shift(offset)

IShape

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

position*

—

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

shape*

—

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

factor*

—

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

offset*

—

Type: Number[]

Amount to shift on the axes.

* Mandatory parameter/option.