/** * Determines if the top and bottom need to be cropped * * @since 2.0 * @param SLIRImage $image * @return boolean */ private function shouldCropTopAndBottom(SLIRImage $image) { if ($image->cropRatio() > $image->ratio()) { return TRUE; } else { return FALSE; } }
/** * Gets a hash that represents the properties of the image. * * Used for caching. * * @param $infosToInclude * @return string * @since 2.0 */ public function getHash(array $infosToInclude = array()) { $infos = array(); $infos = array_merge($infos, $infosToInclude); return parent::getHash($infos); }
/** * Calculates and stores requested pixel's Delta E in relation to comparison pixel * * @since 2.0 * @param SLIRImage $image * @param integer $xA x-axis position of pixel to calculate * @param integer $yA y-axis position of pixel to calculate * @param integer $xMove number of pixels to move on the x-axis to find comparison pixel * @param integer $yMove number of pixels to move on the y-axis to find comparison pixel * @return boolean */ private function calculateDelta(SLIRImage $image, $xA, $yA, $xMove, $yMove) { $xB = $xA + $xMove; $yB = $yA + $yMove; // Pixel is outside of the image, so we cant't calculate the Delta E if ($xB < 0 || $xB >= $image->getWidth() || $yB < 0 || $yB >= $image->getHeight()) { return null; } if (!isset($this->colors[$xA][$yA][self::PIXEL_LAB])) { $this->loadPixelInfo($image, $xA, $yA); } if (!isset($this->colors[$xB][$yB][self::PIXEL_LAB])) { $this->loadPixelInfo($image, $xB, $yB); } $delta = $this->deltaE($this->colors[$xA][$yA][self::PIXEL_LAB], $this->colors[$xB][$yB][self::PIXEL_LAB]); $this->colors[$xA][$yA][self::PIXEL_DELTA_E]["d{$xMove}{$yMove}"] = $delta; $xBMove = $xMove * -1; $yBMove = $yMove * -1; $this->colors[$xB][$yB][self::PIXEL_DELTA_E]["d{$xBMove}{$yBMove}"] =& $this->colors[$xA][$yA][self::PIXEL_DELTA_E]["d{$xMove}{$yMove}"]; return true; }
/** * @since 2.0 * @param SLIRImage $image * @return integer */ public function getCropX(SLIRImage $image) { return round(($image->getWidth() - $image->getCropWidth()) / 2); }