Annotation of embedaddon/php/ext/gd/tests/imagesetbrush_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test imagesetbrush() function : basic functionality
                      3: --CREDITS--
                      4: Erick Belluci Tedeschi <erickbt86 [at] gmail [dot] com>
                      5: #testfest PHPSP on 2009-06-20
                      6: --SKIPIF--
                      7: <?php
                      8: if (!extension_loaded('gd')) {
                      9:        die('skip gd extension is not loaded');
                     10: }
                     11: ?>
                     12: --FILE--
                     13: <?php
                     14: // Create the brush image
                     15: $img = imagecreate(10, 10);
                     16:  
                     17: // Create the main image, 100x100
                     18: $mainimg = imagecreatetruecolor(100, 100);
                     19:   
                     20: $white = imagecolorallocate($img, 255, 0, 0);
                     21: imagefilledrectangle($img, 0, 0, 299, 99, $white);
                     22: 
                     23: // Set the brush
                     24: imagesetbrush($mainimg, $img);
                     25:    
                     26: // Draw a couple of brushes, each overlaying each
                     27: imageline($mainimg, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
                     28: 
                     29: // Get output and generate md5 hash
                     30: ob_start();
                     31: imagepng($mainimg, null, 9);
                     32: $result_image = ob_get_contents();
                     33: ob_end_clean();
                     34: echo md5(base64_encode($result_image));
                     35: ?>
                     36: --EXPECT--
                     37: 8168577c0d1fe6d9d11397cb15263d82

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>