zoukankan      html  css  js  c++  java
  • PHP中的绘图技术画比例圆

    <?php
    /*
    燕十八 公益PHP培训    课堂地址:YY频道88354001   学习社区:www.zixue.it 原型图测试文件
    */
    	header('content-type:text/html;charset=utf-8');
    	//POST接受数据
    	$smaller = $_POST['smaller']+0;
    	$middle = $_POST['middle']+0;
    	$college = $_POST['college']+0;
    	$doctor = $_POST['doctor']+0;
    	$all = $smaller+$middle+$college+$doctor;
    	$one = ($smaller/$all)*360;
    	$two = ($middle/$all)*360;
    	$three = ($college/$all)*360;
    	$four = ($doctor/$all)*360;
    	//画布
    	$im = imagecreatetruecolor(300,200);
    	//颜料
    	$color = imagecolorallocate($im,255,255,255);
    	$color1 = imagecolorallocate($im,0,50,40);
    	$color2 = imagecolorallocate($im,0,50,255);
    	$color3 = imagecolorallocate($im,0,250,0);
    	$color4 = imagecolorallocate($im,50,50,30);
    	$color5 = imagecolorallocate($im,255,255,255);
    	$color6 = imagecolorallocate($im,255,255,51);
    	$color7 = imagecolorallocate($im,255,27,255);
    	$color8 = imagecolorallocate($im,25,27,255);
    	$color9 = imagecolorallocate($im,25,27,55);
    	//填充
    	imagefill($im,0,0,$color);
    	//画图
    
    	imagefilledarc($im,102,102,105,105,0,360,$color7,4);
    	imagefilledarc($im,100,100,100,100,0,$one,$color1,0);
    	//画矩形
    	imagefilledrectangle($im,5,5,30,30,$color1);
    	imagefttext($im,5,0,7,20,$color5,'simhei.ttf','小学生');
    
    	imagefilledarc($im,100,100,100,100,$one,$one+$two,$color2,0);
    	//画矩形
    	imagefilledrectangle($im,35,5,60,30,$color2);
    	imagefttext($im,5,0,37,20,$color5,'simhei.ttf','中学生');
    
    	imagefilledarc($im,100,100,100,100,$one+$two,$one+$two+$three,$color3,0);
    	//画矩形
    	imagefilledrectangle($im,65,5,90,30,$color3);
    	imagefttext($im,5,0,67,20,$color5,'simhei.ttf','大学生');
    	
    	imagefilledarc($im,100,100,100,100,$one+$two+$three,$one+$two+$three+$four,$color4,0);
    	//画矩形
    	imagefilledrectangle($im,95,5,120,30,$color4);
    	imagefttext($im,5,0,97,20,$color5,'simhei.ttf','博士生');
    
    	header('content-type:image/jpeg');
    	imagejpeg($im);
    	imagedestroy($im);
    
  • 相关阅读:
    [BZOJ 1012][JSOI2008]最大数maxnumber(线段树)
    [BZOJ 1011][HNOI2008]遥远的行星(奇技淫巧)
    [BZOJ 1010][HNOI2008]玩具装箱toy(斜率优化Dp)
    [HDU 3507]Print Article(斜率优化Dp)
    [BZOJ 1006][HNOI2008]神奇的国度(MCS弦图的染色)
    [ZOJ 1015]Fishing Net(MCS弦图的判定)
    进程的状态及转换
    程序、进程、线程的概念与比较
    ES6 模块化规范
    DNS域名解析过程(详细)
  • 原文地址:https://www.cnblogs.com/luowen/p/2818306.html
Copyright © 2011-2022 走看看