/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to svg Converter/svgtocanvas.php

  • Committer: a11vikob
  • Date: 2013-04-03 10:37:25 UTC
  • mto: (9.2.1 lenasys)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: a11vikob@student.his.se-20130403103725-54hdupq68scrd1nl
Changed directory structure of SVG-converter.
Also fixed some operator errors in svgtocanvas.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
//              Fix for SVG Style attribute errors if no ; is found i.e. attribute is last attribute of style string the code now works (untested)
45
45
//              Fix for SVG Font Size Bug - px was replaced with 0 instead of "" meaning that some times 2px would turn to 20
46
46
//              Fix: fontstyle or line style etc missing if style="" is used instead of font attributes. Error produced: fontstyle fontline fontfamily missing line 707-709 / Translate Rotate Scale missing 710-712    among others svg ARC 02  Should work now.
47
 
//              Bug: Empty text in SVG text in proporcion
48
 
//    Bug: If fill is after line, the change of fill is performed after line is drawn. (SVI_CFG from wikipedia and proporcion from wikipedia)
49
 
//              Bug: translate support for groups or individual objects such as proporcion transform="translate(642.5,-1381.291)" or transform="matrix(0.999962,-8.674822e-3,8.674822e-3,0.999962,1115.829,2072.128)" 
50
 
//  
51
47
//-------------------------------------------------------------------------- Next Version Blueprint
52
48
// Version 3.7
53
49
//    Curve Closing (html5)
106
102
}
107
103
 
108
104
if( isset( $_POST ['svgname'])) {
109
 
        $svg = simplexml_load_file( $_POST ['svgname'] );
 
105
        $svg = simplexml_load_file( '../media/svgconverter/' . $_POST ['svgname'] );
110
106
        // Recurse into elements and add to element stack
111
107
        // It is important to only process hierarchies of g elements and layers
112
108
        foreach( $svg as $element ) {
325
321
                                                        $dostr = "";
326
322
                                                }
327
323
                                        } else {
328
 
                                                $dostr. = $dochr;
 
324
                                                $dostr .= $dochr;
329
325
                                        }
330
326
                                        $j++;
331
327
                                }while( $j <= strlen( $workstr ));
415
411
                                echo "\n" . 'c.lineWidth = "' . $val . '";' . "\n";
416
412
                        } else if( $key == "points" &&( $graphelement -> getName() == "polygon" || $graphelement -> getName() == "polyline" || $graphelement -> getName() == "line" )) {
417
413
                                if( $defsmode ) {
418
 
                                        $defsstring. = "c.beginPath();\n";
 
414
                                        $defsstring .= "c.beginPath();\n";
419
415
                                } else {
420
416
                                        echo "c.beginPath();\n";
421
417
                                }
440
436
                                                        $dostr = "";
441
437
                                                }
442
438
                                        } else {
443
 
                                                $dostr. = $dochr;
 
439
                                                $dostr .= $dochr;
444
440
                                        }
445
441
                                        $j++;
446
442
                                        } while( $j <= strlen( $workstr ));
450
446
                                        for( $j = 0; $j < $noparams; $j += 2) {
451
447
                                                if( $j == 0 ) {
452
448
                                                        if( $defsmode ) {
453
 
                                                                $defsstring. = "c.moveTo( ".$params [$j].",".$params [$j+1].");\n";
 
449
                                                                $defsstring .= "c.moveTo( ".$params [$j].",".$params [$j+1].");\n";
454
450
                                                        } else {
455
451
                                                                echo "c.moveTo( ".$params[$j].",".$params[$j+1].");\n";                                                 
456
452
                                                        }
457
453
                                                } else {
458
454
                                                        if( $defsmode ) {
459
 
                                                                $defsstring. = "c.lineTo( ".$params[$j].",".$params[$j+1].");\n";
 
455
                                                                $defsstring .= "c.lineTo( ".$params[$j].",".$params[$j+1].");\n";
460
456
                                                        } else {
461
457
                                                                echo "c.lineTo( ".$params[$j].",".$params[$j+1].");\n";
462
458
                                                        }
465
461
                                        // If a polygon close path if not i.e. polyline keep it open
466
462
                                        if( $noparams >= 2 && $graphelement -> getName() == "polygon" ) {
467
463
                                                if( $defsmode ) {
468
 
                                                        $defsstring. = "c.lineTo( ".$params[0].",".$params[1]." );\n";
 
464
                                                        $defsstring .= "c.lineTo( ".$params[0].",".$params[1]." );\n";
469
465
                                                } else {
470
466
                                                        echo "c.lineTo( ".$params[0].",".$params[1]." );\n";
471
467
                                                }
494
490
                                                }
495
491
                                        }
496
492
                                        if( $defsmode ) {
497
 
                                                $defsstring. = "c.clip();\n\n";
 
493
                                                $defsstring .= "c.clip();\n\n";
498
494
                                        }
499
495
                        } else if ( $key == "d" ) {
500
496
                                $dval=$val;