Viewport class 
Class for storing image virtual viewport info and providing helper methods.
declare class Viewport {
  x1: number;
  y1: number;
  x2: number;
  y2: number;
  constructor(x1: number, y1: number, x2: number, y2: number);
  static fromLiteral(obj: ViewportLiteral): Viewport;
  getWidth(): number;
  getHeight(): number;
  getArea(): number;
  expand(x: number, y: number): this;
  clone(): Viewport;
  fixBounds(): this;
  scale(scale: number): this;
  reset(): this;
  offset(x: number, y: number): this;
}Constructor 
- Params: 
x1: number,y1: number,x2: number,y2: number- coordinates of top-left and bottom-right image corners in virtual coordinate space. 
Properties 
x1 
- Type: 
number 
X coordinate of top-left image pixel in virtual coordinate space.
y1 
- Type: 
number 
Y coordinate of top-left image pixel in virtual coordinate space.
x2 
- Type: 
number 
X coordinate of bottom-right image pixel in virtual coordinate space.
y2 
- Type: 
number 
Y coordinate of bottom-right image pixel in virtual coordinate space.
Static methods 
fromLiteral() 
- Params: 
viewportLiteral: ViewportLiteral- viewport literal object. - Returns: 
Viewportinstance. 
Creates new instance from viewport literal object.
Methods 
getWidth() 
- Returns: 
number 
Returns viewport width.
getHeight() 
- Returns: 
number 
Returns viewport height.
getArea() 
- Returns: 
number 
Returns viewport area.
expand() 
- Params: 
x: number,y: numberpoint coordinates. - Returns: 
this 
Expands viewport to contain given point coordinates.
clone() 
- Returns: 
Vieportinstance 
Returns new viewport with same bounds.
fixBounds() 
- Returns: 
this 
Expands viewport by one pixel if needed after best-fit viewport calculation for antialiasing purpose.
scale() 
- Params: 
scale: number- scale factor - Returns: 
this 
Scales viewport by given factor.
reset() 
- Returns: 
this 
Resets viewport offset to (0, 0).
offset() 
- Params: 
x: number,y: number - Returns: 
this 
Adds given offset to current viewport offset.
