a few more definitions to avoid re-typing for BSLers

This commit is contained in:
Matthias Felleisen 2012-12-28 10:47:36 -05:00
parent dc7df5b9f1
commit e212c1c279

View File

@ -62,33 +62,30 @@ Instead, we can use @racket[beside/align] to line up the two triangles
along their bottoms instead of along the middles (which is what along their bottoms instead of along the middles (which is what
@racket[beside] does). @racket[beside] does).
@image-interaction[(above (beside/align "bottom" @image-interaction[
(triangle 40 "solid" "red") (define victorian
(triangle 30 "solid" "red")) (above (beside/align "bottom"
(rectangle 70 40 "solid" "black"))] (triangle 40 "solid" "red")
(triangle 30 "solid" "red"))
(rectangle 70 40 "solid" "black")))
victorian
]
To add a door to the house, we can overlay a brown @racket[rectangle], To add a door to the house, we can overlay a brown @racket[rectangle],
aligning it with the center bottom of the rest of the house. aligning it with the center bottom of the rest of the house.
@image-interaction[(overlay/align "center" "bottom" @image-interaction[
(rectangle 15 25 "solid" "brown") (define door (rectangle 15 25 "solid" "brown"))
(above (beside/align "bottom" (overlay/align "center" "bottom" door victorian)]
(triangle 40 "solid" "red")
(triangle 30 "solid" "red"))
(rectangle 70 40 "solid" "black")))]
We can use a similar technique to put a doorknob on the door, but instead of We can use a similar technique to put a doorknob on the door, but instead of
overlaying the doorknob on the entire house, we can overlay it just on the overlaying the doorknob on the entire house, we can overlay it just on the
door. door.
@image-interaction[(overlay/align "center" "bottom" @image-interaction[
(overlay/align "right" "center" (define door-with-knob
(circle 3 "solid" "yellow") (overlay/align "right" "center" (circle 3 "solid" "yellow") door))
(rectangle 15 25 "solid" "brown")) (overlay/align "center" "bottom" door-with-knob victorian)]
(above (beside/align "bottom"
(triangle 40 "solid" "red")
(triangle 30 "solid" "red"))
(rectangle 70 40 "solid" "black")))]
@section{Recursive Image Functions} @section{Recursive Image Functions}