This teachpack provides a variety of functions for manipulating graphical images. To use it, you'll need to
This should be done once on your home computer, and you'll never have to do it again (unless I come up with an improved version). If you do it on a classroom computer, the teachpack may be uninstalled before the next time you come to class, so you'll have to do it again (unless I can persuade the Computing Center to install it permanently).
Start DrScheme, go to the "File" menu, choose "Install .plt file...", make sure you're in the "Web" tab rather than the "File" tab, type the URL "http://www.adelphi.edu/sbloch/class/160/tiles.plt" into the blank, and hit "OK". It should be downloaded and installed.
However, on some computers this doesn't seem to work: you get messages like "gnu-unzip: bad header" and "not an unpackable distribution archive". If that happens, try...
Right-click on the link tiles.plt, choose "Save file as...", and save it somewhere on your computer. Wherever you put it, it should appear with a red-white-and-blue DrScheme logo. If so, double-click on it and it should install automatically (perhaps showing a black window for a few seconds).
If the file appears with some other kind of logo, try...
Once you've saved the tiles.plt
file somewhere on your computer,
start DrScheme, choose "File->Install .plt file...", click the "File"
tab, then the "Browse" button, navigate to wherever you put the file,
select it, and hit "OK".
You should get a bunch of messages ending with "Done setting up."
If that doesn't work, talk to me.
When you start DrScheme, you can tell it you want to use these added functions, and it'll remember that for the next time you start DrScheme on the same computer... unless somebody else using the same computer tells it not to use this teachpack, in which case you'll need to go through these steps again.
Go to the "Language" menu in DrScheme and choose "Add Teachpack", select "tiles.ss", click "Open", and then click the "Run" button. You should see a message saying "Teachpack: ... tiles.ss" in the interactions window. The next time you start DrScheme, it should remember this unless you choose "Language->Clear Teachpack" to remove the teachpack.
You can copy-and-paste images from a Web browser into DrScheme and use them just like any other value: you can store them in a variable, etc. This teachpack includes several useful functions for manipulating images:
image-above: image image -> imageCombines two images into one, putting the first on top of the second.
image-beside: image image -> imageCombines two images into one, putting the first to the left of the second.
reflect-vert : image -> imageflips an image top-to-bottom.
reflect-horiz : image -> imageflips an image left-to-right.
reflect-main-diag : image -> imageflips an image top-left to bottom-right.
reflect-other-diag : image -> imageflips an image top-right to bottom-left.
rotate-cw : image -> imagerotates an image 90 degrees clockwise.
rotate-ccw : image -> imagerotates an image 90 degrees counter-clockwise.
rotate-180 : image -> imagerotates an image 180 degrees.
overlay : image image image ... -> imagepiles the images on top of one another, with the first covered by the second, the second covered by the third, etc. Presumably you would only do this if the second were smaller than the first, so you could still see the first image around the edges of the second.
rectangle: number number mode color -> imagewhere mode is either "outline" or "solid" (in quotation marks), and color is the name of a color ("red", "yellow", "white", "black", "blue", "green", etc. in quotation marks). The first number is the width of the rectangle, and the second number is the height.
circle: number mode color -> imageThe number is the radius of the circle.
ellipse: number number mode color -> imageThe two numbers are the width and height, respectively, of the ellipse.
triangle: number mode color -> imageProduces an equilateral triangle, each side of which is specified by the number.
line: number (x) number (y) color -> imageProduces a colored line from (0,0) to the specified coordinates. Note that both numbers must be positive; larger x is to the right, and larger y is down on the screen.
text: string number color -> imageDraws the specified string in the specified point size and color. (No font control at this point; this is a simple image library!)
image-inside?: image image -> booleantells whether the second image appears as part of the first
image-width : image -> numbertells how many pixels wide the image is
image-height : image -> numbertells how many pixels high the image is
There are numerous other, more obscure, functions provided; to learn about them, start DrScheme, choose "Help -> Help Desk", and search for "image.ss" (my "tiles.ss" teachpack is an enhancement of the built-in "image.ss", including all the same functions and a few improvements).