Fundamentals of SVG Programming: Concepts to Source Code (Graphics Series)
|
|
|
Converting Proprietary Files to SVG with Perl
The text file
Listing 17.11 proprietary1.xyz
########################################## # This file is based on a proprietary # format for a fictitious company XYZ # # Supported objects include the following: # circle # rectangle # polygon # ########################################## START DEFINITION ID: CIRCLE0 TYPE: CIRCLE centerx:100 centery:80 radius:20 style { fill:blue stroke:yellow stroke-width:2 } END DEFINITION START DEFINITION ID: RECT0 TYPE: RECT width:200 height:100 xcoordinate:200 ycoordinate:200 style { fill:red stroke:green stroke-width:4 } END DEFINITION
The SVG document in Listing 17.12 is generated when the Perl script
Listing 17.12 proprietary1.svg
<svg width="100%" height="100%"> <g> <circle cx="100" cy="80" r="20" /> <rect y="200" height="100" width="200" x="200" /> </g> </svg>
Remarks
You can generate the SVG document from the following command:
perl -w convert1.pl >proprietary1.svg
The Perl script
|
|
|