首頁 > 後端開發 > php教程 > 86 php 繪圖體系2

86 php 繪圖體系2

WBOY
發布: 2016-07-29 09:06:32
原創
1016 人瀏覽過

1.畫圓柱體
86 php 绘图体系2

<code><span><span><?php</span><span>//1.画布</span><span>//默认是黑色</span><span>$img</span> = imagecreatetruecolor(<span>400</span>,<span>300</span>);
<span>$white</span> = imagecolorallocate(<span>$img</span>,<span>255</span>,<span>255</span>,<span>255</span>);
imagefill(<span>$img</span>,<span>0</span>,<span>0</span>,<span>$white</span>);

<span>//2.画扇形</span><span>//创建3个颜色</span><span>$red</span> = imagecolorallocate(<span>$img</span>,<span>255</span>,<span>0</span>,<span>0</span>);
<span>$blue</span> = imagecolorallocate(<span>$img</span>,<span>0</span>,<span>0</span>,<span>128</span>);
<span>$gray</span> = imagecolorallocate(<span>$img</span>,<span>192</span>,<span>192</span>,<span>192</span>);
<span>//暗色</span><span>$dardred</span> = imagecolorallocate(<span>$img</span>,<span>144</span>,<span>0</span>,<span>0</span>);
<span>$dardblue</span> = imagecolorallocate(<span>$img</span>,<span>0</span>,<span>0</span>,<span>80</span>);
<span>$dardgray</span> = imagecolorallocate(<span>$img</span>,<span>144</span>,<span>144</span>,<span>144</span>);

<span>for</span>(<span>$i</span>=<span>60</span>;<span>$i</span>>=<span>40</span>;<span>$i</span>--){
    imagefilledarc(<span>$img</span>,<span>100</span>,<span>$i</span>,<span>100</span>,<span>60</span>,<span>0</span>,<span>35</span>,<span>$dardblue</span>,IMG_ARC_PIE);
    imagefilledarc(<span>$img</span>,<span>100</span>,<span>$i</span>,<span>100</span>,<span>60</span>,<span>35</span>,<span>75</span>,<span>$dardgray</span>,IMG_ARC_PIE);
    imagefilledarc(<span>$img</span>,<span>100</span>,<span>$i</span>,<span>100</span>,<span>60</span>,<span>75</span>,<span>360</span>,<span>$dardred</span>,IMG_ARC_PIE);
}

<span>//在上面加个盖,亮色</span>
imagefilledarc(<span>$img</span>,<span>100</span>,<span>40</span>,<span>100</span>,<span>60</span>,<span>0</span>,<span>35</span>,<span>$blue</span>,IMG_ARC_PIE);
imagefilledarc(<span>$img</span>,<span>100</span>,<span>40</span>,<span>100</span>,<span>60</span>,<span>35</span>,<span>75</span>,<span>$gray</span>,IMG_ARC_PIE);
imagefilledarc(<span>$img</span>,<span>100</span>,<span>40</span>,<span>100</span>,<span>60</span>,<span>75</span>,<span>360</span>,<span>$red</span>,IMG_ARC_PIE);

<span>//输出图片</span>
header(<span>'content-type:image/png'</span>);
imagepng(<span>$img</span>);
imagedestroy(<span>$img</span>);
</span></span></code>
登入後複製
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介紹了86 php 繪圖體系2,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板