©
本文档使用 PHP中文网手册 发布
(PHP 4, PECL pdflib >= 1.0.0)
PDF_setrgbcolor — Set fill and stroke rgb color values [deprecated]
$p
, float $red
, float $green
, float $blue
)
Sets the current fill and stroke color to the supplied RGB values.
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
This function is deprecated since PDFlib version 4, use PDF_setcolor() instead.
[#1] n dot gaertner at gmx dot net [2001-07-09 05:19:33]
<b>Use this code to convert HEX colors to RGB that you can use with pdf_setrgbcolor:</b>
<?php
$color = "#FF00FF";
$string = str_replace("#","",$color);
$red = hexdec(substr($string,0,2)) / 255;
$green = hexdec(substr($string,2,2)) / 255;
$blue = hexdec(substr($string,4,2)) / 255;
pdf_rect($pdf, 110, 600, 20, 30);
pdf_setrgbcolor_fill($pdf, $red, $green, $blue);
pdf_fill($pdf);
?>
This gives you a pink rectangle!
[#2] skuenzli at u dot arizona dot edu [2000-04-26 12:17:46]
Here is a snippet of code to create a blue rectangle:
<?php
//Create blue rectangle
pdf_rect($pdf, 110, 600, 20, 30);
pdf_setrgbcolor_fill($pdf, 0, 0, 1.0);
pdf_fill($pdf);
?>