From 1fd08e491bd4d1e265574ea79f7f820e060d0921 Mon Sep 17 00:00:00 2001 From: Chouchen Date: Tue, 30 Nov 2010 17:18:38 +0000 Subject: [PATCH] Ajout de stroke + fill | Ajout de nouveaux Path possible --- trunk/svgtoimage.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/trunk/svgtoimage.php b/trunk/svgtoimage.php index 0943c4c..17d71c6 100644 --- a/trunk/svgtoimage.php +++ b/trunk/svgtoimage.php @@ -421,11 +421,10 @@ class SVGTOIMAGE{ $pathArray = split('[ ,]', $path); // Si le path est de format 'm 100 100 l 100 100 z' il faut recoller les morceaux - if(array_key_exists($pathArray[0], $this->pathType)){ - reset($pathArray); + if(array_key_exists(strtolower($pathArray[0]), $this->pathType)){ $j = 0; do{ - if(array_key_exists($pathArray[$j], $this->pathType)){ + if(array_key_exists(strtolower($pathArray[$j]), $this->pathType)){ $pathArray[$j] = $pathArray[$j].$pathArray[$j+1]; $pathArray[$j+1] = '~'; $j++; @@ -549,12 +548,12 @@ class SVGTOIMAGE{ $colorStroke = $this->_allocateColor((string)$stroke); $colorFill = $this->_allocateColor((string)$fill); - if($fill == ''){ - imagearc($this->_image , $x , $y , $r*2 , $r*2,0,359.9, $colorStroke ); - //imageellipse ($this->_image , $x , $y , $r*2 , $r*2, $colorStroke ); - }else{ - + if($fill != ''){ imagefilledarc($this->_image , $x , $y , $r*2 , $r*2 ,0,359.9, $colorFill, IMG_ARC_PIE ); + //imageellipse ($this->_image , $x , $y , $r*2 , $r*2, $colorStroke ); + } + if($stroke !=''){ + imagearc($this->_image , $x , $y , $r*2 , $r*2,0,359.9, $colorStroke ); } imagecolordeallocate( $this->_image, $colorStroke); imagecolordeallocate( $this->_image, $colorFill); @@ -641,11 +640,12 @@ class SVGTOIMAGE{ if($this->_debug && !$thickness) $this->_log->error('Erreur dans la mise en place de l\'épaisseur du trait'); if($this->_debug) $this->_log->message('Rectangle - x : '.$x.' - y : '.$y.' - width : '.$width.' - height : '.$height.' - fill : '.$colorFill[0].'-'.$colorFill[1].'-'.$colorFill[2].' - stroke : '.$colorStroke[0].'-'.$colorStroke[1].'-'.$colorStroke[2]); - if($fill == ''){ - imagerectangle($this->_image , $x , $y , $x+$width , $y+$height, IMG_COLOR_STYLED); - }else{ + if($fill != ''){ imagefilledrectangle ($this->_image , $x , $y , $x+$width , $y+$height, $colorFill ); } + if($stroke != ''){ + imagerectangle($this->_image , $x , $y , $x+$width , $y+$height, IMG_COLOR_STYLED); + } imagecolordeallocate($this->_image,$colorStroke); imagecolordeallocate($this->_image,$colorFill); imagesetthickness ( $this->_image , 1 ); @@ -680,11 +680,12 @@ class SVGTOIMAGE{ $thickness = imagesetthickness( $this->_image , (int)$strokeWidth ); if($this->_debug && !$thickness) $this->_log->error('Erreur dans la mise en place de l\'épaisseur du trait'); - if($fill == ''){ - imagepolygon ( $this->_image , $pointArray , count($pointArray)/2 , $colorStroke ); - }else{ + if($fill != ''){ imagefilledpolygon ($this->_image , $pointArray , count($pointArray)/2 , $colorFill ); } + if($stroke != ''){ + imagepolygon ( $this->_image , $pointArray , count($pointArray)/2 , $colorStroke ); + } imagecolordeallocate($this->_image,$colorStroke); imagecolordeallocate($this->_image,$colorFill); imagesetthickness ( $this->_image , 1 );