diff --git a/src/pixi/core/Matrix.js b/src/pixi/core/Matrix.js index cc4ebe2..5d235ae 100644 --- a/src/pixi/core/Matrix.js +++ b/src/pixi/core/Matrix.js @@ -78,6 +78,23 @@ return array; }; +PIXI.Matrix.prototype.toGlobal = function(pos) +{ + return { + x:this.a * pos.x + this.b * pos.y + this.tx, + y:this.c * pos.x + this.d * pos.y + this.ty + }; +}; + +PIXI.Matrix.prototype.applyInverse = function(pos) +{ + var id = 1 / (this.a * this.d + this.b * -this.c); + return { + x:this.d * id * pos.x + -this.b * id * pos.y + (this.ty * this.b - this.tx * this.d) * id, + y:this.a * id * pos.y + -this.c * id * pos.x + (-this.ty * this.a + this.tx * this.c) * id + }; +}; + PIXI.identityMatrix = new PIXI.Matrix(); PIXI.determineMatrixArrayType = function() {