dave Wed Jul 21 04:00:06 2004 EDT
Modified files:
/phpdoc/en/reference/image/functions imagefilter.xml
Log:
- Document imagefilter() and add examples.
http://cvs.php.net/diff.php/phpdoc/en/reference/image/functions/imagefilter.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/image/functions/imagefilter.xml
diff -u phpdoc/en/reference/image/functions/imagefilter.xml:1.2
phpdoc/en/reference/image/functions/imagefilter.xml:1.3
--- phpdoc/en/reference/image/functions/imagefilter.xml:1.2 Mon Apr 12 18:58:32
2004
+++ phpdoc/en/reference/image/functions/imagefilter.xml Wed Jul 21 04:00:06 2004
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='iso-8859-1'?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="function.imagefilter">
<refnamediv>
<refname>imagefilter</refname>
<refpurpose>
- Applies Filter an image using a custom angle
+ Applies a filter to an image
</refpurpose>
</refnamediv>
<refsect1>
@@ -15,9 +15,151 @@
<methodparam><type>int</type><parameter>filtertype</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>args</parameter></methodparam>
</methodsynopsis>
+ <para>
+ <function>imagefilter</function> applies the filter
+ <parameter>filtertype</parameter> to the image, using
+ <parameter>args</parameter> where necessary.
+ </para>
+ <para>
+ <parameter>filtertype</parameter> can be one of the following:
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_NEGATE</parameter>: Reverses all colors of
+ the image.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_GRAYSCALE</parameter>: Converts the image into
+ grayscale.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_BRIGHTNESS</parameter>: Changes the brightness
+ of the image. Use <parameter>args</parameter> to set the level of
+ brightness.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_CONTRAST</parameter>: Changes the contrast of
+ the image. Use <parameter>args</parameter> to set the level of
+ contrast.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_COLORIZE</parameter>: Like
+ <parameter>IMG_FILTER_GRAYSCALE</parameter>, except you can specify the
+ color. Use 3 separate <parameter>args</parameter>, in the form of
+ <parameter>red</parameter>, <parameter>blue</parameter>,
+ <parameter>green</parameter>. The range for each color is 0 to 255.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_EDGEDETECT</parameter>: Uses edge detection to
+ highlight the edges in the image.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_EMBOSS</parameter>: Embosses the image.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_GAUSSIAN_BLUR</parameter>: Blurs the image using
+ the Gaussian method.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_SELECTIVE_BLUR</parameter>: Blurs the image.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_MEAN_REMOVAL</parameter>: Uses mean removal to
+ achieve a "sketchy" effect.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <parameter>IMG_FILTER_SMOOTH</parameter>: Makes the image smoother.
+ Use <parameter>args</parameter> to set the level of smoothness.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </para>
+ ¬e.bundled.gd;
+ <para>
+ &return.success;
+ </para>
+ <para>
+ <example>
+ <title><function>imagefilter</function> grayscale example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$im = imagecreatefrompng('dave.png');
+if ($im && imagefilter($im, IMG_FILTER_GRAYSCALE)) {
+ echo 'Image converted to grayscale.';
+ imagepng($im, 'dave.png');
+} else {
+ echo 'Conversion to grayscale failed.';
+}
- &warn.undocumented.func;
- ¬e.bundled.gd;
+imagedestroy($im);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title><function>imagefilter</function> brightness example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$im = imagecreatefrompng('sean.png');
+if ($im && imagefilter($im, IMG_FILTER_BRIGHTNESS, 20)) {
+ echo 'Image brightness changed.';
+ imagepng($im, 'sean.png');
+} else {
+ echo 'Image brightness change failed.';
+}
+
+imagedestroy($im);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <para>
+ <example>
+ <title><function>imagefilter</function> colorize example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$im = imagecreatefrompng('philip.png');
+
+/* R, G, B, so 0, 255, 0 is green */
+if ($im && imagefilter($im, IMG_FILTER_COLORIZE, 0, 255, 0)) {
+ echo 'Image successfully shaded green.';
+ imagepng($im, 'philip.png');
+} else {
+ echo 'Green shading failed.';
+}
+
+imagedestroy($im);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
</refentry>