/** * Calculates angle between two points * * @param Point $a * @param Point $b * @return float */ protected function anglePoints(Point $a, Point $b) { $diffX = $b->getX() - $a->getX(); $diffY = $b->getY() - $a->getY(); return rad2deg(atan($diffY / $diffX)); }
/** * Returns image blob in a rectangular area * * @param Point $a * @param Point $b * @return string */ protected function textArea(Point $a, Point $b) { $width = $b->getX() - $a->getX(); $height = $b->getY() - $a->getY(); $region = $this->original->getImageRegion($width, $height, $a->getX(), $a->getY()); //Add draw debug $this->draw->setStrokeOpacity(1); $this->draw->setFillOpacity(0); $this->draw->setStrokeWidth(2); $this->draw->setStrokeColor("#FFFF00"); $this->draw->rectangle($a->getX(), $a->getY(), $b->getX(), $b->getY()); return $region->getImageBlob(); }