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


PHP ConvertColor函数代码示例

本文整理汇总了PHP中ConvertColor函数的典型用法代码示例。如果您正苦于以下问题:PHP ConvertColor函数的具体用法?PHP ConvertColor怎么用?PHP ConvertColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ConvertColor函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _tableWrite

 function _tableWrite(&$table)
 {
     //! @desc Main table function
     //! @return void
     $cells =& $table['cells'];
     $numcols = $table['nc'];
     $numrows = $table['nr'];
     $x0 = $this->x;
     $y0 = $this->y;
     $right = $this->pgwidth - $this->rMargin;
     if (isset($table['a']) and $table['w'] != $this->pgwidth) {
         if ($table['a'] == 'C') {
             $x0 += ($right - $x0 - $table['w']) / 2;
         } elseif ($table['a'] == 'R') {
             $x0 = $right - $table['w'];
         }
     }
     $returny = 0;
     $tableheader = array();
     //Draw Table Contents and Borders
     for ($i = 0; $i < $numrows; $i++) {
         $skippage = false;
         for ($j = 0; $j < $numcols; $j++) {
             if (isset($cells[$i][$j]) && $cells[$i][$j]) {
                 $cell =& $cells[$i][$j];
                 list($x, $w) = $this->_tableGetWidth($table, $i, $j);
                 list($y, $h) = $this->_tableGetHeight($table, $i, $j);
                 $x += $x0;
                 $y += $y0;
                 $y -= $returny;
                 if ($y + $h > $this->fh - $this->bMargin && ($y0 > 0 || $x0 > 0)) {
                     if (!$skippage) {
                         $y -= $y0;
                         $returny += $y;
                         $this->AddPage();
                         if ($this->usetableheader) {
                             $this->Header($tableheader);
                         }
                         if ($this->usetableheader) {
                             $y0 = $this->y;
                         } else {
                             $y0 = $this->tMargin;
                         }
                         $y = $y0;
                     }
                     $skippage = true;
                 }
                 //Align
                 $this->x = $x;
                 $this->y = $y;
                 $align = isset($cell['a']) ? $cell['a'] : 'L';
                 //Vertical align
                 if (!isset($cell['va']) || $cell['va'] == 'M') {
                     $this->y += ($h - $cell['mih']) / 2;
                 } elseif (isset($cell['va']) && $cell['va'] == 'B') {
                     $this->y += $h - $cell['mih'];
                 }
                 //Fill
                 $fill = isset($cell['bgcolor']) ? $cell['bgcolor'] : (isset($table['bgcolor'][$i]) ? $table['bgcolor'][$i] : (isset($table['bgcolor'][-1]) ? $table['bgcolor'][-1] : 0));
                 if ($fill) {
                     $color = ConvertColor($fill);
                     $this->SetFillColor($color['R'], $color['G'], $color['B']);
                     $this->Rect($x, $y, $w, $h, 'F');
                 }
                 //Border
                 if (isset($cell['border'])) {
                     $this->_tableRect($x, $y, $w, $h, $cell['border']);
                 } elseif (isset($table['border']) && $table['border']) {
                     $this->Rect($x, $y, $w, $h);
                 }
                 $this->divalign = $align;
                 $this->divwidth = $w - 2;
                 //Get info of first row == table header
                 if ($this->usetableheader and $i == 0) {
                     $tableheader[$j]['x'] = $x;
                     $tableheader[$j]['y'] = $y;
                     $tableheader[$j]['h'] = $h;
                     $tableheader[$j]['w'] = $w;
                     $tableheader[$j]['text'] = $cell['text'];
                     $tableheader[$j]['textbuffer'] = $cell['textbuffer'];
                     $tableheader[$j]['a'] = isset($cell['a']) ? $cell['a'] : 'L';
                     $tableheader[$j]['va'] = $cell['va'];
                     $tableheader[$j]['mih'] = $cell['mih'];
                     $tableheader[$j]['bgcolor'] = $fill;
                     if ($table['border']) {
                         $tableheader[$j]['border'] = 'all';
                     } elseif (isset($cell['border'])) {
                         $tableheader[$j]['border'] = $cell['border'];
                     }
                 }
                 if (!empty($cell['textbuffer'])) {
                     $this->printbuffer($cell['textbuffer'], false, true);
                 }
                 //Reset values
                 $this->Reset();
             }
             //end of (if isset(cells)...)
         }
         // end of columns
         if ($i == $numrows - 1) {
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:owaspbwa,代码行数:101,代码来源:html2fpdf.php

示例2: _tableWrite

 function _tableWrite(&$table)
 {
     //EDITEI
     //! @return void
     $cs =& $table['cells'];
     $nc = $table['nc'];
     $nr = $table['nr'];
     $x0 = $this->x;
     $y0 = $this->y;
     $right = $this->pgwidth - $this->rMargin;
     if (isset($table['a']) and $table['w'] != $this->pgwidth) {
         if ($table['a'] == 'C') {
             $x0 += ($right - $x0 - $table['w']) / 2;
         } elseif ($table['a'] == 'R') {
             $x0 = $right - $table['w'];
         }
     }
     $returny = 0;
     //Draw Table Contents and Borders
     for ($i = 0; $i < $nr; $i++) {
         //rows
         $skippage = false;
         for ($j = 0; $j < $nc; $j++) {
             //columns
             if (isset($cs[$i][$j]) && $cs[$i][$j]) {
                 $c =& $cs[$i][$j];
                 list($x, $w) = $this->_tableGetWidth($table, $i, $j);
                 list($y, $h) = $this->_tableGetHeight($table, $i, $j);
                 $x += $x0;
                 $y += $y0;
                 $y -= $returny;
                 if ($y + $h > $this->fh - $this->bMargin && ($y0 > 0 || $x0 > 0)) {
                     if (!$skippage) {
                         $y -= $y0;
                         $returny += $y;
                         $this->AddPage();
                         $y0 = $this->tMargin;
                         $y = $y0;
                     }
                     $skippage = true;
                 }
                 //Align
                 $this->x = $x;
                 $this->y = $y;
                 $align = isset($c['a']) ? $c['a'] : 'L';
                 //Vertical align
                 if (!isset($c['va']) || $c['va'] == 'M') {
                     $this->y += ($h - $c['mih']) / 2;
                 } elseif (isset($c['va']) && $c['va'] == 'B') {
                     $this->y += $h - $c['mih'];
                 }
                 //Fill
                 $fill = isset($c['bgcolor']) ? $c['bgcolor'] : (isset($table['bgcolor'][$i]) ? $table['bgcolor'][$i] : (isset($table['bgcolor'][-1]) ? $table['bgcolor'][-1] : 0));
                 if ($fill) {
                     $color = ConvertColor($fill);
                     $this->SetFillColor($color['R'], $color['G'], $color['B']);
                     $this->Rect($x, $y, $w, $h, 'F');
                 }
                 //Border
                 if (isset($c['border'])) {
                     $this->_tableRect($x, $y, $w, $h, $c['border']);
                 } elseif (isset($table['border']) && $table['border']) {
                     $this->Rect($x, $y, $w, $h);
                 }
                 //Content (EDITEI - now accepts bold italic underline inside table!)
                 $c['text'] = implode("", $c['text']);
                 //BUG?
                 //WORDWRAP eliminates some spaces creating differences between text and textbuffer?!?
                 //paliative fix: if w == pgwidth dont call WordWrap, let it wordwrap automatically
                 if ($w != $this->pgwidth) {
                     $this->WordWrap($c['text'], $w - 2);
                 }
                 // -2 to leave a small margin
                 $this->divalign = $align;
                 $this->divwidth = $w;
                 $this->divheight = $this->FontSizePt / 2;
                 if (!empty($c['textbuffer'])) {
                     $this->printbuffer($c['textbuffer'], true, $c['text']);
                 }
                 $this->divalign = 'L';
                 $this->divwidth = 0;
                 $this->divheight = 0;
             }
             //end of (if isset...)
         }
         // end of cols
         if ($i == $nr - 1) {
             $this->y = $y + $h;
         }
         //last row jump (update this->y position)
     }
     // end of rows
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:93,代码来源:html2fpdf.php


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