国产探花免费观看_亚洲丰满少妇自慰呻吟_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.   

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 客服| 怀集县| 周口市| 桐庐县| 四子王旗| 米林县| 伊川县| 商丘市| 青州市| 清河县| 威海市| 唐山市| 兴仁县| 临沭县| 通海县| 铜山县| 乌拉特前旗| 饶平县| 甘肃省| 博客| 永和县| 西华县| 公安县| 昌乐县| 房山区| 合川市| 新郑市| 金湖县| 黔西县| 茌平县| 阿拉善右旗| 通化县| 咸宁市| 宁陕县| 临城县| 平乡县| 定边县| 沙洋县| 九台市| 苏州市| 日土县|