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


PHP TCPDF_STATIC::getTransformationMatrixProduct方法代碼示例

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


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

示例1: startSVGElementHandler

 /**
  * Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
  * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
  * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
  * @param $attribs (array) The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
  * @param $ctm (array) tranformation matrix for clipping mode (starting transformation matrix).
  * @author Nicola Asuni
  * @since 5.0.000 (2010-05-02)
  * @protected
  */
 protected function startSVGElementHandler($parser, $name, $attribs, $ctm = array())
 {
     // check if we are in clip mode
     if ($this->svgclipmode) {
         $this->svgclippaths[$this->svgclipid][] = array('name' => $name, 'attribs' => $attribs, 'tm' => $this->svgcliptm[$this->svgclipid]);
         return;
     }
     if ($this->svgdefsmode and !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) {
         if (!isset($attribs['id'])) {
             $attribs['id'] = 'DF_' . (count($this->svgdefs) + 1);
         }
         $this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
         return;
     }
     $clipping = false;
     if ($parser == 'clip-path') {
         // set clipping mode
         $clipping = true;
     }
     // get styling properties
     $prev_svgstyle = $this->svgstyles[count($this->svgstyles) - 1];
     // previous style
     $svgstyle = $this->svgstyles[0];
     // set default style
     if ($clipping and !isset($attribs['fill']) and (!isset($attribs['style']) or !preg_match('/[;\\"\\s]{1}fill[\\s]*:[\\s]*([^;\\"]*)/si', $attribs['style'], $attrval))) {
         // default fill attribute for clipping
         $attribs['fill'] = 'none';
     }
     if (isset($attribs['style']) and !TCPDF_STATIC::empty_string($attribs['style'])) {
         // fix style for regular expression
         $attribs['style'] = ';' . $attribs['style'];
     }
     foreach ($prev_svgstyle as $key => $val) {
         if (in_array($key, TCPDF_IMAGES::$svginheritprop)) {
             // inherit previous value
             $svgstyle[$key] = $val;
         }
         if (isset($attribs[$key]) and !TCPDF_STATIC::empty_string($attribs[$key])) {
             // specific attribute settings
             if ($attribs[$key] == 'inherit') {
                 $svgstyle[$key] = $val;
             } else {
                 $svgstyle[$key] = $attribs[$key];
             }
         } elseif (isset($attribs['style']) and !TCPDF_STATIC::empty_string($attribs['style'])) {
             // CSS style syntax
             $attrval = array();
             if (preg_match('/[;\\"\\s]{1}' . $key . '[\\s]*:[\\s]*([^;\\"]*)/si', $attribs['style'], $attrval) and isset($attrval[1])) {
                 if ($attrval[1] == 'inherit') {
                     $svgstyle[$key] = $val;
                 } else {
                     $svgstyle[$key] = $attrval[1];
                 }
             }
         }
     }
     // transformation matrix
     if (!empty($ctm)) {
         $tm = $ctm;
     } else {
         //$tm = $this->svgstyles[(count($this->svgstyles) - 1)]['transfmatrix'];
         $tm = array(1, 0, 0, 1, 0, 0);
     }
     if (isset($attribs['transform']) and !empty($attribs['transform'])) {
         $tm = TCPDF_STATIC::getTransformationMatrixProduct($tm, TCPDF_STATIC::getSVGTransformMatrix($attribs['transform']));
     }
     $svgstyle['transfmatrix'] = $tm;
     $invisible = false;
     if ($svgstyle['visibility'] == 'hidden' or $svgstyle['visibility'] == 'collapse' or $svgstyle['display'] == 'none') {
         // the current graphics element is invisible (nothing is painted)
         $invisible = true;
     }
     // process tag
     switch ($name) {
         case 'defs':
             $this->svgdefsmode = true;
             break;
             // clipPath
         // clipPath
         case 'clipPath':
             if ($invisible) {
                 break;
             }
             $this->svgclipmode = true;
             if (!isset($attribs['id'])) {
                 $attribs['id'] = 'CP_' . (count($this->svgcliptm) + 1);
             }
             $this->svgclipid = $attribs['id'];
             $this->svgclippaths[$this->svgclipid] = array();
             $this->svgcliptm[$this->svgclipid] = $tm;
//.........這裏部分代碼省略.........
開發者ID:TheTypoMaster,項目名稱:myapps,代碼行數:101,代碼來源:tcpdf.php

示例2: startSVGElementHandler

	/**
	 * Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
	 * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
	 * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
	 * @param $attribs (array) The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
	 * @param $ctm (array) tranformation matrix for clipping mode (starting transformation matrix).
	 * @author Nicola Asuni
	 * @since 5.0.000 (2010-05-02)
	 * @protected
	 */
	protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array()) {
		$name = $this->removeTagNamespace($name);
		// check if we are in clip mode
		if ($this->svgclipmode) {
			$this->svgclippaths[$this->svgclipid][] = array('name' => $name, 'attribs' => $attribs, 'tm' => $this->svgcliptm[$this->svgclipid]);
			return;
		}
		if ($this->svgdefsmode AND !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) {
			if (isset($attribs['id'])) {
				$attribs['child_elements'] = array();
				$this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
				return;
			}
			if (end($this->svgdefs) !== FALSE) {
				$last_svgdefs_id = key($this->svgdefs);
				if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) {
					$attribs['id'] = 'DF_'.(count($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements']) + 1);
					$this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
					return;
				}
			}
			return;
		}
		$clipping = false;
		if ($parser == 'clip-path') {
			// set clipping mode
			$clipping = true;
		}
		// get styling properties
		$prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; // previous style
		$svgstyle = $this->svgstyles[0]; // set default style
		if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) {
			// default fill attribute for clipping
			$attribs['fill'] = 'none';
		}
		if (isset($attribs['style']) AND !TCPDF_STATIC::empty_string($attribs['style']) AND ($attribs['style'][0] != ';')) {
			// fix style for regular expression
			$attribs['style'] = ';'.$attribs['style'];
		}
		foreach ($prev_svgstyle as $key => $val) {
			if (in_array($key, TCPDF_IMAGES::$svginheritprop)) {
				// inherit previous value
				$svgstyle[$key] = $val;
			}
			if (isset($attribs[$key]) AND !TCPDF_STATIC::empty_string($attribs[$key])) {
				// specific attribute settings
				if ($attribs[$key] == 'inherit') {
					$svgstyle[$key] = $val;
				} else {
					$svgstyle[$key] = $attribs[$key];
				}
			} elseif (isset($attribs['style']) AND !TCPDF_STATIC::empty_string($attribs['style'])) {
				// CSS style syntax
				$attrval = array();
				if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) {
					if ($attrval[1] == 'inherit') {
						$svgstyle[$key] = $val;
					} else {
						$svgstyle[$key] = $attrval[1];
					}
				}
			}
		}
		// transformation matrix
		if (!empty($ctm)) {
			$tm = $ctm;
		} else {
			$tm = array(1,0,0,1,0,0);
		}
		if (isset($attribs['transform']) AND !empty($attribs['transform'])) {
			$tm = TCPDF_STATIC::getTransformationMatrixProduct($tm, TCPDF_STATIC::getSVGTransformMatrix($attribs['transform']));
		}
		$svgstyle['transfmatrix'] = $tm;
		$invisible = false;
		if (($svgstyle['visibility'] == 'hidden') OR ($svgstyle['visibility'] == 'collapse') OR ($svgstyle['display'] == 'none')) {
			// the current graphics element is invisible (nothing is painted)
			$invisible = true;
		}
		// process tag
		switch($name) {
			case 'defs': {
				$this->svgdefsmode = true;
				break;
			}
			// clipPath
			case 'clipPath': {
				if ($invisible) {
					break;
				}
				$this->svgclipmode = true;
//.........這裏部分代碼省略.........
開發者ID:ketanbgm,項目名稱:Billing--application-codeigniter-mysql-ajax,代碼行數:101,代碼來源:tcpdf.php


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