<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >imagefilledarc</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Image 图像函数" HREF="ref.image.html"><LINK REL="PREVIOUS" TITLE="imagefill" HREF="function.imagefill.html"><LINK REL="NEXT" TITLE="imagefilledellipse" HREF="function.imagefilledellipse.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.imagefill.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.imagefilledellipse.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.imagefilledarc" ></A >imagefilledarc</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN88317" ></A ><P > (PHP 4 >= 4.0.6, PHP 5)</P >imagefilledarc -- 画一椭圆弧且填充</DIV ><DIV CLASS="refsect1" ><A NAME="AEN88320" ></A ><H2 >说明</H2 >bool <B CLASS="methodname" >imagefilledarc</B > ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style )<BR ></BR ><P > <B CLASS="function" >imagefilledarc()</B > 在 <CODE CLASS="parameter" >image</CODE > 所代表的图像中以 <CODE CLASS="parameter" >cx</CODE >,<CODE CLASS="parameter" >cy</CODE >(图像左上角为 0, 0)画一椭圆弧。如果成功则返回 <TT CLASS="constant" ><B >TRUE</B ></TT >,失败则返回 <TT CLASS="constant" ><B >FALSE</B ></TT >。<CODE CLASS="parameter" >w</CODE > 和 <CODE CLASS="parameter" >h</CODE > 分别指定了椭圆的宽和高,<CODE CLASS="parameter" >s</CODE > 和 <CODE CLASS="parameter" >e</CODE > 参数以角度指定了起始和结束点。<CODE CLASS="parameter" >style</CODE > 可以是下列值按位或(OR)后的值: <P ></P ><OL TYPE="1" ><LI ><P ><TT CLASS="constant" ><B >IMG_ARC_PIE</B ></TT ></P ></LI ><LI ><P ><TT CLASS="constant" ><B >IMG_ARC_CHORD</B ></TT ></P ></LI ><LI ><P ><TT CLASS="constant" ><B >IMG_ARC_NOFILL</B ></TT ></P ></LI ><LI ><P ><TT CLASS="constant" ><B >IMG_ARC_EDGED</B ></TT ></P ></LI ></OL > <TT CLASS="constant" ><B >IMG_ARC_PIE</B ></TT > 和 <TT CLASS="constant" ><B >IMG_ARC_CHORD</B ></TT > 是互斥的;<TT CLASS="constant" ><B >IMG_ARC_CHORD</B ></TT > 只是用直线连接了起始和结束点,<TT CLASS="constant" ><B >IMG_ARC_PIE</B ></TT > 则产生圆形边界(如果两个都用,<TT CLASS="constant" ><B >IMG_ARC_CHORD</B ></TT > 生效)。<TT CLASS="constant" ><B >IMG_ARC_NOFILL</B ></TT > 指明弧或弦只有轮廓,不填充。<TT CLASS="constant" ><B >IMG_ARC_EDGED</B ></TT > 指明用直线将起始和结束点与中心点相连,和 <TT CLASS="constant" ><B >IMG_ARC_NOFILL</B ></TT > 一起使用是画饼状图轮廓的好方法(而不用填充)。 </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN88386" ></A ><P ><B >例 1. 创建一 3D 效果的饼状图</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// create image<br /></font><font color="#0000BB">$image </font><font color="#007700">= </font><font color="#0000BB">imagecreatetruecolor</font><font color="#007700">(</font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// allocate some solors<br /></font><font color="#0000BB">$white </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0xFF</font><font color="#007700">, </font><font color="#0000BB">0xFF</font><font color="#007700">, </font><font color="#0000BB">0xFF</font><font color="#007700">);<br /></font><font color="#0000BB">$gray </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0xC0</font><font color="#007700">, </font><font color="#0000BB">0xC0</font><font color="#007700">, </font><font color="#0000BB">0xC0</font><font color="#007700">);<br /></font><font color="#0000BB">$darkgray </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0x90</font><font color="#007700">, </font><font color="#0000BB">0x90</font><font color="#007700">, </font><font color="#0000BB">0x90</font><font color="#007700">);<br /></font><font color="#0000BB">$navy </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x80</font><font color="#007700">);<br /></font><font color="#0000BB">$darknavy </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x50</font><font color="#007700">);<br /></font><font color="#0000BB">$red </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0xFF</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">);<br /></font><font color="#0000BB">$darkred </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">0x90</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">, </font><font color="#0000BB">0x00</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// make the 3D effect<br /></font><font color="#007700">for (</font><font color="#0000BB">$i </font><font color="#007700">= </font><font color="#0000BB">60</font><font color="#007700">; </font><font color="#0000BB">$i </font><font color="#007700">> </font><font color="#0000BB">50</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">--) {<br /> </font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">45</font><font color="#007700">, </font><font color="#0000BB">$darknavy</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br /> </font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">45</font><font color="#007700">, </font><font color="#0000BB">75 </font><font color="#007700">, </font><font color="#0000BB">$darkgray</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br /> </font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">$i</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">75</font><font color="#007700">, </font><font color="#0000BB">360 </font><font color="#007700">, </font><font color="#0000BB">$darkred</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br />}<br /><br /></font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">45</font><font color="#007700">, </font><font color="#0000BB">$navy</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br /></font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">45</font><font color="#007700">, </font><font color="#0000BB">75 </font><font color="#007700">, </font><font color="#0000BB">$gray</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br /></font><font color="#0000BB">imagefilledarc</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">100</font><font color="#007700">, </font><font color="#0000BB">50</font><font color="#007700">, </font><font color="#0000BB">75</font><font color="#007700">, </font><font color="#0000BB">360 </font><font color="#007700">, </font><font color="#0000BB">$red</font><font color="#007700">, </font><font color="#0000BB">IMG_ARC_PIE</font><font color="#007700">);<br /><br /><br /></font><font color="#FF8000">// flush image<br /></font><font color="#0000BB">header</font><font color="#007700">(</font><font color="#DD0000">'Content-type: image/png'</font><font color="#007700">);<br /></font><font color="#0000BB">imagepng</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">);<br /></font><font color="#0000BB">imagedestroy</font><font color="#007700">(</font><font color="#0000BB">$image</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B >本函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。</P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.imagefill.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.imagefilledellipse.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >imagefill</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.image.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >imagefilledellipse</TD ></TR ></TABLE ></DIV ></BODY ></HTML >