cvs: phpdoc /en/reference/imagick examples.xml
| From: | Mikko Koppanen | Date: | Thu, 17 Apr 2008 11:31:53 +0000 |
| Subject: | cvs: phpdoc /en/reference/imagick examples.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-1515@lists.php.net to get a copy of this message | ||
mkoppanen Thu Apr 17 11:31:53 2008 UTC
Modified files:
/phpdoc/en/reference/imagick examples.xml
Log:
Added new example to examples page
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/imagick/examples.xml?r1=1.2&r2=1.3&diff_format=u
Index: phpdoc/en/reference/imagick/examples.xml
diff -u phpdoc/en/reference/imagick/examples.xml:1.2 phpdoc/en/reference/imagick/examples.xml:1.3
--- phpdoc/en/reference/imagick/examples.xml:1.2 Sun Dec 23 20:12:42 2007
+++ phpdoc/en/reference/imagick/examples.xml Thu Apr 17 11:31:53 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<chapter xml:id="imagick.examples" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
@@ -112,6 +112,59 @@
</programlisting>
</example>
</para>
+ <para>
+ This example illustrates how to use fill patterns during drawing.
+ <example>
+ <title>Filling text with gradient</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+/* Create a new imagick object */
+$im = new Imagick();
+
+/* Create new image. This will be used as fill pattern */
+$im->newPseudoImage(50, 50, "gradient:red-black");
+
+/* Create imagickdraw object */
+$draw = new ImagickDraw();
+
+/* Start a new pattern called "gradient" */
+$draw->pushPattern('gradient' , 0 , 0 , 50 , 50);
+
+/* Composite the gradient on the pattern */
+$draw->composite(Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im);
+
+/* Close the pattern */
+$draw->popPattern();
+
+/* Use the pattern called "gradient" as the fill */
+$draw->setFillPatternURL('#gradient');
+
+/* Set font size to 52 */
+$draw->setFontSize(52);
+
+/* Annotate some text */
+$draw->annotation(50, 50, "Hello World!");
+
+/* Create a new canvas and white image */
+$canvas = new Imagick();
+$canvas->newImage(350, 200, "white");
+
+/* Draw the ImagickDraw on to the canvas */
+$canvas->drawImage($draw);
+
+/* Set the format to PNG */
+$canvas->setImageFormat('png');
+
+/* Output the image */
+header("Content-Type: image/png");
+echo $canvas;
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
</section>
</chapter>