Tiles Teachpack
Tiles Teachpack
To install...
(require (planet "install.ss" ("sbloch" "tiles.plt" 1 2)))
You should need to do this only once, and it'll install a "tiles.ss"
teachpack into the "Add Teachpack" dialogue.
The tiles teachpack provides a variety of functions for combining and
manipulating images. Imagine that each image were on a ceramic tile;
you would expect to be able to put two tiles together side by side, or
one above another, or rotate a tile, etc. That's exactly what this
teachpack provides.
> (image-above img1 img2 ...) -> image
Combines two or more images into one, putting the first above the second (above the third, ...).
> (image-above-align-right img1 img2 ...) -> image
Just like image-above, but lines up the right-hand edges of all the images.
> (image-above-align-left img1 img2 ...) -> image
Just like image-above, but lines up the left-hand edges of all the images.
> (image-above-align-center img1 img2 ...) -> image
Just like image-above, but lines up the centers of all the images.
> (image-beside img1 img2 ...) -> image
Combines two or more images into one, putting the first to the left of the second
(to the left of the third, ...).
> (image-beside-align-top img1 img2 ...) -> image
Just like image-beside, but lines up the top edges of all the images.
> (image-beside-align-bottom img1 img2 ...) -> image
Just like image-beside, but lines up the bottom edges of all the images.
> (image-beside-align-center img1 img2 ...) -> image
Just like image-beside, but lines up the centers of all the images.
> (reflect-vert img) -> image
Flips an image top-to-botom.
> (reflect-horiz img) -> image
Flips an image left-to-right.
> (reflect-main-diag img) -> image
Flips an image from top-right to bottom-left, leaving the top-left and bottom-right unchanged.
> (reflect-other-diag img) -> image
Flips an image from top-left to bottom-right, leaving the top-right and bottom-left unchanged.
> (rotate-cw img) -> image
Rotates an image 90 degrees clockwise.
> (rotate-ccw img) -> image
Rotates an image 90 degrees counterclockwise.
> (rotate-180 img) -> image
Rotates an image 180 degrees around its center.
> (show-pinhole img) -> image
Overlays a small black dot at the pinhole of the given image, so you can
see where it is. (This function will go away when pinholes go away....)
> (crop-top img num-pixels) -> image
Chops off the specified number of pixels from the top of the image.
> (crop-bottom img num-pixels) -> image
Chops off the specified number of pixels from the bottom of the image.
> (crop-left img num-pixels) -> image
Chops off the specified number of pixels from the left side of the image.
> (crop-right img num-pixels) -> image
Chops off the specified number of pixels from the right side of the image.
Since anybody using these functions will almost certainly also want to
use other image-creation and image-manipulation functions, this
teachpack includes the standard teachpack image.ss.
That is, if you have tiles.ss loaded, you don't also need
image.ss (and you're better off not loading it).