pdf_setcolor: add examples, clarify range for color values

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@65775 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
jim winstead 2001-12-20 21:07:53 +00:00
parent e9d073fb91
commit 518241fc04

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.74 $ -->
<!-- $Revision: 1.75 $ -->
<reference id="ref.pdf">
<title>PDF functions </title>
<titleabbrev>PDF</titleabbrev>
@ -2099,7 +2099,7 @@ pdf_close_image($pdf, $pim);
<refentry id="function.pdf-setcolor">
<refnamediv>
<refname>pdf_setcolor</refname>
<refpurpose>Sets fill and stroke color to CMYK values</refpurpose>
<refpurpose>Sets fill and stroke color</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@ -2116,31 +2116,57 @@ pdf_close_image($pdf, $pim);
</funcprototype>
</funcsynopsis>
<para>
Set the current color space and color. The parameter
<parameter>type</parameter> can be "fill", "stroke", or "both"
to specify that the color is set for filling, stroking or both
filling and stroking. The parameter
<parameter>colorspace</parameter> can be
<literal>gray</literal>, <literal>rgb</literal>,
<literal>cmyk</literal>, <literal>spot</literal> or
<literal>pattern</literal>. The parameters
<parameter>c1</parameter>, <parameter>c2</parameter>,
<parameter>c3</parameter> and <parameter>c4</parameter>
represent the color components for the color space specified by
<parameter>colorspace</parameter>. For <literal>gray</literal> only
<parameter>c1</parameter> is used. For <literal>rgb</literal> parameters
<parameter>c1</parameter>, <parameter>c2</parameter>, and
<parameter>c3</parameter> specify the Red, Green amd Blue values
respectively.
For <literal>cmyk</literal> parameters <parameter>c1</parameter>,
<parameter>c2</parameter>, <parameter>c3</parameter>, and
<parameter>c4</parameter> specify the Cyan, Magenta, Yellow and
Black values respectively.
For <literal>spot</literal> <parameter>c1</parameter> specifies
a spot color handles returned by <function>pdf_makespotcolor</function>
and <parameter>c2</parameter> specifies a tint value between 0 and 1.
For <literal>pattern</literal> <parameter>c1</parameter> specifies
a pattern handle returned by <function>pdf_begin_pattern</function>.
Set the current color space and color. The parameter
<parameter>type</parameter> can be "fill", "stroke", or "both" to
specify that the color is set for filling, stroking or both filling and
stroking. The parameter <parameter>colorspace</parameter> can be
<literal>gray</literal>, <literal>rgb</literal>,
<literal>cmyk</literal>, <literal>spot</literal> or
<literal>pattern</literal>. The parameters <parameter>c1</parameter>,
<parameter>c2</parameter>, <parameter>c3</parameter> and
<parameter>c4</parameter> represent the color components for the color
space specified by <parameter>colorspace</parameter>. Except as
otherwise noted, the color components are floating-point values that
range from 0 to 1.
</para>
<para>
For <literal>gray</literal> only <parameter>c1</parameter> is used.
</para>
<para>
For <literal>rgb</literal> parameters <parameter>c1</parameter>,
<parameter>c2</parameter>, and <parameter>c3</parameter> specify the
red, green and blue values respectively.
<informalexample>
<programlisting role="php">
<![CDATA[
// Set fill and stroke colors to white.
pdf_setcolor($pdf, "both", "rgb", 1, 1, 1);
]]>
</programlisting>
</informalexample>
</para>
<para>
For <literal>cmyk</literal>, parameters <parameter>c1</parameter>,
<parameter>c2</parameter>, <parameter>c3</parameter>, and
<parameter>c4</parameter> are the cyan, magenta, yellow and black
values, respectively.
<informalexample>
<programlisting role="php">
<![CDATA[
// Set fill and stroke colors to white.
pdf_setcolor($pdf, "cmyk", "rgb", 0, 0, 0, 1);
]]>
</programlisting>
</informalexample>
</para>
<para>
For <literal>spot</literal>, <parameter>c1</parameter> should be
a spot color handles returned by <function>pdf_makespotcolor</function>
and <parameter>c2</parameter> is a tint value between 0 and 1.
</para>
<para>
For <literal>pattern</literal>, <parameter>c1</parameter> should be
a pattern handle returned by <function>pdf_begin_pattern</function>.
</para>
</refsect1>
</refentry>