Skip to content

Commit

Permalink
fixes #3799 apply colors to exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
julienmoumne committed Apr 20, 2013
1 parent a63e6ca commit 25a5ac6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions plugins/ImageGraph/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ public function get(
$graph->setHeight($height);
$graph->setFont($font);
$graph->setFontSize($fontSize);
$graph->setBackgroundColor($backgroundColor);
$graph->setTextColor($textColor);
$graph->setException($e);
$graph->renderGraph();
Expand Down
11 changes: 11 additions & 0 deletions plugins/ImageGraph/StaticGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,17 @@ protected function getMaximumTextWidthHeight($values)
return array($maxWidth, $maxHeight);
}

protected function drawBackground()
{
$this->pImage->drawFilledRectangle(
0,
0,
$this->width,
$this->height,
array_merge(array('Alpha' => 100), $this->backgroundColor)
);
}

private static function hex2rgb($hexColor)
{
if (preg_match('/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/', $hexColor, $matches)) {
Expand Down
5 changes: 4 additions & 1 deletion plugins/ImageGraph/StaticGraph/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ public function renderGraph()

$this->initpImage();

$this->drawBackground();

$this->pImage->drawText(
0,
$textHeight,
$message
$message,
$this->textColor
);
}
}
9 changes: 1 addition & 8 deletions plugins/ImageGraph/StaticGraph/GridGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,7 @@ protected function initGridChart(
$bottomRightXValue = $this->width - $this->getGridRightMargin($horizontalGraph);
$bottomRightYValue = $this->getGraphBottom($horizontalGraph);

// background color
$this->pImage->drawFilledRectangle(
0,
0,
$this->width,
$this->height,
array_merge(array('Alpha' => 100), $this->backgroundColor)
);
$this->drawBackground();

$this->pImage->setGraphArea(
$topLeftXValue,
Expand Down

0 comments on commit 25a5ac6

Please sign in to comment.