예제 #1
0
 /**
  * Sets colorX and colorY coordinates according image width and height
  *
  * @param array $pixel ('x' => ..., 'y' => ...)
  * @param string $position
  * @param Varien_Image_Adapter_Abstract $adapter
  * @return array
  */
 protected function _prepareColor($pixel, $position, $adapter)
 {
     switch ($position) {
         case Varien_Image_Adapter_Abstract::POSITION_BOTTOM_RIGHT:
             $pixel['x'] = $adapter->getOriginalWidth() - 1;
             $pixel['y'] = $adapter->getOriginalHeight() - 1;
             break;
         case Varien_Image_Adapter_Abstract::POSITION_BOTTOM_LEFT:
             $pixel['x'] = 1;
             $pixel['y'] = $adapter->getOriginalHeight() - 1;
             break;
         case Varien_Image_Adapter_Abstract::POSITION_TOP_LEFT:
             $pixel['x'] = 1;
             $pixel['y'] = 1;
             break;
         case Varien_Image_Adapter_Abstract::POSITION_TOP_RIGHT:
             $pixel['x'] = $adapter->getOriginalWidth() - 1;
             $pixel['y'] = 1;
             break;
         case Varien_Image_Adapter_Abstract::POSITION_STRETCH:
         case Varien_Image_Adapter_Abstract::POSITION_TILE:
             $pixel['x'] = round($adapter->getOriginalWidth() / 3);
             $pixel['y'] = round($adapter->getOriginalHeight() / 3);
             break;
     }
     return $pixel;
 }