Image-manipulation functions defined in tiles-world
Many of the functions in tiles-world are documented
in DrScheme's help desk, so I won't repeat their full descriptions here:
type either "image.ss" or "world.ss" into the search field of DrScheme's
help desk. The ones 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
Wherever a function takes in a "mode", you may use either a symbol or a
string, i.e. any of 'solid
, 'outline
,
"solid"
, or "outline"
.
The functions from "world.ss" are
- big-bang : Number Number Number World -> true
- on-tick-event : (World -> World) -> true
- on-key-event : (KeyEvent World -> World) -> true
- end-of-time : -> World
- nw:rectangle : Number Number Mode Color -> Image
(just like rectangle
but with the pinhole at the top
left rather than in the center)
- empty-scene : Number Number -> Scene
- place-image : Image Number Number Scene -> Scene
- run-movie : (Listof Image) -> true
In addition, tiles-world
provides several other
useful functions:
- 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).
- on-redraw-event : (World -> Image) -> true
-
(on-redraw-event draw-world)
installs the
draw-world
function to be called on the current world every
time the screen needs refreshing; the result will appear in the
animation window in place of whatever was there before.
Last modified:
Fri May 20 14:42:10 EDT 2005
Stephen Bloch /
sbloch@adelphi.edu