本文整理汇总了PHP中TCPDF_COLORS::getSpotColor方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_COLORS::getSpotColor方法的具体用法?PHP TCPDF_COLORS::getSpotColor怎么用?PHP TCPDF_COLORS::getSpotColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF_COLORS
的用法示例。
在下文中一共展示了TCPDF_COLORS::getSpotColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: colorRegistrationBar
//.........这里部分代码省略.........
// bar height
$xd = 0;
// delta x
$yd = $hb;
// delta y
}
$xb = $x;
$yb = $y;
foreach ($bars as $col) {
switch ($col) {
// set transition colors
case 'A':
// BLACK (GRAYSCALE)
$col_a = array(255);
$col_b = array(0);
break;
case 'W':
// WHITE (GRAYSCALE)
$col_a = array(0);
$col_b = array(255);
break;
case 'R':
// RED (RGB)
$col_a = array(255, 255, 255);
$col_b = array(255, 0, 0);
break;
case 'G':
// GREEN (RGB)
$col_a = array(255, 255, 255);
$col_b = array(0, 255, 0);
break;
case 'B':
// BLUE (RGB)
$col_a = array(255, 255, 255);
$col_b = array(0, 0, 255);
break;
case 'C':
// CYAN (CMYK)
$col_a = array(0, 0, 0, 0);
$col_b = array(100, 0, 0, 0);
break;
case 'M':
// MAGENTA (CMYK)
$col_a = array(0, 0, 0, 0);
$col_b = array(0, 100, 0, 0);
break;
case 'Y':
// YELLOW (CMYK)
$col_a = array(0, 0, 0, 0);
$col_b = array(0, 0, 100, 0);
break;
case 'K':
// KEY - BLACK (CMYK)
$col_a = array(0, 0, 0, 0);
$col_b = array(0, 0, 0, 100);
break;
case 'RGB':
// BLACK REGISTRATION (RGB)
$col_a = array(255, 255, 255);
$col_b = array(0, 0, 0);
break;
case 'CMYK':
// BLACK REGISTRATION (CMYK)
$col_a = array(0, 0, 0, 0);
$col_b = array(100, 100, 100, 100);
break;
case 'ALL':
// SPOT COLOR REGISTRATION
$col_a = array(0, 0, 0, 0, 'None');
$col_b = array(100, 100, 100, 100, 'All');
break;
case 'NONE':
// SKIP THIS COLOR
$col_a = array(0, 0, 0, 0, 'None');
$col_b = array(0, 0, 0, 0, 'None');
break;
default:
// SPECIFIC SPOT COLOR NAME
$col_a = array(0, 0, 0, 0, 'None');
$col_b = TCPDF_COLORS::getSpotColor($col, $this->spot_colors);
if ($col_b === false) {
// in case of error defaults to the registration color
$col_b = array(100, 100, 100, 100, 'All');
}
break;
}
if ($col != 'NONE') {
if ($transition) {
// color gradient
$this->LinearGradient($xb, $yb, $wb, $hb, $col_a, $col_b, $coords);
} else {
$this->SetFillColorArray($col_b);
// colored rectangle
$this->Rect($xb, $yb, $wb, $hb, 'F', array());
}
$xb += $xd;
$yb += $yd;
}
}
}
示例2: setSpotColor
/**
* Set the spot color for the specified type ('draw', 'fill', 'text').
* @param $type (string) Type of object affected by this color: ('draw', 'fill', 'text').
* @param $name (string) Name of the spot color.
* @param $tint (float) Intensity of the color (from 0 to 100 ; 100 = full intensity by default).
* @return (string) PDF color command.
* @public
* @since 5.9.125 (2011-10-03)
*/
public function setSpotColor($type, $name, $tint = 100)
{
$spotcolor = TCPDF_COLORS::getSpotColor($name, $this->spot_colors);
if ($spotcolor === false) {
$this->Error('Undefined spot color: ' . $name . ', you must add it on the spotcolors.php file.');
}
$tint = max(0, min(100, $tint)) / 100;
$pdfcolor = sprintf('/CS%d ', $this->spot_colors[$name]['i']);
switch ($type) {
case 'draw':
$pdfcolor .= sprintf('CS %F SCN', $tint);
$this->DrawColor = $pdfcolor;
$this->strokecolor = $spotcolor;
break;
case 'fill':
$pdfcolor .= sprintf('cs %F scn', $tint);
$this->FillColor = $pdfcolor;
$this->bgcolor = $spotcolor;
break;
case 'text':
$pdfcolor .= sprintf('cs %F scn', $tint);
$this->TextColor = $pdfcolor;
$this->fgcolor = $spotcolor;
break;
}
$this->ColorFlag = $this->FillColor != $this->TextColor;
if ($this->state == 2) {
$this->_out($pdfcolor);
}
if ($this->inxobj) {
// we are inside an XObject template
$this->xobjects[$this->xobjid]['spot_colors'][$name] = $this->spot_colors[$name];
}
return $pdfcolor;
}