PHP Doku:: Sets current color -

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzNon-Text MIME-AusgabenPostScript document creationPS Funktionenps_setcolor

Ein Service von Reinhard Neidl - Webprogrammierung.

PS Funktionen




(PECL ps >= 1.1.0)

ps_setcolorSets current color


bool ps_setcolor ( resource $psdoc , string $type , string $colorspace , float $c1 , float $c2 , float $c3 , float $c4 )

Sets the color for drawing, filling, or both.



Resource identifier of the postscript file as returned by ps_new().


The parameter type can be both, fill, or fillstroke.


The colorspace should be one of gray, rgb, cmyk, spot, pattern. Depending on the colorspace either only the first, the first three or all parameters will be used.


Depending on the colorspace this is either the red component (rgb), the cyan component (cmyk), the gray value (gray), the identifier of the spot color or the identifier of the pattern.


Depending on the colorspace this is either the green component (rgb), the magenta component (cmyk).


Depending on the colorspace this is either the blue component (rgb), the yellow component (cmyk).


This must only be set in cmyk colorspace and specifies the black component.


The second parameter is currently not always evaluated. The color is sometimes set for filling and drawing just as if fillstroke were passed.


Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.

Ein BenutzerBeitrag:
- Beiträge aktualisieren...
php at catchall dot toao dot net
14.06.2009 17:29
Note that if you specify colors in RGB, the parameters C1, C2, and C3 should be specified in decimal form.  To calculate this, divide the value by 255.  Example: rgb(58,110,165) becomes <?php ps_setcolor($ps, "stroke", "rgb", .23, .43, .65, 0.0); ?>

However, since this is PostScript, most if not all files will be destined for printing and colors should be specified in CMYK anyway.

PHP Powered Diese Seite bei
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",...)