/** * Gets the fill style of the element * * @param int $ID Fill style ID * * @return int A GD filestyle representing the fill style * @see Image_Graph_Fill * @access private */ function _getFillStyle($ID = false) { if (is_object($this->_fillStyle)) { $this->_canvas->setFill($this->_fillStyle->_getFillStyle($ID)); } elseif ($this->_fillStyle != null) { $this->_canvas->setFill($this->_fillStyle); } else { return false; } return true; }
/** * @param float $fillOpacity * * @return $this */ public function setFillOpacity($fillOpacity) { $this->fillStyle->setOpacity($fillOpacity); return $this; }
/** * 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(); } }
/** * @param FillStyle $style */ public function update(FillStyle $style) { $this->setColor($style->getColor(), $style->getOpacity()); }