当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF_COLORS::getSpotColor方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php

示例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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:tcpdf.php


注:本文中的TCPDF_COLORS::getSpotColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。