CIS 068 / 2: Lab-Assignment #5: Extension to The Magical Sketchpad
This assignment adds the possibility of saving/loading your art created with the sketchpad.
Please extend the program in a way, that it keeps track of the first 500 'drawing actions' after
each time the image was erased, i.e. store the x,y coordinates of the output-circles in an array.
Add two buttons to the control-window:
Pressing the 'Save Image' button should save the data in a TextFile named 'MyMagicalArt.txt' or, if required, in
multiple TextFiles 'MyMagicalArt_01.txt', 'MyMagicalArt_02.txt', ...(see remark below)
- The Save Image Button
- The Load Image Button
Pressing the 'LoadImage'button should load the data and restore the image in the output window.
Please respect the following problem:
- Due to different Each of the 4 output-panels can contain different sets of circles, so the data of each panel must be stored
separately. This could be done by creating 4 files ('MyMagicalArt_01.txt', 'MyMagicalArt_02.txt',...).However,
a better way would be to put the data of all 4 windows together in 1 file, separating them by an 'impossible pair of
coordinates', e.g. -1,-1.
- Of course a drawing could consist of more than 500 circles. Simply don't store them, no one will observe it.
For students who couldn't finish the assignment #4 but want to program assignment #5:
Write a program that randomly creates an image consisting of 500 circles. Show this image and add load/save - buttons
in the same way as described above.
This program only will consist of one frame, showing a panel containing 500 random-distributed circles, along with 2 buttons for
loading and saving the data.
Total of 5 points, no matter if you program the extension to assignment 4 or the extra program.
If you could finish assignment 4, please program the extension.
Programming both won't bring you additional points, please concentrate on one task !
A bonus point will be given for finishing assignment 4 and the extension and sending a data-file loadable by your program
loading an image i consider as art :-). The chance of gaining a bonus-point is given only to the extension of assignment 4,
because this one is slightly harder to program than the separate program.
Good Luck !