Home > Backend Development > PHP Tutorial > 86 php drawing system 2

86 php drawing system 2

WBOY
Release: 2016-07-29 09:06:32
Original
1014 people have browsed it

1. Draw a cylinder
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>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the 86 php drawing system 2, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template