mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Document imagefilter() and add examples.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@163852 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a249209d0c
commit
8cfe821840
1 changed files with 146 additions and 4 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue