Skip to content

Commit

Permalink
Fix setting color.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 12, 2015
1 parent 11158f6 commit 5072e0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions framework/Image/lib/Horde/Image/Svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function text(
{
$height = 12;
$style = 'font-family:' . $font . ';font-height:' . $height
. 'px;fill:' . $this->getHexColor($color) . ';text-anchor:start;';
. 'px;fill:' . Horde_Image::getHexColor($color) . ';text-anchor:start;';
$transform = 'rotate(' . $direction . ',' . $x . ',' . $y . ')';
$this->_svg->addChild(new XML_SVG_Text(array(
'text' => $string,
Expand All @@ -162,11 +162,11 @@ public function text(
public function circle($x, $y, $r, $color, $fill = null)
{
if (!empty($fill)) {
$style = 'fill:' . $this->getHexColor($fill) . '; ';
$style = 'fill:' . Horde_Image::getHexColor($fill) . '; ';
} else {
$style = 'fill:none;';
}
$style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1';
$style .= 'stroke:' . Horde_Image::getHexColor($color) . '; stroke-width:1';

$this->_svg->addChild(new XML_SVG_Circle(array(
'cx' => $x,
Expand All @@ -187,11 +187,11 @@ public function circle($x, $y, $r, $color, $fill = null)
public function polygon($verts, $color, $fill = null)
{
if (!empty($fill)) {
$style = 'fill:' . $this->getHexColor($fill) . '; ';
$style = 'fill:' . Horde_Image::getHexColor($fill) . '; ';
} else {
$style = 'fill:none;';
}
$style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1';
$style .= 'stroke:' . Horde_Image::getHexColor($color) . '; stroke-width:1';

$points = '';
foreach ($verts as $v) {
Expand All @@ -218,11 +218,11 @@ public function polygon($verts, $color, $fill = null)
public function rectangle($x, $y, $width, $height, $color, $fill = null)
{
if (!empty($fill)) {
$style = 'fill:' . $this->getHexColor($fill) . '; ';
$style = 'fill:' . Horde_Image::getHexColor($fill) . '; ';
} else {
$style = 'fill:none;';
}
$style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1';
$style .= 'stroke:' . Horde_Image::getHexColor($color) . '; stroke-width:1';

$this->_svg->addChild(new XML_SVG_Rect(array(
'x' => $x,
Expand All @@ -249,11 +249,11 @@ public function roundedRectangle(
)
{
if (!empty($fill)) {
$style = 'fill:' . $this->getHexColor($fill) . '; ';
$style = 'fill:' . Horde_Image::getHexColor($fill) . '; ';
} else {
$style = 'fill:none;';
}
$style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1';
$style .= 'stroke:' . Horde_Image::getHexColor($color) . '; stroke-width:1';

$this->_svg->addChild(new XML_SVG_Rect(
array('x' => $x,
Expand All @@ -278,7 +278,7 @@ public function roundedRectangle(
*/
public function line($x1, $y1, $x2, $y2, $color = 'black', $width = 1)
{
$style = 'stroke:' . $this->getHexColor($color)
$style = 'stroke:' . Horde_Image::getHexColor($color)
. '; stroke-width:' . (int)$width;
$this->_svg->addChild(new XML_SVG_Line(array(
'x1' => $x1,
Expand Down Expand Up @@ -306,7 +306,7 @@ public function dashedLine(
$dash_space = 2
)
{
$style = 'stroke:' . $this->getHexColor($color)
$style = 'stroke:' . Horde_Image::getHexColor($color)
. '; stroke-width:' . (int)$width
. '; stroke-dasharray:' . $dash_length . ',' . $dash_space . ';';
$this->_svg->addChild(new XML_SVG_Line(array(
Expand All @@ -329,7 +329,7 @@ public function dashedLine(
*/
public function polyline($verts, $color, $width = 1)
{
$style = 'stroke:' . $this->getHexColor($color)
$style = 'stroke:' . Horde_Image::getHexColor($color)
. '; stroke-width:' . $width . ';fill:none;';

// Calculate the path entry.
Expand Down Expand Up @@ -367,11 +367,11 @@ public function arc(
)
{
if (!empty($fill)) {
$style = 'fill:' . $this->getHexColor($fill) . '; ';
$style = 'fill:' . Horde_Image::getHexColor($fill) . '; ';
} else {
$style = 'fill:none;';
}
$style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1';
$style .= 'stroke:' . Horde_Image::getHexColor($color) . '; stroke-width:1';

$mid = round(($start + $end) / 2);

Expand Down
2 changes: 1 addition & 1 deletion framework/Image/lib/Horde/Image/Swf.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function raw()
*/
public function allocateColor($name)
{
list($r, $g, $b) = $this->getRGB($name);
list($r, $g, $b) = Horde_Image::getRGB($name);
return array('red' => $r, 'green' => $g, 'blue' => $b, 'alpha' => 255);
}

Expand Down

0 comments on commit 5072e0a

Please sign in to comment.