1--TEST-- 2imagedashedline() 3--EXTENSIONS-- 4gd 5--SKIPIF-- 6<?php 7 if (!function_exists('imagedashedline')) die('skip imagedashedline() not available'); 8?> 9--FILE-- 10<?php 11 12echo "Simple test of imagedashedline() function\n"; 13 14$dest = dirname(realpath(__FILE__)) . '/imagedashedline.png'; 15 16// create a blank image 17$image = imagecreatetruecolor(250, 250); 18 19// set the background color to black 20$bg = imagecolorallocate($image, 0, 0, 0); 21 22// red dashed lines 23$col_line = imagecolorallocate($image, 255, 0, 0); 24 25// draw a couple of vertical dashed lines 26imagedashedline($image, 100, 20, 100, 230, $col_line ); 27imagedashedline($image, 150, 20, 150, 230, $col_line ); 28 29// output the picture to a file 30imagepng($image, $dest); 31 32//check color of a point on edge.. 33$col1 = imagecolorat($image, 100, 230); 34// ..and a point on background 35$col2 = imagecolorat($image, 5, 5); 36 37$color1 = imagecolorsforindex($image, $col1); 38$color2 = imagecolorsforindex($image, $col2); 39var_dump($color1, $color2); 40 41imagedestroy($image); 42echo "Done\n"; 43?> 44--CLEAN-- 45<?php 46 $dest = dirname(realpath(__FILE__)) . '/imagedashedline.png'; 47 @unlink($dest); 48?> 49--EXPECT-- 50Simple test of imagedashedline() function 51array(4) { 52 ["red"]=> 53 int(255) 54 ["green"]=> 55 int(0) 56 ["blue"]=> 57 int(0) 58 ["alpha"]=> 59 int(0) 60} 61array(4) { 62 ["red"]=> 63 int(0) 64 ["green"]=> 65 int(0) 66 ["blue"]=> 67 int(0) 68 ["alpha"]=> 69 int(0) 70} 71Done 72