CS170 Exercise: SVG - Scaleable Vector Graphics
Part I - SVG from C++.
- Transfer the
file from the CS Dept's anonymous ftp site to your Hercules account
space by entering the command:
- cp /net/data/ftp/pub/class/170/ftp/cpp/SVG/gensvg.cpp gensvg.cpp
- NOTE: This program is provided courtesy of Dr. Philip Fong.
- Compile the program using: g++ -o gensvg gensvg.cpp
- You will need to use I/O Redirection to run program.
Use an editor to create a file called gensvg.data.
Put these numbers (one per line) in that file: 32 and 64.
Now run the program by entering:
./gensvg < gensvg.data
- The output will be displayed on your screen.
Examine the output, and if you are satisfied with it, create an output
./gensvg < gensvg.data > gensvg.svg
- Now display the gensvg.svg program from a browser.
Part II - Drawing your own picture.
Refer to the picture of the house and tree in Dr. Fong's
He provides both the picture and the code for it.
Use his notes and example along with the lab material to help
you create your own SVG picture.
Be sure to use all of the shapes: rectangle, circle, ellipse,
line, polyline, and polygon.
Also use stroke opacity and line opacity as part of your drawing.
Start by sketching out a rough drawing of your picture,
otherwise you'll get bogged down trying to figure out x-y coordinates.
Copyright: Department of Computer Science, University of Regina.