|
|
The text file proprietary1.xyz (note the suffix of this file) in Listing 17.11 contains a proprietary format for a fictitious company.
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 convert1.pl is invoked on the text file proprietary1.xyz.
Listing 17.12 proprietary1.svg
<svg width="100%" height="100%"> <g> <circle style="stroke:yellow;fill:blue;stroke-width:2;" cx="100" cy="80" r="20" /> <rect style="stroke:green;fill:red;stroke-width:4;" y="200" height="100" width="200" x="200" /> </g> </svg>
You can generate the SVG document from the following command:
perl -w convert1.pl >proprietary1.svg
The Perl script convert1.pl will not be covered because it contains 300 lines of code; it uses Perl arrays, hashes, functions, and file manipulation. If you read the Perl appendix, you will be able to understand the code. You can find this script in the folder for this chapter on the CD-ROM.
|
|