diff -r 000000000000 -r 4eba9c11703f web/Zend/Pdf/Color/Cmyk.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/Pdf/Color/Cmyk.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,126 @@ + 1) { $c = 1; } + + if ($m < 0) { $m = 0; } + if ($m > 1) { $m = 1; } + + if ($y < 0) { $y = 0; } + if ($y > 1) { $y = 1; } + + if ($k < 0) { $k = 0; } + if ($k > 1) { $k = 1; } + + $this->_c = new Zend_Pdf_Element_Numeric($c); + $this->_m = new Zend_Pdf_Element_Numeric($m); + $this->_y = new Zend_Pdf_Element_Numeric($y); + $this->_k = new Zend_Pdf_Element_Numeric($k); + } + + /** + * Instructions, which can be directly inserted into content stream + * to switch color. + * Color set instructions differ for stroking and nonstroking operations. + * + * @param boolean $stroking + * @return string + */ + public function instructions($stroking) + { + return $this->_c->toString() . ' ' + . $this->_m->toString() . ' ' + . $this->_y->toString() . ' ' + . $this->_k->toString() . ($stroking? " K\n" : " k\n"); + } + + /** + * Get color components (color space dependent) + * + * @return array + */ + public function getComponents() + { + return array($this->_c->value, $this->_m->value, $this->_y->value, $this->_k->value); + } +} +