cvs: phpdoc /en/reference/imagick/imagick distortimage.xml

From: Date: Wed, 04 Feb 2009 13:17:42 +0000
Subject: cvs: phpdoc /en/reference/imagick/imagick distortimage.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3143@lists.php.net to get a copy of this message
mkoppanen Wed Feb 4 13:17:42 2009 UTC Modified files: /phpdoc/en/reference/imagick/imagick distortimage.xml Log: Improved the distortion example http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/imagick/imagick/distortimage.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/imagick/imagick/distortimage.xml diff -u phpdoc/en/reference/imagick/imagick/distortimage.xml:1.3 phpdoc/en/reference/imagick/imagick/distortimage.xml:1.4 --- phpdoc/en/reference/imagick/imagick/distortimage.xml:1.3 Tue Dec 16 03:10:27 2008 +++ phpdoc/en/reference/imagick/imagick/distortimage.xml Wed Feb 4 13:17:42 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.imagick-distortimage"> <refnamediv> <refname>Imagick::distortImage</refname> @@ -90,13 +90,40 @@ <programlisting role="php"> <![CDATA[ <?php +/* Create new object */ +$im = new Imagick(); -$im = new imagick( "example.jpg" ); +/* Create new checkerboard pattern */ +$im->newPseudoImage(100, 100, "pattern:checkerboard"); -$im->distortImage( Imagick::DISTORTION_PERSPECTIVE, array( 7,40, 4,30, 4,124, 4,123, 85,122, 100,123, 85,2, 100,30 ), true ); +/* Set the image format to png */ +$im->setImageFormat('png'); -$im->writeImage( "example_out.jpg" ); +/* Fill new visible areas with transparent */ +$im->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); +/* Activate matte */ +$im->setImageMatte(true); + +/* Control points for the distortion */ +$controlPoints = array( 10, 10, + 10, 5, + + 10, $im->getImageHeight() - 20, + 10, $im->getImageHeight() - 5, + + $im->getImageWidth() - 10, 10, + $im->getImageWidth() - 10, 20, + + $im->getImageWidth() - 10, $im->getImageHeight() - 10, + $im->getImageWidth() - 10, $im->getImageHeight() - 30); + +/* Perform the distortion */ +$im->distortImage(Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true); + +/* Ouput the image */ +header("Content-Type: image/png"); +echo $im; ?> ]]> </programlisting>

« previous php.doc.cvs (#3143) next »