/** * The transform function applies the transformation matrix to this object and returns a new coordinates object. * * @param IdmlBoundary $boundary * @param IdmlTransformation $matrix * * @return IdmlBoundary a new object */ public static function transform(IdmlBoundary $boundary, IdmlTransformation $matrix) { $a = $matrix->getA(); $b = $matrix->getB(); $c = $matrix->getC(); $d = $matrix->getD(); $tx = $matrix->xTranslate(); $ty = $matrix->yTranslate(); $left = $boundary->left; $top = $boundary->top; $right = $boundary->right; $bottom = $boundary->bottom; // Transform (x1,y1) $left2 = $left * $a + $top * $c + $tx; $top2 = $left * $b + $top * $d + $ty; // Transform (x2,y2) $right2 = $right * $a + $bottom * $c + $tx; $bottom2 = $right * $b + $bottom * $d + $ty; return new IdmlBoundary($top2, $left2, $bottom2, $right2); }