Skip to content

Commit

Permalink
Hello Daniel, I've tried to follow your pointers about PEAR CS (codin…
Browse files Browse the repository at this point in the history
…g standards?). This is the revised patch.
  • Loading branch information
oevad committed Jan 30, 2012
1 parent 02badab commit 48bf8c8
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions Image/Canvas/SVG.php
Expand Up @@ -228,13 +228,44 @@ function _getLineStyle($lineStyle = false)

// TODO Linestyles (i.e. fx. dotted) does not work

if (($lineStyle != 'transparent') && ($lineStyle !== false)) {
$result = 'stroke-width:' . $this->_thickness . ';';
$result .= 'stroke:' .$this->_color($lineStyle) . ';';
if ($opacity = $this->_opacity($lineStyle)) {
$result .= 'stroke-opacity:' . $opacity . ';';
if (!is_array($lineStyle)) {
if (($lineStyle != 'transparent') && ($lineStyle !== false)) {
$result = 'stroke-width:' . $this->_thickness . ';';
$result .= 'stroke:' .$this->_color($lineStyle) . ';';
if ($opacity = $this->_opacity($lineStyle)) {
$result .= 'stroke-opacity:' . $opacity . ';';
}
}
return $result;
}

//the following if-blocks are when $lineStyle is an array
//dotted line
if (count($lineStyle) == 2) {
if (($lineStyle[0] != 'transparent') && ($lineStyle[0] !== false)) {
$result = 'stroke-width:' . $this->_thickness . ';';
$result .= 'stroke:' .$this->_color($lineStyle[0]) . ';';
if ($opacity = $this->_opacity($lineStyle[0])) {
$result .= 'stroke-opacity:' . $opacity . ';';
}
$result .= 'stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1;stroke-dasharray:1,4;stroke-dashoffset:1;';
}
return $result;
}

//dashed line
if (count($lineStyle) == 6) {
if (($lineStyle[0] != 'transparent') && ($lineStyle[0] !== false)) {
$result = 'stroke-width:' . $this->_thickness . ';';
$result .= 'stroke:' .$this->_color($lineStyle[0]) . ';';
if ($opacity = $this->_opacity($lineStyle[0])) {
$result .= 'stroke-opacity:' . $opacity . ';';
}
$result .= 'stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:1;stroke-dasharray:4,4;stroke-dashoffset:1;';
}
return $result;
}

return $result;
}

Expand Down

0 comments on commit 48bf8c8

Please sign in to comment.