略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ps_setcolor

2024-11-14

ps_setcolor

(PECL ps >= 1.1.0)

ps_setcolorSets current color

说明

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

Sets the color for drawing, filling, or both.

参数

psdoc

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

type

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

colorspace

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.

c1

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.

c2

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

c3

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

c4

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

返回值

成功时返回 true, 或者在失败时返回 false

注释

警告

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

add a noteadd a note

User Contributed Notes 1 note

up
0
php at catchall dot toao dot net
13 years ago
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.

官方地址:https://www.php.net/manual/en/function.ps-setcolor.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3