PHP Doku:: Setzt Füllfarbe in RGB [veraltet] - function.pdf-setrgbcolor-fill.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzNon-Text MIME-AusgabenPDFPDF FunktionenPDF_setrgbcolor_fill

Ein Service von Reinhard Neidl - Webprogrammierung.

PDF Funktionen

<<PDF_setpolydash

PDF_setrgbcolor_stroke>>

PDF_setrgbcolor_fill

(PHP 4, PECL pdflib >= 1.0.0)

PDF_setrgbcolor_fillSetzt Füllfarbe in RGB [veraltet]

Beschreibung

bool PDF_setrgbcolor_fill ( resource $p , float $red , float $green , float $blue )

Setzt die aktuelle Füllfarbe auf die übergebenen RGB-Werte. Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.

Diese Funktion ist seit PDFlib Version 4 veraltet, verwenden Sie stattdessen die Funktion PDF_setcolor().


2 BenutzerBeiträge:
- Beiträge aktualisieren...
philipp dot maske at location-bretagne dot de
13.06.2003 3:33
It took some time to understand, that the float values have to be beetween beetween 0 and 1. If you use graphic tools like color-pickers etc. it is necessary to convert the RGB values frome the scale of 1 to 255 to 0 to 1.

Use this small function to make your life easier:

function pdf_setrgbcolor_fill_better($intPdfObj, $intRed, $intGreen, $intBlue) {
  if($intRed<=0||$intRed>255|| $intGreen<=0|| $intGreen>255|| $intBlue<=0|| $intBlue>255) return false;

  $floatRed        = $intRed/255;
  $floatGreen      = $intGreen/255;
  $floatBlue       = $intBlue/255;

  return pdf_setrgbcolor_fill ($intPdfObj, $floatRed, $floatGreen, $floatBlue);
  }

Have Fun!
Philipp
--
Mail:   philipp.maske@location-bretagne.de
WWW: http://www.location-bretagne.de
maske at chiquadrat dot de
2.11.2001 4:16
the double values for each RGB color start at '0' and end at '1'. So use e.g. pdf_setrgbcolor_fill(int pdf_document,1,1,1) for white, pdf_setrgbcolor_fill(int pdf_document,0,0,0) for black or something in between for a mixed color.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)