added empty-scene
svn: r18138
This commit is contained in:
parent
a7dbbc2fa6
commit
124dbe9b93
|
@ -76,6 +76,7 @@ and they all have good sample contracts. (It is amazing what we can do with kids
|
||||||
circle
|
circle
|
||||||
ellipse
|
ellipse
|
||||||
rectangle
|
rectangle
|
||||||
|
empty-scene
|
||||||
square
|
square
|
||||||
rhombus
|
rhombus
|
||||||
regular-polygon
|
regular-polygon
|
||||||
|
|
|
@ -654,6 +654,10 @@
|
||||||
(check-mode/color-combination 'square 3 mode color)
|
(check-mode/color-combination 'square 3 mode color)
|
||||||
(make-a-polygon (rectangle-points side-length side-length) mode color))
|
(make-a-polygon (rectangle-points side-length side-length) mode color))
|
||||||
|
|
||||||
|
(define/chk (empty-scene width height)
|
||||||
|
(overlay (rectangle width height 'outline 'black)
|
||||||
|
(rectangle width height 'solid 'white)))
|
||||||
|
|
||||||
(define/chk (rhombus side-length angle mode color)
|
(define/chk (rhombus side-length angle mode color)
|
||||||
(check-mode/color-combination 'rhombus 3 mode color)
|
(check-mode/color-combination 'rhombus 3 mode color)
|
||||||
(let* ([left-corner (make-polar side-length (+ (* pi 1/2) (/ (degrees->radians angle) 2)))]
|
(let* ([left-corner (make-polar side-length (+ (* pi 1/2) (/ (degrees->radians angle) 2)))]
|
||||||
|
@ -956,6 +960,7 @@
|
||||||
circle
|
circle
|
||||||
ellipse
|
ellipse
|
||||||
rectangle
|
rectangle
|
||||||
|
empty-scene
|
||||||
square
|
square
|
||||||
rhombus
|
rhombus
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,10 @@
|
||||||
(make-bb 100 100 100)
|
(make-bb 100 100 100)
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
|
(test (empty-scene 185 100)
|
||||||
|
=>
|
||||||
|
(overlay (rectangle 185 100 'outline 'black)
|
||||||
|
(rectangle 185 100 'solid 'white)))
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; testing normalization
|
;; testing normalization
|
||||||
|
|
|
@ -244,6 +244,7 @@
|
||||||
(rectangle 48 48 "solid" "gray"))
|
(rectangle 48 48 "solid" "gray"))
|
||||||
'image
|
'image
|
||||||
"126418b230e.png")
|
"126418b230e.png")
|
||||||
|
(list '(empty-scene 160 90) 'image "216addb7809.png")
|
||||||
(list
|
(list
|
||||||
'(above/align
|
'(above/align
|
||||||
"left"
|
"left"
|
||||||
|
|
|
@ -621,11 +621,21 @@ Unlike @scheme[scene+curve], if the line passes outside of @scheme[image], the i
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@section{Placing Images}
|
@section{Placing Images & Scenes}
|
||||||
|
|
||||||
Placing images into scenes is particularly useful when building worlds
|
Placing images into scenes is particularly useful when building worlds
|
||||||
and universes using @scheme[2htdp/universe].
|
and universes using @scheme[2htdp/universe].
|
||||||
|
|
||||||
|
@defproc[(empty-scene [width (and/c real? (not/c negative?))]
|
||||||
|
[height (and/c real? (not/c negative?))])
|
||||||
|
image?]{
|
||||||
|
|
||||||
|
Creates an empty scene, i.e., a rectangle with a black outline.
|
||||||
|
|
||||||
|
@image-examples[(empty-scene 160 90)]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@defproc[(place-image [image image?] [x real?] [y real?] [scene image?]) image?]{
|
@defproc[(place-image [image image?] [x real?] [y real?] [scene image?]) image?]{
|
||||||
|
|
||||||
Places @scheme[image] onto @scheme[scene] with its center at the coordinates
|
Places @scheme[image] onto @scheme[scene] with its center at the coordinates
|
||||||
|
|
BIN
collects/teachpack/2htdp/scribblings/img/216addb7809.png
Normal file
BIN
collects/teachpack/2htdp/scribblings/img/216addb7809.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 306 B |
BIN
collects/teachpack/2htdp/scribblings/img/2bed4c99df8.png
Normal file
BIN
collects/teachpack/2htdp/scribblings/img/2bed4c99df8.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user