php-doc-en/reference/pdf/functions/pdf-setcolor.xml
2004-08-13 12:05:17 +00:00

103 lines
3.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/pdf.xml, last change in rev 1.42 -->
<refentry id="function.pdf-setcolor">
<refnamediv>
<refname>pdf_setcolor</refname>
<refpurpose>Sets fill and stroke color</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>pdf_setcolor</methodname>
<methodparam><type>resource</type><parameter>pdfdoc</parameter></methodparam>
<methodparam><type>string</type><parameter>type</parameter></methodparam>
<methodparam><type>string</type><parameter>colorspace</parameter></methodparam>
<methodparam><type>float</type><parameter>c1</parameter></methodparam>
<methodparam><type>float</type><parameter>c2</parameter></methodparam>
<methodparam><type>float</type><parameter>c3</parameter></methodparam>
<methodparam><type>float</type><parameter>c4</parameter></methodparam>
</methodsynopsis>
<para>
Set the current color space and color. &return.success;
The parameter <parameter>type</parameter> can be <literal>fill</literal>,
<literal>stroke</literal> or <literal>both</literal> 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.
Parameters <parameter>c2</parameter>, <parameter>c3</parameter> and
<parameter>c4</parameter> were optional before PHP 5.
</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[
<?php
// 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[
<?php
// Set fill and stroke colors to black.
pdf_setcolor($pdf, "both", "cmyk", 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>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->