import { Blob } from "./Blob" ; import { EMFJSError } 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 PointL { public x : number ; public y : number ; constructor ( reader , x ? , y ? ) { if ( reader != null ) { this . x = reader . readInt32 ( ) ; this . y = reader . readInt32 ( ) ; } else { this . x = x ; this . y = y ; } } public clone ( ) { return new PointL ( null , this . x , this . y ) ; } public toString ( ) { return "{x: " + this . x + ", y: " + this . y + "}" ; } } export class RectL { public left : number ; public top : number ; public right : number ; public bottom : number ; constructor ( reader , left ? , top ? , right ? , bottom ? ) { if ( reader != null ) { this . left = reader . readInt32 ( ) ; this . top = reader . readInt32 ( ) ; this . right = reader . readInt32 ( ) ; this . bottom = reader . readInt32 ( ) ; } else { this . bottom = bottom ; this . right = right ; this . top = top ; this . left = left ; } } public clone ( ) { return new RectL ( 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 ( rectL ) { if ( this . empty ( ) || rectL . empty ( ) ) { return null ; } if ( this . left >= rectL . right || this . top >= rectL . bottom || this . right <= rectL . left || this . bottom <= rectL . top ) { return null ; } return new RectL ( null , Math . max ( this . left , rectL . left ) , Math . max ( this . top , rectL . top ) , Math . min ( this . right , rectL . right ) , Math . min ( this . bottom , rectL . bottom ) ) ; } } export class SizeL { public cx : number ; public cy : number ; constructor ( reader , cx ? , cy ? ) { if ( reader != null ) { this . cx = reader . readUint32 ( ) ; this . cy = reader . readUint32 ( ) ; } else { this . cx = cx ; this . cy = cy ; } } public clone ( ) { return new SizeL ( null , this . cx , this . cy ) ; } public toString ( ) { return "{cx: " + this . cx + ", cy: " + this . cy + "}" ; } } export class Obj { public type : string ; constructor ( type ) { this . type = type ; } public clone ( ) { throw new EMFJSError ( "clone not implemented" ) ; } public toString ( ) { throw new EMFJSError ( "toString not implemented" ) ; } }