[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phpdoc/en/trunk/reference/imagick/_examples.xml?=
From: Sherif_Ramadan <googleguy () php ! net>
Date: 2012-12-16 19:55:38
Message-ID: svn-googleguy-1355687738-328795-1599211966 () svn ! php ! net
[Download RAW message or body]
googleguy Sun, 16 Dec 2012 19:55:38 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=328795
Log:
Lets try this one more time. The imagick example with the image file having gone to revision 328794.
Changed paths:
U phpdoc/en/trunk/reference/imagick/examples.xml
Modified: phpdoc/en/trunk/reference/imagick/examples.xml
===================================================================
--- phpdoc/en/trunk/reference/imagick/examples.xml 2012-12-16 19:53:18 UTC (rev 328794)
+++ phpdoc/en/trunk/reference/imagick/examples.xml 2012-12-16 19:55:38 UTC (rev 328795)
@@ -209,6 +209,64 @@
</programlisting>
</example>
</para>
+ <para>
+ Working with ellipse primitive and custom fonts
+ <example>
+ <title>Create a PHP logo</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+/* Set width and height in proportion of genuine PHP logo */
+$width = 400;
+$height = 210;
+
+/* Create an Imagick object with transparent canvas */
+$img = new Imagick();
+$img->newImage($width, $height, new ImagickPixel('transparent'));
+
+/* New ImagickDraw instance for ellipse draw */
+$draw = new ImagickDraw();
+/* Set purple fill color for ellipse */
+$draw->setFillColor('#777bb4');
+/* Set ellipse dimensions */
+$draw->ellipse($width / 2, $height / 2, $width / 2, $height / 2, 0, 360);
+/* Draw ellipse onto the canvas */
+$img->drawImage($draw);
+
+/* Reset fill color from purple to black for text (note: we are reusing ImagickDraw object) */
+$draw->setFillColor('black');
+/* Set stroke border to white color */
+$draw->setStrokeColor('white');
+/* Set stroke border thickness */
+$draw->setStrokeWidth(2);
+/* Set font kerning (negative value means that letters are closer to each other) */
+$draw->setTextKerning(-8);
+/* Set font and font size used in PHP logo */
+$draw->setFont('Handel Gothic.ttf');
+$draw->setFontSize(150);
+/* Center text horizontally and vertically */
+$draw->setGravity(Imagick::GRAVITY_CENTER);
+
+/* Add center "php" with Y offset of -10 to canvas (inside ellipse) */
+$img->annotateImage($draw, 0, -10, 0, 'php');
+$img->setImageFormat('png');
+
+/* Set appropriate header for PNG and output the image */
+header('Content-Type: image/png');
+echo $img;
+?>
+
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <mediaobject>
+ <alt>Output of example : Creating PHP logo with Imagick</alt>
+ <imageobject>
+ <imagedata fileref="en/reference/imagick/figures/php_logo.png"/>
+ </imageobject>
+ </mediaobject>
+ </example>
+ </para>
</section>
</chapter>
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic