This is a program that displays a series of image files - photos or
digital art. It allows the viewer to control moving between the images,
to zoom in or out, and pan around the image.
KPL version: Phrogram
Difficulty: Intermediate
Concepts: Arrays, Sprites, mouse handling, pushable buttons
Lines of code: 175
Author: Jon Schwartz
For the moment, the image filenames need to be listed in code, and the array of filenames sized to match.
The zip file with source code is 2 megs in size mainly because I've
included 21 thumbnail images of Charles Csuri's cool digital art - see
csuri.com/.
The phrogram also works very well with high-quality digital photos,
which allow lots of room for zooming and panning. I didn't use those
with this example because they're so large they made the ZIP file huge,
even with only 3 photos!
The idea, of course, is for you to be able to put your own images or photos in here and play with them - you can do that by
1) copying your files into the folder where you unzip this phrogram,
2) changing the filenames to match yours, and then
3) changing the length of the array to match the number of images you want to use.
4) Click run, and you can play with your own art or photos!
Future additions to the Phrogram libraries will make this an even more interesting example:
First, we'll add a "directory" object to the class library, which will
mean that we can detect the images files automatically rather than
hard-code them in the phrogram as this example does.
Second, we'll allow a programmer to choose whether or not to embed image and other resources
within a KPL exe file. At the moment, as in this example, those are usable only as files external to the EXE.