Files
doc-fr/reference/image/functions/imagecolorat.xml
2021-09-24 04:13:47 +01:00

166 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 593ea510e853ff034e03f78a4be0daa41661c9d4 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id="function.imagecolorat" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>imagecolorat</refname>
<refpurpose>Retourne l'index de la couleur d'un pixel donné</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>int</type><type>false</type></type><methodname>imagecolorat</methodname>
<methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
<methodparam><type>int</type><parameter>x</parameter></methodparam>
<methodparam><type>int</type><parameter>y</parameter></methodparam>
</methodsynopsis>
<para>
Retourne l'index de la couleur du pixel situé aux coordonnées spécifiées,
dans l'image <parameter>image</parameter>.
</para>
<para>
Si l'image
est une image en TrueColor, cette fonction retourne la valeur RGB
du pixel, sous forme d'un entier. Utiliser les opérateurs de bits et les
masques pour distinguer le rouge, du vert et du bleu :
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&gd.image.description;
<varlistentry>
<term><parameter>x</parameter></term>
<listitem>
<para>
X : coordonnée du point.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>y</parameter></term>
<listitem>
<para>
Y : coordonnée du point.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne l'index de la couleur &return.falseforfailure;.
</para>
&return.falseproblem;
</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;
<para>
<example>
<title>Accès aux valeurs RGB</title>
<programlisting role="php">
<![CDATA[
<?php
$im = imagecreatefrompng("php.png");
$rgb = imagecolorat($im, 10, 15);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
var_dump($r, $g, $b);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
int(119)
int(123)
int(180)
]]>
</screen>
</example>
<example>
<title>Valeurs RVB lisibles en utilisant la fonction
<function>imagecolorsforindex</function></title>
<programlisting role="php">
<![CDATA[
<?php
$im = imagecreatefrompng("php.png");
$rgb = imagecolorat($im, 10, 15);
$colors = imagecolorsforindex($im, $rgb);
var_dump($colors);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(4) {
["red"]=>
int(119)
["green"]=>
int(123)
["blue"]=>
int(180)
["alpha"]=>
int(127)
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>imagecolorset</function></member>
<member><function>imagecolorsforindex</function></member>
<member><function>imagesetpixel</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
-->