Image-manipulation functions defined in tiles
The tiles.ss
teachpack provides several
useful functions for manipulating images:
- image-above : image image -> image
-
produces an image with the first image "above" (i.e. closer to
the top of the screen) the second. The pinholes are lined up in the x
dimension; the pinhole of the result is halfway between the pinholes of
the two images.
- image-beside : image image -> image
-
produces an image with the first image to the left of the second.
The pinholes are lined up in the y dimension;
the pinhole of the result is halfway between the pinholes of the two images.
- reflect-vert : image -> image
-
Reflects the given image top-to-bottom.
- reflect-horiz : image -> image
-
Reflects the given image left-to-right
and bottom.
- reflect-main-diag : image -> image
-
Reflects the given image across the diagonal from top-left to
bottom-right; in other words, it swaps top-right with bottom-left.
- reflect-other-diag : image -> image
-
Reflects the given image across the diagonal from top-right to
bottom-left; in other words, it swaps top-left with bottom-right.
- rotate-cw : image -> image
-
Rotates the given image 90 degrees clockwise around its pinhole.
- rotate-ccw : image -> image
-
Rotates the given image 90 degrees counterclockwise around its pinhole.
- rotate-180 : image -> image
-
Rotates the given image 180 degrees around its pinhole.
- show-pinhole : image -> image
-
Adds a small black dot to the image so you can see where the pinhole is
(useful in debugging).
If you're working with the tiles.ss
teachpack,
you'll probably also want to load the image.ss
teachpack
(although either one can be used without the other).
Documentation for image.ss
is already in DrScheme:
go to the "Help" menu, choose "Help Desk", and
type "image.ss" into the search field.
The functions you're most likely to use from "image.ss" are
- rectangle : int int mode image-color -> image
- circle : int mode image-color -> image
- ellipse : int int mode image-color -> image
- triangle : int mode image-color -> image
- line : int int image-color -> image
- add-line : image int int int int image-color -> image
- text : string size image-color -> image
- overlay : image image image ... -> image
- overlay/xy : image int int image -> image
- image-inside? : image image -> boolean
- find-image : image image -> posn
- image-width : image -> number
- image-height : image -> number
- pinhole-x : image -> number
- pinhole-y : image -> number
- move-pinhole : image number number -> image
- image->color-list : image -> list-of-color
- color-list->image : list-of-color int int int int -> image
- make-color : int int int -> color
- color? : anything -> boolean
- color-red : color -> int
- color-green : color -> int
- color-blue : color -> int
Last modified:
Tue Jan 31 16:13:33 EST 2006
Stephen Bloch /
sbloch@adelphi.edu