/** * Output the element to the canvas * @see Image_Graph_Common * @access private */ function _done() { if (is_a($this->_fillStyle, "Image_Graph_Fill")) { $this->_fillStyle->_reset(); } if ($this->_background != null) { $this->_debug("Drawing background"); ImageFilledRectangle($this->_canvas(), $this->_left, $this->_top, $this->_right, $this->_bottom, $this->_getBackground()); } if ($this->_identify) { $this->_debug("Identifying"); $red = rand(0, 255); $green = rand(0, 255); $blue = rand(0, 255); $color = ImageColorAllocate($this->_canvas(), $red, $green, $blue); if (isset($GLOBALS['_Image_Graph_gd2'])) { $alphaColor = ImageColorResolveAlpha($this->_canvas(), $red, $green, $blue, 200); } else { $alphaColor = $color; } ImageRectangle($this->_canvas(), $this->_left, $this->_top, $this->_right, $this->_bottom, $color); ImageFilledRectangle($this->_canvas(), $this->_left, $this->_top, $this->_right, $this->_bottom, $alphaColor); if ($this->_identifyText) { $text = eregi_replace("<[^>]*>([^<]*)", "\\1", $this->_identification()); if (ImageFontWidth(IMAGE_GRAPH_FONT) * strlen($text) > $this->width()) { $x = max($this->_left, min($this->_right, $this->_left + ($this->width() - ImageFontHeight(IMAGE_GRAPH_FONT)) / 2)); $y = max($this->_top, min($this->_bottom, $this->_bottom - ($this->height() - ImageFontWidth(IMAGE_GRAPH_FONT) * strlen($text)) / 2)); ImageStringUp($this->_canvas(), FONT, $x, $y, $text, $color); } else { $x = max($this->_left, min($this->_right, $this->_left + ($this->width() - ImageFontWidth(IMAGE_GRAPH_FONT) * strlen($text)) / 2)); $y = max($this->_top, min($this->_bottom, $this->_top + ($this->height() - ImageFontHeight(IMAGE_GRAPH_FONT)) / 2)); ImageString($this->_canvas(), FONT, $x, $y, $text, $color); } } } if ($this->_borderStyle != null) { $this->_debug("Drawing border"); ImageRectangle($this->_canvas(), $this->_left, $this->_top, $this->_right, $this->_bottom, ((is_a($this->_borderStyle, "Image_Graph_Color")) ? $this->_borderStyle->_index : $this->_borderStyle->_getLineStyle())); } parent::_done(); if ($this->_shadow) { $this->_displayShadow(); } }
/** * Gets the line style of the element * * @param int $ID Style ID * * @return int A GD linestyle representing the line style * @see Image_Graph_Line * @access private */ function _getLineStyle($ID = false) { if (is_object($this->_lineStyle)) { $result = $this->_lineStyle->_getLineStyle($ID); if (is_array($result)) { $this->_canvas->setLineThickness($result['thickness']); $this->_canvas->setLineColor($result['color']); } else { $this->_canvas->setLineThickness(1); $this->_canvas->setLineColor($result); } } elseif ($this->_lineStyle != null) { $this->_canvas->setLineThickness(1); $this->_canvas->setLineColor($this->_lineStyle); } else { return false; } return true; }
/** * Output the plotarea to the canvas * @access private */ function _done() { if ($this->_axisX != null) { $this->add($this->_axisX); } if ($this->_axisY != null) { $this->add($this->_axisY); } if ($this->_identify) { $red = rand(0, 255); $green = rand(0, 255); $blue = rand(0, 255); $color = ImageColorAllocate($this->_canvas(), $red, $green, $blue); if (isset($GLOBALS['_Image_Graph_gd2'])) { $alphaColor = ImageColorResolveAlpha($this->_canvas(), $red, $green, $blue, 200); } else { $alphaColor = $color; } ImageRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $color); ImageFilledRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $alphaColor); } if ($this->_fillStyle) { ImageFilledRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $this->_getFillStyle()); } parent::_done(); if ($this->_plotBorderStyle) { ImageRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $this->_plotBorderStyle->_getLineStyle()); } }