當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。