1 <?php 2 /** 3 * 图形绘制 4 * 绘画复杂图形 5 * 6 */ 7 8 //$im = imagecreatetruecolor(400, 200); 9 //$back = imagecolorallocate($im, mt_rand(200, 255), mt_rand(200, 255), mt_rand(200, 255)); 10 11 //imagefill($im, 0, 0, $back); 12 13 //画点 14 //$black = imagecolorallocate($im,10,10,10); 15 //for($i=0;$i<150;$i++) 16 //{ 17 // imagesetpixel($im,mt_rand(10,390),mt_rand(10,190),$black); 18 //} 19 20 //画线 21 //$red = imagecolorallocate($im, 10, 0, 0); 22 //for($j = 0; $j < 3; $j++) 23 //{ 24 // imageline($im, mt_rand(10, 400), mt_rand(10, 200), mt_rand(10, 400), mt_rand(10, 200), $red); 25 26 //} 27 28 //设置线条粗细 29 //imagesetthickness($im,5); 30 //imageline($im, mt_rand(10, 400), mt_rand(10, 200), mt_rand(10, 400), mt_rand(10, 200), $red); 31 32 //$style = array($red,$red,$red,$red,$red,$back,$back,$back,$back,$back); 33 34 //设置划线的风格 35 //imagesetstyle($im,$style); 36 37 //设置划线的风格 38 //imageline($im,10,50,250,200,IMG_COLOR_STYLED); 39 40 //画矩形 41 //imagerectangle($im,50,50,150,150,$red); 42 43 //画圆 44 //imageellipse($im,200,100,100,100,$red); 45 46 //header('Content-Type:image/jpeg'); 47 //imagejpeg($im, null, 70);