_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); if ($this->_c->value < 0) { $this->_c->value = 0; } if ($this->_c->value > 1) { $this->_c->value = 1; } if ($this->_m->value < 0) { $this->_m->value = 0; } if ($this->_m->value > 1) { $this->_m->value = 1; } if ($this->_y->value < 0) { $this->_y->value = 0; } if ($this->_y->value > 1) { $this->_y->value = 1; } if ($this->_k->value < 0) { $this->_k->value = 0; } if ($this->_k->value > 1) { $this->_k->value = 1; } } /** * 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"); } }