*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Pdf / Color / Cmyk.php
blob8bfaf69f889f0dd7ffa30815e45aa791c4664ef3
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Pdf
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Cmyk.php 16978 2009-07-22 19:59:40Z alexander $
22 /** Zend_Pdf_Color */
23 require_once 'Zend/Pdf/Color.php';
25 /** Zend_Pdf_Element_Numeric */
26 require_once 'Zend/Pdf/Element/Numeric.php';
28 /**
29 * CMYK color implementation
31 * @category Zend
32 * @package Zend_Pdf
33 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
34 * @license http://framework.zend.com/license/new-bsd New BSD License
36 class Zend_Pdf_Color_Cmyk extends Zend_Pdf_Color
38 /**
39 * Cyan level.
40 * 0.0 (zero concentration) - 1.0 (maximum concentration)
42 * @var Zend_Pdf_Element_Numeric
44 private $_c;
46 /**
47 * Magenta level.
48 * 0.0 (zero concentration) - 1.0 (maximum concentration)
50 * @var Zend_Pdf_Element_Numeric
52 private $_m;
54 /**
55 * Yellow level.
56 * 0.0 (zero concentration) - 1.0 (maximum concentration)
58 * @var Zend_Pdf_Element_Numeric
60 private $_y;
62 /**
63 * Key (BlacK) level.
64 * 0.0 (zero concentration) - 1.0 (maximum concentration)
66 * @var Zend_Pdf_Element_Numeric
68 private $_k;
71 /**
72 * Object constructor
74 * @param float $c
75 * @param float $m
76 * @param float $y
77 * @param float $k
79 public function __construct($c, $m, $y, $k)
81 if ($c < 0) { $c = 0; }
82 if ($c > 1) { $c = 1; }
84 if ($m < 0) { $m = 0; }
85 if ($m > 1) { $m = 1; }
87 if ($y < 0) { $y = 0; }
88 if ($y > 1) { $y = 1; }
90 if ($k < 0) { $k = 0; }
91 if ($k > 1) { $k = 1; }
93 $this->_c = new Zend_Pdf_Element_Numeric($c);
94 $this->_m = new Zend_Pdf_Element_Numeric($m);
95 $this->_y = new Zend_Pdf_Element_Numeric($y);
96 $this->_k = new Zend_Pdf_Element_Numeric($k);
99 /**
100 * Instructions, which can be directly inserted into content stream
101 * to switch color.
102 * Color set instructions differ for stroking and nonstroking operations.
104 * @param boolean $stroking
105 * @return string
107 public function instructions($stroking)
109 return $this->_c->toString() . ' '
110 . $this->_m->toString() . ' '
111 . $this->_y->toString() . ' '
112 . $this->_k->toString() . ($stroking? " K\n" : " k\n");
116 * Get color components (color space dependent)
118 * @return array
120 public function getComponents()
122 return array($this->_c->value, $this->_m->value, $this->_y->value, $this->_k->value);