本文整理汇总了PHP中Cpdf::setColor方法的典型用法代码示例。如果您正苦于以下问题:PHP Cpdf::setColor方法的具体用法?PHP Cpdf::setColor怎么用?PHP Cpdf::setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpdf
的用法示例。
在下文中一共展示了Cpdf::setColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: text
function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
{
list($r, $g, $b) = $color;
$this->_pdf->setColor($r, $g, $b);
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$font .= ".afm";
$this->_pdf->selectFont($font);
$this->_pdf->addText($x, $this->y($y) - Font_Metrics::get_font_height($font, $size), $size, utf8_decode($text), $angle, $adjust);
}
示例2: text
function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
{
list($r, $g, $b) = $color;
$this->_pdf->setColor($r, $g, $b);
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$font .= ".afm";
$this->_pdf->selectFont($font);
//Font_Metrics::get_font_height($font, $size) ==
//$this->get_font_height($font, $size) ==
//$this->_pdf->selectFont($font),$this->_pdf->getFontHeight($size)
//- FontBBoxheight+FontHeightOffset, scaled to $size, in pt
//$this->_pdf->getFontDescender($size)
//- Descender scaled to size
//
//$this->_pdf->fonts[$this->_pdf->currentFont] sizes:
//['FontBBox'][0] left, ['FontBBox'][1] bottom, ['FontBBox'][2] right, ['FontBBox'][3] top
//Maximum extent of all glyphs of the font from the baseline point
//['Ascender'] maximum height above baseline except accents
//['Descender'] maximum depth below baseline, negative number means below baseline
//['FontHeightOffset'] manual enhancement of .afm files to trim windows fonts. currently not used.
//Values are in 1/1000 pt for a font size of 1 pt
//
//['FontBBox'][1] should be close to ['Descender']
//['FontBBox'][3] should be close to ['Ascender']+Accents
//in practice, FontBBox values are a little bigger
//
//The text position is referenced to the baseline, not to the lower corner of the FontBBox,
//for what the left,top corner is given.
//FontBBox spans also the background box for the text.
//If the lower corner would be used as reference point, the Descents of the glyphs would
//hang over the background box border.
//Therefore compensate only the extent above the Baseline.
//
//print '<pre>['.$font.','.$size.','.$this->_pdf->getFontHeight($size).','.$this->_pdf->getFontDescender($size).','.$this->_pdf->fonts[$this->_pdf->currentFont]['FontBBox'][3].','.$this->_pdf->fonts[$this->_pdf->currentFont]['FontBBox'][1].','.$this->_pdf->fonts[$this->_pdf->currentFont]['FontHeightOffset'].','.$this->_pdf->fonts[$this->_pdf->currentFont]['Ascender'].','.$this->_pdf->fonts[$this->_pdf->currentFont]['Descender'].']</pre>';
//
//$this->_pdf->addText($x, $this->y($y) - Font_Metrics::get_font_height($font, $size), $size, $text, $angle, $adjust);
//$this->_pdf->addText($x, $this->y($y) - $size, $size, $text, $angle, $adjust);
//$this->_pdf->addText($x, $this->y($y) - $this->_pdf->getFontHeight($size)-$this->_pdf->getFontDescender($size), $size, $text, $angle, $adjust);
$this->_pdf->addText($x, $this->y($y) - $this->_pdf->fonts[$this->_pdf->currentFont]['FontBBox'][3] * $size / 1000, $size, $text, $angle, $adjust);
}
示例3: _set_fill_color
/**
* Sets the fill colour
*
* See {@link Style::set_color()} for the format of the colour array.
* @param array $color
*/
protected function _set_fill_color($color)
{
$this->_pdf->setColor($color);
}