13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Barcode |
16 * @package Zend_Barcode |
17 * @subpackage Renderer |
17 * @subpackage Renderer |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: RendererAbstract.php 24593 2012-01-05 20:35:02Z matthew $ |
20 * @version $Id$ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * Class for rendering the barcode |
24 * Class for rendering the barcode |
25 * |
25 * |
26 * @category Zend |
26 * @category Zend |
27 * @package Zend_Barcode |
27 * @package Zend_Barcode |
28 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
28 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
29 * @license http://framework.zend.com/license/new-bsd New BSD License |
29 * @license http://framework.zend.com/license/new-bsd New BSD License |
30 */ |
30 */ |
31 abstract class Zend_Barcode_Renderer_RendererAbstract |
31 abstract class Zend_Barcode_Renderer_RendererAbstract |
32 { |
32 { |
33 /** |
33 /** |
167 |
168 |
168 /** |
169 /** |
169 * Manually adjust top position |
170 * Manually adjust top position |
170 * @param integer $value |
171 * @param integer $value |
171 * @return Zend_Barcode_Renderer |
172 * @return Zend_Barcode_Renderer |
172 * @throw Zend_Barcode_Renderer_Exception |
173 * @throws Zend_Barcode_Renderer_Exception |
173 */ |
174 */ |
174 public function setTopOffset($value) |
175 public function setTopOffset($value) |
175 { |
176 { |
176 if (!is_numeric($value) || intval($value) < 0) { |
177 if (!is_numeric($value) || intval($value) < 0) { |
177 require_once 'Zend/Barcode/Renderer/Exception.php'; |
178 require_once 'Zend/Barcode/Renderer/Exception.php'; |
194 |
195 |
195 /** |
196 /** |
196 * Manually adjust left position |
197 * Manually adjust left position |
197 * @param integer $value |
198 * @param integer $value |
198 * @return Zend_Barcode_Renderer |
199 * @return Zend_Barcode_Renderer |
199 * @throw Zend_Barcode_Renderer_Exception |
200 * @throws Zend_Barcode_Renderer_Exception |
200 */ |
201 */ |
201 public function setLeftOffset($value) |
202 public function setLeftOffset($value) |
202 { |
203 { |
203 if (!is_numeric($value) || intval($value) < 0) { |
204 if (!is_numeric($value) || intval($value) < 0) { |
204 require_once 'Zend/Barcode/Renderer/Exception.php'; |
205 require_once 'Zend/Barcode/Renderer/Exception.php'; |
219 return $this->_leftOffset; |
220 return $this->_leftOffset; |
220 } |
221 } |
221 |
222 |
222 /** |
223 /** |
223 * Activate/Deactivate the automatic rendering of exception |
224 * Activate/Deactivate the automatic rendering of exception |
|
225 * |
224 * @param boolean $value |
226 * @param boolean $value |
|
227 * @return $this |
225 */ |
228 */ |
226 public function setAutomaticRenderError($value) |
229 public function setAutomaticRenderError($value) |
227 { |
230 { |
228 $this->_automaticRenderError = (bool) $value; |
231 $this->_automaticRenderError = (bool) $value; |
229 return $this; |
232 return $this; |
230 } |
233 } |
231 |
234 |
232 /** |
235 /** |
233 * Horizontal position of the barcode in the rendering resource |
236 * Horizontal position of the barcode in the rendering resource |
|
237 * |
234 * @param string $value |
238 * @param string $value |
235 * @return Zend_Barcode_Renderer |
239 * @return Zend_Barcode_Renderer |
236 * @throw Zend_Barcode_Renderer_Exception |
240 * @throws Zend_Barcode_Renderer_Exception |
237 */ |
241 */ |
238 public function setHorizontalPosition($value) |
242 public function setHorizontalPosition($value) |
239 { |
243 { |
240 if (!in_array($value, array('left' , 'center' , 'right'))) { |
244 if (!in_array($value, array('left' , 'center' , 'right'))) { |
241 require_once 'Zend/Barcode/Renderer/Exception.php'; |
245 require_once 'Zend/Barcode/Renderer/Exception.php'; |
256 return $this->_horizontalPosition; |
260 return $this->_horizontalPosition; |
257 } |
261 } |
258 |
262 |
259 /** |
263 /** |
260 * Vertical position of the barcode in the rendering resource |
264 * Vertical position of the barcode in the rendering resource |
|
265 * |
261 * @param string $value |
266 * @param string $value |
262 * @return Zend_Barcode_Renderer |
267 * @return self |
263 * @throw Zend_Barcode_Renderer_Exception |
268 * @throws Zend_Barcode_Renderer_Exception |
264 */ |
269 */ |
265 public function setVerticalPosition($value) |
270 public function setVerticalPosition($value) |
266 { |
271 { |
267 if (!in_array($value, array('top' , 'middle' , 'bottom'))) { |
272 if (!in_array($value, array('top' , 'middle' , 'bottom'))) { |
268 require_once 'Zend/Barcode/Renderer/Exception.php'; |
273 require_once 'Zend/Barcode/Renderer/Exception.php'; |
285 |
290 |
286 /** |
291 /** |
287 * Set the size of a module |
292 * Set the size of a module |
288 * @param float $value |
293 * @param float $value |
289 * @return Zend_Barcode_Renderer |
294 * @return Zend_Barcode_Renderer |
290 * @throw Zend_Barcode_Renderer_Exception |
295 * @throws Zend_Barcode_Renderer_Exception |
291 */ |
296 */ |
292 public function setModuleSize($value) |
297 public function setModuleSize($value) |
293 { |
298 { |
294 if (!is_numeric($value) || floatval($value) <= 0) { |
299 if (!is_numeric($value) || floatval($value) <= 0) { |
295 require_once 'Zend/Barcode/Renderer/Exception.php'; |
300 require_once 'Zend/Barcode/Renderer/Exception.php'; |
320 return $this->_automaticRenderError; |
325 return $this->_automaticRenderError; |
321 } |
326 } |
322 |
327 |
323 /** |
328 /** |
324 * Set the barcode object |
329 * Set the barcode object |
|
330 * |
325 * @param Zend_Barcode_Object $barcode |
331 * @param Zend_Barcode_Object $barcode |
326 * @return Zend_Barcode_Renderer |
332 * @return Zend_Barcode_Renderer |
|
333 * @throws Zend_Barcode_Renderer_Exception |
327 */ |
334 */ |
328 public function setBarcode($barcode) |
335 public function setBarcode($barcode) |
329 { |
336 { |
330 if (!$barcode instanceof Zend_Barcode_Object_ObjectAbstract) { |
337 if (!$barcode instanceof Zend_Barcode_Object_ObjectAbstract) { |
331 require_once 'Zend/Barcode/Renderer/Exception.php'; |
338 require_once 'Zend/Barcode/Renderer/Exception.php'; |
518 */ |
528 */ |
519 abstract protected function _drawPolygon($points, $color, $filled = true); |
529 abstract protected function _drawPolygon($points, $color, $filled = true); |
520 |
530 |
521 /** |
531 /** |
522 * Draw a polygon in the rendering resource |
532 * Draw a polygon in the rendering resource |
523 * @param string $text |
533 * |
524 * @param float $size |
534 * @param string $text |
525 * @param array $position |
535 * @param float $size |
526 * @param string $font |
536 * @param array $position |
527 * @param integer $color |
537 * @param string $font |
528 * @param string $alignment |
538 * @param integer $color |
529 * @param float $orientation |
539 * @param string $alignment |
|
540 * @param float|int $orientation |
530 */ |
541 */ |
531 abstract protected function _drawText( |
542 abstract protected function _drawText( |
532 $text, |
543 $text, |
533 $size, |
544 $size, |
534 $position, |
545 $position, |