Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 January 30, 2012

Showing 1 changed file with 36 additions and 5 deletions. Show diff stats Hide diff stats

  1. 41  Image/Canvas/SVG.php
41  Image/Canvas/SVG.php
@@ -228,13 +228,44 @@ function _getLineStyle($lineStyle = false)
228 228
 
229 229
         // TODO Linestyles (i.e. fx. dotted) does not work
230 230
 
231  
-        if (($lineStyle != 'transparent') && ($lineStyle !== false)) {
232  
-            $result = 'stroke-width:' . $this->_thickness . ';';
233  
-            $result .= 'stroke:' .$this->_color($lineStyle) . ';';
234  
-            if ($opacity = $this->_opacity($lineStyle)) {
235  
-                $result .= 'stroke-opacity:' . $opacity . ';';
  231
+        if (!is_array($lineStyle)) {
  232
+            if (($lineStyle != 'transparent') && ($lineStyle !== false)) {
  233
+                $result = 'stroke-width:' . $this->_thickness . ';';
  234
+                $result .= 'stroke:' .$this->_color($lineStyle) . ';';
  235
+                if ($opacity = $this->_opacity($lineStyle)) {
  236
+                    $result .= 'stroke-opacity:' . $opacity . ';';
  237
+                }
236 238
             }
  239
+            return $result;
  240
+        }
  241
+
  242
+        //the following if-blocks are when $lineStyle is an array
  243
+        //dotted line
  244
+        if (count($lineStyle) == 2) {
  245
+            if (($lineStyle[0] != 'transparent') && ($lineStyle[0] !== false)) {
  246
+                $result = 'stroke-width:' . $this->_thickness . ';';
  247
+                $result .= 'stroke:' .$this->_color($lineStyle[0]) . ';';
  248
+                if ($opacity = $this->_opacity($lineStyle[0])) {
  249
+                    $result .= 'stroke-opacity:' . $opacity . ';';
  250
+                }
  251
+                $result .= 'stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1;stroke-dasharray:1,4;stroke-dashoffset:1;';
  252
+            }
  253
+            return $result;
237 254
         }
  255
+
  256
+        //dashed line
  257
+        if (count($lineStyle) == 6) {
  258
+            if (($lineStyle[0] != 'transparent') && ($lineStyle[0] !== false)) {
  259
+                $result = 'stroke-width:' . $this->_thickness . ';';
  260
+                $result .= 'stroke:' .$this->_color($lineStyle[0]) . ';';
  261
+                if ($opacity = $this->_opacity($lineStyle[0])) {
  262
+                    $result .= 'stroke-opacity:' . $opacity . ';';
  263
+                }
  264
+                $result .= 'stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:1;stroke-dasharray:4,4;stroke-dashoffset:1;';
  265
+            }
  266
+            return $result;
  267
+        }
  268
+
238 269
         return $result;
239 270
     }
240 271
 

0 notes on commit 48bf8c8

Please sign in to comment.
Something went wrong with that request. Please try again.