/** * Method displaying the graphical segment. * * @param Container $container Image in which display the element * @param int $x_margin left margin * @param int $y_margin top margin * @return false if something wrong */ function display($container, $x_margin = 0, $y_margin = 0) { $image = $container->getImage(); $color = imagecolorallocate($image, $this->_r_color, $this->_g_color, $this->_b_color); // $white = imagecolorallocate($image, 255, 255, 255); $x1_margin = $this->_x1 + $this->_x_margin + $x_margin; $y1_margin = $this->_y1 + $this->_y_margin + $y_margin; // $ret = imagefilledellipse($image, $x1_margin, $y1_margin, $this->_size + 3, $this->_size + 3, $white); $ret = imagefilledellipse($image, $x1_margin, $y1_margin, $this->_size, $this->_size, $color); return $ret; }
/** * Method displaying the graphical polygon. * * @param Container $container Image in which display the element * @param int $x_margin left margin * @param int $y_margin top margin * @return false if something wrong */ function display($container, $x_margin = 0, $y_margin = 0) { $image = $container->getImage(); $color = imagecolorallocate($image, $this->_r_color, $this->_g_color, $this->_b_color); $x_margin = $this->_x_margin + $x_margin; $y_margin = $this->_y_margin + $y_margin; $values = array(); for ($i = 0; $i < count($this->_coordinates); $i = $i + 2) { $values[$i] = $this->_coordinates[$i] + $x_margin; $values[$i + 1] = $this->_coordinates[$i + 1] + $y_margin; } return imagefilledpolygon($image, $values, count($values) / 2, $color); }
/** * Method displaying the graphical segment. * * @param Container $container Image in which display the element * @param int $x_margin left margin * @param int $y_margin top margin * @return false if something wrong */ function display($container, $x_margin = 0, $y_margin = 0) { $image = $container->getImage(); $color = imagecolorallocate($image, $this->_r_color, $this->_g_color, $this->_b_color); $x1_margin = $this->_x1 + $this->_x_margin + $x_margin - $this->getXDistance(); $y1_margin = $this->_y1 + $this->_y_margin + $y_margin - $this->getYDistance(); return imagestring($image, $this->getFont(), $x1_margin, $y1_margin, $this->getText(), $color); }
/** * Method displaying the graphical segment. * * @param Container $container Image in which display the element * @param int $x_margin left margin * @param int $y_margin top margin * @return false if something wrong */ function display($container, $x_margin = 0, $y_margin = 0) { $image = $container->getImage(); $color = imagecolorallocate($image, $this->_r_color, $this->_g_color, $this->_b_color); $x1_margin = $this->_x1 + $this->_x_margin + $x_margin; $y1_margin = $this->_y1 + $this->_y_margin + $y_margin; $x2_margin = $this->_x2 + $this->_x_margin + $x_margin; $y2_margin = $this->_y2 + $this->_y_margin + $y_margin; $ret = imageline($image, $x1_margin, $y1_margin, $x2_margin, $y2_margin, $color); for ($i = 1; $i <= $this->_size; $i++) { $ret = $ret && imageline($image, $x1_margin + $i, $y1_margin, $x2_margin + $i, $y2_margin, $color); $ret = $ret && imageline($image, $x1_margin - $i, $y1_margin, $x2_margin - $i, $y2_margin, $color); $ret = $ret && imageline($image, $x1_margin, $y1_margin + $i, $x2_margin, $y2_margin + $i, $color); $ret = $ret && imageline($image, $x1_margin, $y1_margin - $i, $x2_margin, $y2_margin - $i, $color); } return $ret; }