Annotation of embedaddon/php/ext/gd/tests/imagedashedline_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: imagedashedline()
! 3: --SKIPIF--
! 4: <?php
! 5: if (!function_exists('imagedashedline')) die('skip imagedashedline() not available');
! 6: if (!(imagetype() & IMG_PNG)) die('skip PNG Support is not enabled');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10:
! 11: /* Prototype : bool imagedashedline ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )
! 12: * Description: Draws a dashed line.
! 13: * This function is deprecated. Use combination of imagesetstyle() and imageline() instead.
! 14: * Source code: ext/standard/image.c
! 15: * Alias to functions:
! 16: */
! 17:
! 18:
! 19: echo "Simple test of imagedashedline() function\n";
! 20:
! 21: $dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
! 22:
! 23: // create a blank image
! 24: $image = imagecreatetruecolor(250, 250);
! 25:
! 26: // set the background color to black
! 27: $bg = imagecolorallocate($image, 0, 0, 0);
! 28:
! 29: // red dashed lines
! 30: $col_line = imagecolorallocate($image, 255, 0, 0);
! 31:
! 32: // draw a couple of vertical dashed lines
! 33: imagedashedline($image, 100, 20, 100, 230, $col_line );
! 34: imagedashedline($image, 150, 20, 150, 230, $col_line );
! 35:
! 36: // output the picture to a file
! 37: imagepng($image, $dest);
! 38:
! 39: //check color of a point on edge..
! 40: $col1 = imagecolorat($image, 100, 230);
! 41: // ..and a point on background
! 42: $col2 = imagecolorat($image, 5, 5);
! 43:
! 44: $color1 = imagecolorsforindex($image, $col1);
! 45: $color2 = imagecolorsforindex($image, $col2);
! 46: var_dump($color1, $color2);
! 47:
! 48: imagedestroy($image);
! 49: echo "Done\n";
! 50: ?>
! 51: --CLEAN--
! 52: <?php
! 53: $dest = dirname(realpath(__FILE__)) . '/imagedashedline.png';
! 54: @unlink($dest);
! 55: ?>
! 56: --EXPECT--
! 57: Simple test of imagedashedline() function
! 58: array(4) {
! 59: ["red"]=>
! 60: int(255)
! 61: ["green"]=>
! 62: int(0)
! 63: ["blue"]=>
! 64: int(0)
! 65: ["alpha"]=>
! 66: int(0)
! 67: }
! 68: array(4) {
! 69: ["red"]=>
! 70: int(0)
! 71: ["green"]=>
! 72: int(0)
! 73: ["blue"]=>
! 74: int(0)
! 75: ["alpha"]=>
! 76: int(0)
! 77: }
! 78: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>