/** * Sub process to draw the barcode instructions * Needed by the automatic error rendering */ private function drawInstructionList() { $instructionList = $this->barcode->draw(); foreach ($instructionList as $instruction) { switch ($instruction['type']) { case 'polygon': $this->drawPolygon($instruction['points'], $instruction['color'], $instruction['filled']); break; case 'text': //$text, $size, $position, $font, $color, $alignment = 'center', $orientation = 0) $this->drawText($instruction['text'], $instruction['size'], $instruction['position'], $instruction['font'], $instruction['color'], $instruction['alignment'], $instruction['orientation']); break; default: throw new Exception\UnexpectedValueException('Unkown drawing command'); } } }
public function testGetDefaultHeight() { $this->assertEquals(62, $this->_object->getHeight()); }
protected function doDrawBarcode($x, $y, Barcode $barcode) { $renderer = new \Zend\Barcode\Renderer\Image(array()); $imageResource = imagecreate($barcode->getWidth(true) + 1, $barcode->getHeight(true) + 1); $renderer->setResource($imageResource); $renderer->setBarcode($barcode); $renderer->draw(); ob_start(); imagepng($imageResource); $image = ob_get_clean(); @imagedestroy($image); $image = $this->imagine->load($image); $image = $image->resize(new Box($image->getSize()->getWidth() / 2, $image->getSize()->getHeight() / 2)); list($currentImage, $point) = $this->getCurrentClip(); $currentImage->paste($image, $this->translatePoint($point, $x, $this->convertYCoord($y))); }