php-doc-en/reference/image/functions/imageantialias.xml
2020-10-09 13:59:15 +00:00

150 lines
3.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.imageantialias" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>imageantialias</refname>
<refpurpose>Should antialias functions be used or not</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>imageantialias</methodname>
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
<methodparam><type>bool</type><parameter>enabled</parameter></methodparam>
</methodsynopsis>
<para>
Activate the fast drawing antialiased methods for lines and wired polygons.
It does not support alpha components. It works using a direct blend
operation. It works only with truecolor images.
</para>
<para>
Thickness and styled are not supported.
</para>
<para>
Using antialiased primitives with transparent background color can end with
some unexpected results. The blend method uses the background color as any
other colors. The lack of alpha component support does not allow an alpha
based antialiasing method.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&gd.image.description;
<varlistentry>
<term><parameter>enabled</parameter></term>
<listitem>
<para>
Whether to enable antialiasing or not.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>7.2.0</entry>
<entry>
<function>imageantialias</function> is now generally available. Formerly
it was only available if PHP was compiled with the bundled version of the
GD library.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A comparison of two lines, one with anti-aliasing switched on</title>
<programlisting role="php">
<![CDATA[
<?php
// Setup an anti-aliased image and a normal image
$aa = imagecreatetruecolor(400, 100);
$normal = imagecreatetruecolor(200, 100);
// Switch antialiasing on for one image
imageantialias($aa, true);
// Allocate colors
$red = imagecolorallocate($normal, 255, 0, 0);
$red_aa = imagecolorallocate($aa, 255, 0, 0);
// Draw two lines, one with AA enabled
imageline($normal, 0, 0, 200, 100, $red);
imageline($aa, 0, 0, 200, 100, $red_aa);
// Merge the two images side by side for output (AA: left, Normal: Right)
imagecopymerge($aa, $normal, 200, 0, 0, 0, 200, 100, 100);
// Output image
header('Content-type: image/png');
imagepng($aa);
imagedestroy($aa);
imagedestroy($normal);
?>
]]>
</programlisting>
&example.outputs.similar;
<mediaobject>
<alt>Output of example : A comparison of two lines, one with anti-aliasing switched on</alt>
<imageobject>
<imagedata fileref="en/reference/image/figures/imageantialias.png"/>
</imageobject>
</mediaobject>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>imagecreatetruecolor</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->