/** * Image_Graph_Font [Constructor] */ function Image_Graph_Font($name = false, $size = false) { parent::Image_Graph_Common(); if ($name !== false) { $this->_name = $name; } if ($size !== false) { $this->_size = $size; } }
/** * Image_Graph_Font [Constructor] * * @param string $name Font name * @param int $size Font size */ function Image_Graph_Font($name = false, $size = false) { parent::__construct(); if ($name !== false) { $this->_name = $name; } if ($size !== false) { $this->_size = $size; } }
/** * Get the canvas * * @return Image_Canvas The canvas * @access private */ function &_getCanvas() { if ($this->_canvas !== null || $this->_canvas !== false) { return $this->_canvas; } elseif (is_a($this->_parent, 'Image_Graph_Common')) { $this->_canvas =& $this->_parent->_getCanvas(); return $this->_canvas; } else { $this->_error('Invalid canvas'); $result = null; return $result; } }
/** * Output the element to the canvas * * @return bool Was the output 'good' (true) or 'bad' (false). * @see Image_Graph_Common * @access private */ function _done() { $background = $this->_getBackground(); $border = $this->_getBorderStyle(); if ($background || $border) { $this->_canvas->rectangle(array('x0' => $this->_left, 'y0' => $this->_top, 'x1' => $this->_right, 'y1' => $this->_bottom)); } $result = parent::_done(); if ($this->_shadow !== false) { $this->_displayShadow(); } return $result; }
/** * 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(); } }
/** * Image_Graph_SolidLine [Constructor] * * @param mixed $color The color of the line */ function Image_Graph_Line_Solid($color) { parent::Image_Graph_Common(); $this->_color = $color; }
/** * Create a new Image_Graph_color. * @param int $red The red part or the whole part * @param int $green The green part (or nothing), or the alpha channel * @param int $blue The blue part (or nothing) * @param int $alpha The alpha channel (or nothing) */ function newColor($red, $green = false, $blue = false, $alpha = false) { $this->_debug("Creating color Red = $red, Green/Alpha = $green, Blue = $blue, Alpha = $alpha"); if ($this->_parent) { $this->_parent->newColor($red, $green, $blue, $alpha); } }
/** * Image_Graph_Font [Constructor] */ function Image_Graph_Font() { parent::__construct(); }
/** * Return the linestyle * * @return int A GD Linestyle * @access private */ function _getLineStyle($ID = false) { if ($ID === false || !isset($this->_lineStyles[$ID])) { $ID = key($this->_lineStyles); if (!next($this->_lineStyles)) { reset($this->_lineStyles); } } $lineStyle =& $this->_lineStyles[$ID]; if (is_object($lineStyle)) { return $lineStyle->_getLineStyle($ID); } elseif ($lineStyle !== null) { return $lineStyle; } else { return parent::_getLineStyle($ID); } }
/** * Image_Graph_SolidLine [Constructor] * * @param mixed $color The color of the line */ function Image_Graph_Line_Solid($color) { parent::__construct(); $this->_color = $color; }
/** * Image_Graph_SolidLine [Constructor] * * @param mixed $color The color of the line */ function __construct($color) { parent::__construct(); $this->_color = $color; }
/** * Sets the parent. The parent chain should ultimately be a GraPHP object * @see Image_Graph_Common * @param Image_Graph_Common Parent The parent * @access private */ function _setParent(& $parent) { parent::_setParent($parent); if ((!$this->_alpha) or (!$GLOBALS['_Image_Graph_gd2'])) { $this->_index = ImageColorAllocate($this->_canvas(), $this->_red, $this->_green, $this->_blue); } else { $this->_index = ImageColorResolveAlpha($this->_canvas(), $this->_red, $this->_green, $this->_blue, $this->_alpha); } }