Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hello Daniel, I've tried to follow your pointers about PEAR CS (codin…

…g standards?). This is the revised patch.
  • Loading branch information...
commit 48bf8c8be2931078d0659051d841b837466cf080 1 parent 02badab
oevad authored
Showing with 36 additions and 5 deletions.
  1. +36 −5 Image/Canvas/SVG.php
41 Image/Canvas/SVG.php
View
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.