Пример #1
0
 /**
  * Add a Block to a pixel to a given coordinate depending
  * on a pixels color
  *
  * @param \ImagickPixel $pixel
  * @param Structure     $structure
  * @param               $x
  * @param               $y
  * @param               $z
  */
 protected function addBlockForPixel(\ImagickPixel $pixel, Structure $structure, $x, $y, $z)
 {
     $color = $pixel->getColor();
     $type = $this->blockTypeColorMapping->getBlockTypeForRgbColor($color['r'], $color['g'], $color['b']);
     if (null === $type) {
         return;
     }
     // if meta is null it becomes 0
     $meta = (int) $type->getMeta();
     $structure->createBlock($type->getName(), array('x' => $x, 'y' => $y, 'z' => $z), $meta);
 }