_x = $x; $this->_y = $y; $this->_h = $h; $this->_l = $l; $this->_w = $w; $this->_srcpoints = $this->getsrcpoints(); $this->_points = $this->getpoints(); } public function getsrcpoints() { return array( array($this->_x , $this->_y), array($this->_x $this->_l , $this->_y), array($this->_x (1.35*$this->_l), $this->_y-(0.35*$this->_l)), array($this->_x (0.35*$this->_l), $this->_y-(0.35*$this->_l)), array($this->_x , $this->_y $this->_h), array($this->_x $this->_l , $this->_y $this->_h), array($this->_x (1.35*$this->_l), $this->_y $this->_h-(0.35*$this->_l)) ); } public function getpoints() { $points = array(); foreach($this->_srcpoints as $key => $val) { $points[] = $val[0]; $points[] = $val[1]; } return $points; } public function gettoppoints() { return array_slice($this->_points, 0, 8); //顶坐标 } public function getbelowpoints() { return array_merge(array_slice($this->_points, 0, 2), array_slice($this->_points, 8, 4), array_slice($this->_points, 2, 2)); //下坐标 } public function getrightsidepoints() { return array_merge(array_slice($this->_points, 2, 2), array_slice($this->_points, 10, 4), array_slice($this->_points, 4, 2)); //右侧坐标 } public function draw($image, $topcolor, $belowcolor, $sidecolor, $bordercolor = null, $type = left) { if (is_null($bordercolor)) { $bordercolor = 0xcccccc; } $top_rgb = $this->getrgb($topcolor); $below_rgb = $this->getrgb($belowcolor); $side_rgb = $this->getrgb($sidecolor); $top_color = imagecolorallocate($image, $top_rgb[r], $top_rgb[g], $top_rgb[b]); $below_color = imagecolorallocate($image, $below_rgb[r], $below_rgb[g], $below_rgb[b]); $side_color = imagecolorallocate($image, $side_rgb[r], $side_rgb[g], $side_rgb[b]); imagefilledpolygon($image, $this->gettoppoints(), 4, $top_color); //画顶面 imagepolygon($image, $this->gettoppoints(), 4, $bordercolor); //画顶面边线 imagefilledpolygon($image, $this->getbelowpoints(), 4, $below_color); //画下面 imagepolygon($image, $this->getbelowpoints(), 4, $bordercolor); //画下面边线 if ($type == left) { imagefilledpolygon($image, $this->getrightsidepoints(), 4, $side_color); //画右侧面 imagepolygon($image, $this->getrightsidepoints(), 4, $bordercolor); //画侧面边线 } } public function getrgb($color) { $ar = array(); $color = hexdec($color); $ar[r] = ($color>>16) & 0xff; $ar[g] = ($color>>8) & 0xff; $ar[b] = ($color) & 0xff; return $ar; }}class bardate{ private $_w; private $_h; private $_bgcolor = ffffff; private $_barheights = array(); private $_bartexts = array(); private $_barcolors = array(); public $_title; public $_paddingtop = 30; public $_paddingbottom = 100; public $_paddingleft = 45; public $_paddingright = 2; public $_barl = 50; public $image;
http://www.bkjia.com/phpjc/486183.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/486183.htmltecharticle?php /*** * 时间 2010-8-9 * www.ite5e.com * 注意:如有什么问题可以回帖。 * 程序最底下有调用测试代码。 ***/ define(default_font_path, c:/windows/fonts/...