Lines Matching defs:color

39 	public function convert($color, array &$PDFAXwarnings = [])
41 $color = strtolower(trim($color));
43 if ($color === 'transparent' || $color === 'inherit') {
47 if (isset(NamedColors::$colors[$color])) {
48 $color = NamedColors::$colors[$color];
51 if (!isset($this->cache[$color])) {
52 $c = $this->convertPlain($color, $PDFAXwarnings);
67 $this->cache[$color] = $cstr;
70 return $this->cache[$color];
144 throw new \Mpdf\MpdfException('Trying to invert non-RGB color');
148 * @param string $c Binary color string
182 * @param string $color
187 private function convertPlain($color, array &$PDFAXwarnings = [])
191 if (preg_match('/^[\d]+$/', $color)) {
192 $c = [static::MODE_GRAYSCALE, $color]; // i.e. integer only
193 } elseif (strpos($color, '#') === 0) { // case of #nnnnnn or #nnn
194 $c = $this->processHashColor($color);
195 } elseif (preg_match('/(rgba|rgb|device-cmyka|cmyka|device-cmyk|cmyk|hsla|hsl|spot)\((.*?)\)/', $color, $m)) {
200 $c = $this->restrictColorSpace($c, $color, $PDFAXwarnings);
207 * @param string $color
211 private function processHashColor($color)
214 $cor = preg_replace('/\s+.*/', '', $color);
269 throw new \Mpdf\MpdfException(sprintf('Undefined spot color "%s"', $name));
325 * @param string $color
330 private function restrictColorSpace($c, $color, &$PDFAXwarnings = [])
332 return $this->colorSpaceRestrictor->restrictColorSpace($c, $color, $PDFAXwarnings);
336 * @param string $color Binary color string
338 private function ensureBinaryColorFormat($color)
340 if (!is_string($color)) {
341 throw new \Mpdf\MpdfException('Invalid color input, binary color string expected');
344 if (strlen($color) !== 6) {
345 throw new \Mpdf\MpdfException('Invalid color input, binary color string expected');
348 if (!in_array($color[0], [static::MODE_GRAYSCALE, static::MODE_SPOT, static::MODE_RGB, static::MODE_CMYK, static::MODE_RGBA, static::MODE_CMYKA])) {
349 throw new \Mpdf\MpdfException('Invalid color input, invalid color mode in binary color string');