本文整理汇总了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;
//.........这里部分代码省略.........