php-doc-en/reference/image/functions/imagealphablending.xml
Máté Kocsis 593ea510e8
Generate ext/gd methodsynopses based on stubs
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-623.
2021-05-24 13:14:32 +02:00

115 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.imagealphablending" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>imagealphablending</refname>
<refpurpose>Set the blending mode for an image</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>imagealphablending</methodname>
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
<methodparam><type>bool</type><parameter>enable</parameter></methodparam>
</methodsynopsis>
<para>
<function>imagealphablending</function> allows for two different
modes of drawing on truecolor images. In blending mode, the
alpha channel component of the color supplied to all drawing function,
such as <function>imagesetpixel</function> determines how much of the
underlying color should be allowed to shine through. As a result, gd
automatically blends the existing color at that point with the drawing color,
and stores the result in the image. The resulting pixel is opaque. In
non-blending mode, the drawing color is copied literally with its alpha channel
information, replacing the destination pixel. Blending mode is not available
when drawing on palette images.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&gd.image.description;
<varlistentry>
<term><parameter>enable</parameter></term>
<listitem>
<para>
Whether to enable the blending mode or not. On true color images
the default value is &true; otherwise the default value is &false;
</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>
&gd.changelog.image-param;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>imagealphablending</function> usage example</title>
<programlisting role="php">
<![CDATA[
<?php
// Create image
$im = imagecreatetruecolor(100, 100);
// Set alphablending to on
imagealphablending($im, true);
// Draw a square
imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0));
// Output
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
]]>
</programlisting>
</example>
</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
-->