国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

PHP生成3D的百分比圖形統計效果

2024-09-04 11:44:21
字體:
來源:轉載
供稿:網友

本程序是根據用戶提供的數據生成3D效果的百分比圖片統計效果,實例代碼如下:

  1. $image = imagecreatetruecolor(200,200);  //創建一張200*200的畫布; 
  2.  
  3. //創建多種又區分的顏色 
  4. $red = imagecolorallocate($image,255,0,0); 
  5. $blue  = imagecolorallocate($image,0,0,255); 
  6. $yellow = imagecolorallocate($image,255,255,0); 
  7. $violet = imagecolorallocate($image,255,0,255); 
  8. $white = imagecolorallocate($image,255,255,255); 
  9. $black = imagecolorallocate($image,0,0,0); 
  10.  
  11. //使用for循環創建3d效果底層效果 
  12. for($i=120;$i>100;$i--){ 
  13.     imagefilledarc($image,100,$i,200,120,0,30,$red,img_arc_pie);//img_arc_pie注釋如下: 
  14.  
  15.     imagefilledarc($image,100,$i,200,120,30,80,$blue,img_arc_pie); 
  16.     imagefilledarc($image,100,$i,200,120,80,360,$yellow,img_arc_pie); 
  17. //bool imagefilledarc ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style ) 
  18. // 
  19. //imagefilledarc() 在 image 所代表的圖像中以 cx,cy(圖像左上角為 0, 0)畫一橢圓弧。如果成功則返回 true,失敗則返回 false。w 和 h 分別指定了橢圓的寬和高,s 和 e 參數以角度指定了起始和結束點。style 可以是下列值按位或(or)后的值: 
  20. // 
  21. //img_arc_pie 
  22. // 
  23. //img_arc_chord 
  24. // 
  25. //img_arc_nofill 
  26. // 
  27. //img_arc_edged 
  28.  
  29. //這個層是最上面一層的效果,這樣立體效果就出來了! 
  30.     imagearc($image,100,100,200,120,0,360,$black);//添加一個黑色的邊圈,這樣3d效果看起來更加明顯點 
  31.     imagefilledarc($image,100,100,200,120,0,30,$red,img_arc_pie); 
  32.     imagefilledarc($image,100,100,200,120,30,80,$blue,img_arc_pie); 
  33.     imagefilledarc($image,100,100,200,120,80,360,$yellow,img_arc_pie); 
  34.  
  35. //添加百分比數據,當然此處必要的時候可以批量的進行一定的運算將輸入輸入到圖片上 
  36.     $str = iconv ("gbk","utf-8","36%");//如果要輸入中文需要此轉換。example:占用:30%; 
  37.     imagettftext($image,10,360-15,100+70,115,$white,"simhei.ttf",$str); 
  38. //開源代碼Vevb.com 
  39. imagejpeg($image); 
  40. imagedestroy($image); 
  41.   

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南木林县| 买车| 鸡西市| 台北市| 土默特右旗| 扶沟县| 杭州市| 子洲县| 大厂| 中西区| 虞城县| 安龙县| 若尔盖县| 独山县| 临高县| 安阳县| 逊克县| 介休市| 贡觉县| 葫芦岛市| 辛集市| 桃源县| 新宾| 巴彦淖尔市| 凤阳县| 海口市| 房产| 怀安县| 龙泉市| 桓台县| 蕉岭县| 蒙自县| 当阳市| 北碚区| 莱州市| 安宁市| 轮台县| 湛江市| 二连浩特市| 泽库县| 伊春市|