cvs: phpdoc-es /reference/image/functions imageline.xml
| From: | Javier Eguiluz | Date: | Sun, 07 Aug 2005 12:21:17 +0000 |
| Subject: | cvs: phpdoc-es /reference/image/functions imageline.xml | ||
| Groups: | php.doc.es | ||
| Request: | Send a blank email to doc-es+get-1242@lists.php.net to get a copy of this message | ||
javi Sun Aug 7 08:21:17 2005 EDT
Modified files:
/phpdoc-es/reference/image/functions imageline.xml
Log:
- Añadido EN-Revision
- Actualizada la descripcion
- Añadido un ejemplo
http://cvs.php.net/diff.php/phpdoc-es/reference/image/functions/imageline.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc-es/reference/image/functions/imageline.xml
diff -u phpdoc-es/reference/image/functions/imageline.xml:1.1
phpdoc-es/reference/image/functions/imageline.xml:1.2
--- phpdoc-es/reference/image/functions/imageline.xml:1.1 Sun Apr 14 20:14:52 2002
+++ phpdoc-es/reference/image/functions/imageline.xml Sun Aug 7 08:21:16 2005
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- splitted from ./es/functions/image.xml, last change in rev 1.1 -->
-<!-- last change to 'imageline' in en/ tree in rev 1.2 -->
+<!-- $Revision: 1.2 $ -->
+<!-- EN-Revision: 1.7 Maintainer: javi Status: ready -->
+<!-- splitted from ./en/functions/image.xml, last change in rev 1.2 -->
<refentry id="function.imageline">
<refnamediv>
- <refname>ImageLine</refname>
+ <refname>imageline</refname>
<refpurpose>Dibuja una línea</refpurpose>
</refnamediv>
<refsect1>
<title>Descripción</title>
<methodsynopsis>
- <type>int</type><methodname>imageline</methodname>
-
<methodparam><type>int</type><parameter>im</parameter></methodparam>
+ <type>bool</type><methodname>imageline</methodname>
+
<methodparam><type>resource</type><parameter>im</parameter></methodparam>
<methodparam><type>int</type><parameter>x1</parameter></methodparam>
<methodparam><type>int</type><parameter>y1</parameter></methodparam>
<methodparam><type>int</type><parameter>x2</parameter></methodparam>
@@ -18,10 +19,48 @@
<methodparam><type>int</type><parameter>col</parameter></methodparam>
</methodsynopsis>
<para>
- ImageLine dibuja una línea desde x1,y1 hasta x2,y2 (arriba izquierda
- es 0,0) en la imagen im con el color col.</para>
+ <function>imageline</function> dibuja una línea desde
<parameter>x1</parameter>, <parameter>y1</parameter>
+ hasta <parameter>x2</parameter>, <parameter>y2</parameter> (arriba
izquierda
+ es 0,0) en la imagen <parameter>im</parameter> con el color
<parameter>col</parameter>.
+ </para>
+ <example>
+ <title>Dibujar una línea gruesa</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1)
+{
+ /* esta forma solo funciona bien para las lineas ortogonales
+ imagesetthickness($image, $thick);
+ return imageline($image, $x1, $y1, $x2, $y2, $color);
+ */
+ if ($thick == 1) {
+ return imageline($image, $x1, $y1, $x2, $y2, $color);
+ }
+ $t = $thick / 2 - 0.5;
+ if ($x1 == $x2 || $y1 == $y2) {
+ return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t),
round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color);
+ }
+ $k = ($y2 - $y1) / ($x2 - $x1); //y = kx + q
+ $a = $t / sqrt(1 + pow($k, 2));
+ $points = array(
+ round($x1 - (1+$k)*$a), round($y1 + (1-$k)*$a),
+ round($x1 - (1-$k)*$a), round($y1 - (1+$k)*$a),
+ round($x2 + (1+$k)*$a), round($y2 - (1-$k)*$a),
+ round($x2 + (1-$k)*$a), round($y2 + (1+$k)*$a),
+ );
+ imagefilledpolygon($image, $points, 4, $color);
+ return imagepolygon($image, $points, 4, $color);
+}
+
+?>
+]]>
+ </programlisting>
+ </example>
+
<para>
- Vea también <function>imagecreate</function> y
+ Vea también <function>imagecreate</function> y
<function>imagecolorallocate</function>.</para>
</refsect1>
</refentry>