當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TCPDF_STATIC::getPathPaintOperator方法代碼示例

本文整理匯總了PHP中TCPDF_STATIC::getPathPaintOperator方法的典型用法代碼示例。如果您正苦於以下問題:PHP TCPDF_STATIC::getPathPaintOperator方法的具體用法?PHP TCPDF_STATIC::getPathPaintOperator怎麽用?PHP TCPDF_STATIC::getPathPaintOperator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TCPDF_STATIC的用法示例。


在下文中一共展示了TCPDF_STATIC::getPathPaintOperator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SVGPath

 /**
  * Draws an SVG path
  * @param $d (string) attribute d of the path SVG element
  * @param $style (string) Style of rendering. Possible values are:
  * <ul>
  *	 <li>D or empty string: Draw (default).</li>
  *	 <li>F: Fill.</li>
  *	 <li>F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.</li>
  *	 <li>DF or FD: Draw and fill.</li>
  *	 <li>DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.</li>
  *	 <li>CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).</li>
  *	 <li>CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).</li>
  * </ul>
  * @return array of container box measures (x, y, w, h)
  * @author Nicola Asuni
  * @since 5.0.000 (2010-05-02)
  * @protected
  */
 protected function SVGPath($d, $style = '')
 {
     if ($this->state != 2) {
         return;
     }
     // set fill/stroke style
     $op = TCPDF_STATIC::getPathPaintOperator($style, '');
     if (empty($op)) {
         return;
     }
     $paths = array();
     $d = preg_replace('/([0-9ACHLMQSTVZ])([\\-\\+])/si', '\\1 \\2', $d);
     preg_match_all('/([ACHLMQSTVZ])[\\s]*([^ACHLMQSTVZ\\"]*)/si', $d, $paths, PREG_SET_ORDER);
     $x = 0;
     $y = 0;
     $x1 = 0;
     $y1 = 0;
     $x2 = 0;
     $y2 = 0;
     $xmin = 2147483647;
     $xmax = 0;
     $ymin = 2147483647;
     $ymax = 0;
     $relcoord = false;
     $minlen = 0.01 / $this->k;
     // minimum acceptable length (3 point)
     $firstcmd = true;
     // used to print first point
     // draw curve pieces
     foreach ($paths as $key => $val) {
         // get curve type
         $cmd = trim($val[1]);
         if (strtolower($cmd) == $cmd) {
             // use relative coordinated instead of absolute
             $relcoord = true;
             $xoffset = $x;
             $yoffset = $y;
         } else {
             $relcoord = false;
             $xoffset = 0;
             $yoffset = 0;
         }
         $params = array();
         if (isset($val[2])) {
             // get curve parameters
             $rawparams = preg_split('/([\\,\\s]+)/si', trim($val[2]));
             $params = array();
             foreach ($rawparams as $ck => $cp) {
                 $params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false);
                 if (abs($params[$ck]) < $minlen) {
                     // aproximate little values to zero
                     $params[$ck] = 0;
                 }
             }
         }
         // store current origin point
         $x0 = $x;
         $y0 = $y;
         switch (strtoupper($cmd)) {
             case 'M':
                 // moveto
                 foreach ($params as $ck => $cp) {
                     if ($ck % 2 == 0) {
                         $x = $cp + $xoffset;
                     } else {
                         $y = $cp + $yoffset;
                         if ($firstcmd or abs($x0 - $x) >= $minlen or abs($y0 - $y) >= $minlen) {
                             if ($ck == 1) {
                                 $this->_outPoint($x, $y);
                                 $firstcmd = false;
                             } else {
                                 $this->_outLine($x, $y);
                             }
                             $x0 = $x;
                             $y0 = $y;
                         }
                         $xmin = min($xmin, $x);
                         $ymin = min($ymin, $y);
                         $xmax = max($xmax, $x);
                         $ymax = max($ymax, $y);
                         if ($relcoord) {
                             $xoffset = $x;
//.........這裏部分代碼省略.........
開發者ID:TheTypoMaster,項目名稱:myapps,代碼行數:101,代碼來源:tcpdf.php


注:本文中的TCPDF_STATIC::getPathPaintOperator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。