background image

PHP 代码:php 数据统计图类实例代码实例

<?php
/***
***/
define(“DEFAULT_FONT_PATH”, “c:/windows/fonts/simhei.ttf”);
class barbarism
{
    private $_x;
    private $_y;
    private $_h;
    public $_l = 50;
    private $_w = null;
    private $_srcPoints = array();
    private $_points = array();
    
    public function __construct($x, $y, $h, $l = 50, $w = null)
    {
        $this->_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))
        );
    }