import { Blob } from "./Blob" ; import { WMFJSError } from "./Helper" ; export class PointS { public x : number ; public y : number ; constructor ( reader , x ? , y ? ) { if ( reader != null ) { this . x = reader . readInt16 ( ) ; this . y = reader . readInt16 ( ) ; } else { this . x = x ; this . y = y ; } } public clone ( ) { return new PointS ( null , this . x , this . y ) ; } public toString ( ) { return "{x: " + this . x + ", y: " + this . y + "}" ; } } export class Rect { public bottom : number ; public right : number ; public top : number ; public left : number ; constructor ( reader , left ? , top ? , right ? , bottom ? ) { if ( reader != null ) { this . bottom = reader . readInt16 ( ) ; this . right = reader . readInt16 ( ) ; this . top = reader . readInt16 ( ) ; this . left = reader . readInt16 ( ) ; } else { this . bottom = bottom ; this . right = right ; this . top = top ; this . left = left ; } } public clone ( ) { return new Rect ( null , this . left , this . top , this . right , this . bottom ) ; } public toString ( ) { return "{left: " + this . left + ", top: " + this . top + ", right: " + this . right + ", bottom: " + this . bottom + "}" ; } public empty ( ) { return this . left >= this . right || this . top >= this . bottom ; } public intersect ( rect ) { if ( this . empty ( ) || rect . empty ( ) ) { return null ; } if ( this . left >= rect . right || this . top >= rect . bottom || this . right <= rect . left || this . bottom <= rect . top ) { return null ; } return new Rect ( null , Math . max ( this . left , rect . left ) , Math . max ( this . top , rect . top ) , Math . min ( this . right , rect . right ) , Math . min ( this . bottom , rect . bottom ) ) ; } } export class Obj { public type : string ; constructor ( type ) { this . type = type ; } public clone ( ) { throw new WMFJSError ( "clone not implemented" ) ; } public toString ( ) { throw new WMFJSError ( "toString not implemented" ) ; } }