Class: IWSize

IWSize

A class representing the size of a rectangle.

new IWSize(width, height)

Creates a new size object with the specified dimension.
Parameters:
Name Type Description
width number the width in pixels
height number the height in pixels

Extends

Methods


clone()

Returns a new instance of this object.
Overrides:
Returns:
Type
IWSize

compareTo(other)

Returns 1 if this size is larger than the other one, -1 if it is smaller and 0 if both sizes are the same.
Parameters:
Name Type Description
other IWSize another size
Returns:
Type
number

containsPoint(point)

Checks whether the specified point stands inside or outside this size.
Parameters:
Name Type Description
point IWPoint a point
Returns:
returns true if the point is part of the size, otherwise it returns false.
Type
boolean

divide(scalar)

Divides size by a scalar
Parameters:
Name Type Description
scalar Number
Returns:
Type
IWSize

equals(other)

Checks whether the specified size and this one are the same.
Parameters:
Name Type Description
other IWSize another size object
Returns:
Type
boolean

getCenter()

Interprets the size as a rectangle from (0, 0) to (w, h) and returns the center of it.
Returns:
the center, i.e. (width/2, height/2)
Type
IWPoint

getHeight()

Returns the height value.
Returns:
Type
number

getWidth()

Returns the width value.
Returns:
Type
number

multiplicate()

Deprecated:
  • use multiply instead

multiply(scalar)

Multiplicates size by a scalar
Parameters:
Name Type Description
scalar Number
Returns:
Type
IWSize

setHeight(height)

Sets the height value. The value must be greater than zero, otherwise an exception is thrown.
Parameters:
Name Type Description
height number the new height
Returns:
Type
void

setWidth(width)

Sets the width. The value must be greater than zero, otherwise an exception is thrown.
Parameters:
Name Type Description
width number the new width
Returns:
Type
void

toString()

Returns a string representation of this size in the form width x height.
Returns:
Type
String