Class Size

A Size describes a width and a height in two-dimensional coordinates. The width and height must both be non-negative.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): Size

The default constructor produces the Size(0,0).

Returns

Size

constructor(w: number, h: number): Size

The two-argument constructor produces the Size(w,h).

Parameters

  • w: number

    this number must not be negative.

  • h: number

    this number must not be negative.

Returns

Size

Properties

public height: number

Gets or sets the height value of the Size.

public width: number

Gets or sets the width value of the Size.

Methods

public copy(): Size

Create a copy of this Size, with the same values.

Returns

Size

public equalTo(w: number, h: number): boolean

Indicates whether the given size is equal to this Size.

Parameters

  • w: number

    the width.

  • h: number

    the height. false otherwise.

Returns

boolean

public equals(s: Size): boolean

Indicates whether the given Size is equal to the current Size.

Parameters

  • s: Size

    The Size to compare to the current Size. false otherwise.

Returns

boolean

public isReal(): boolean

True if this Size has Width and Height values that are real numbers and not infinity.

Returns

boolean

public static parse(str: string): Size

This static method can be used to read in a Size from a string that was produced by Size.stringify.

Parameters

  • str: string

Returns

Size

public set(s: Size): Size

Modify this Size so that its Width and Height values are the same as the given Size.

Parameters

  • s: Size

    the given Size.

Returns

Size

public setTo(w: number, h: number): Size

Modify this Size with new Width and Height values.

Parameters

  • w: number

    the width.

  • h: number

    the height.

Returns

Size

public static stringify(val: Size): string

This static method can be used to write out a Size as a string that can be read by Size.parse.

Parameters

Returns

string